Eigen
Dependencies: Eigen
Dependents: optWingforHAPS_Eigen
Diff: Autopilot.cpp
- Revision:
- 16:36d034dec6d6
- Parent:
- 15:28f480b41553
- Child:
- 18:5e2e03a30e1c
--- a/Autopilot.cpp Mon Dec 06 08:23:54 2021 +0000 +++ b/Autopilot.cpp Mon Dec 06 08:43:43 2021 +0000 @@ -56,7 +56,7 @@ { float x_dist = destination(0) - pos_ned(0); float y_dist = destination(1) - pos_ned(1); - yaw_obj = atan2f(y_dist, x_dist); //rad + yaw_obj = std::atan2(y_dist, x_dist); //rad float yaw_diff = atan_angdiff(yaw_obj,yaw); roll_obj = p_control(yaw_diff, 0.3f); } @@ -65,7 +65,7 @@ { float x_dist = turn_center(0) - pos_ned(0); float y_dist = turn_center(1) - pos_ned(1); - float yaw_center = atan2f(y_dist, x_dist); + float yaw_center = std::atan2(y_dist, x_dist); float yaw_diff = atan_angdiff(yaw_center,yaw); //旋回中心までの方位角, rad float dist = sqrt(x_dist*x_dist + y_dist*y_dist); //旋回中心までの距離 //旋回円から遠い場合は旋回中心まで誘導 @@ -165,7 +165,7 @@ float Autopilot::atan_angdiff(float a1,float a2) { - return atan2f(sinf(a1-a2),cosf(a1-a2)); + return std::atan2(std::sin(a1-a2),std::cos(a1-a2)); } float Autopilot::deg2rad(float deg) @@ -177,5 +177,5 @@ { float alt_diff = alt - alt_before; float xy_diff = sqrt((pos_ned(0) - pos_before(0))*(pos_ned(0) - pos_before(0)) + (pos_ned(1) - pos_before(1))*(pos_ned(1) - pos_before(1))); - path_ang = atan2f(alt_diff, xy_diff); + path_ang = std::atan2(alt_diff, xy_diff); } \ No newline at end of file