mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 06:33:35 +08:00
FlightTaskOrbit: simplify tangential yaw_setpoint and pi wrap
This commit is contained in:
@@ -245,15 +245,8 @@ void FlightTaskOrbit::generate_circle_yaw_setpoints(const Vector2f ¢er_to_po
|
||||
break;
|
||||
|
||||
case orbit_status_s::ORBIT_YAW_BEHAVIOUR_HOLD_FRONT_TANGENT_TO_CIRCLE:
|
||||
if (_r > 0) {
|
||||
_yaw_setpoint = atan2f(center_to_position(1), center_to_position(0)) + M_PI_F / 2.f;
|
||||
|
||||
} else {
|
||||
_yaw_setpoint = atan2f(center_to_position(1), center_to_position(0)) - M_PI_F / 2.f;
|
||||
}
|
||||
|
||||
_yaw_setpoint = wrap_pi(atan2f(center_to_position(1), center_to_position(0)) + (sign(_v) * M_PI_F / 2.f));
|
||||
_yawspeed_setpoint = _v / _r;
|
||||
|
||||
break;
|
||||
|
||||
case orbit_status_s::ORBIT_YAW_BEHAVIOUR_RC_CONTROLLED:
|
||||
@@ -262,7 +255,7 @@ void FlightTaskOrbit::generate_circle_yaw_setpoints(const Vector2f ¢er_to_po
|
||||
|
||||
case orbit_status_s::ORBIT_YAW_BEHAVIOUR_HOLD_FRONT_TO_CIRCLE_CENTER:
|
||||
default:
|
||||
_yaw_setpoint = atan2f(center_to_position(1), center_to_position(0)) + M_PI_F;
|
||||
_yaw_setpoint = wrap_pi(atan2f(center_to_position(1), center_to_position(0)) + M_PI_F);
|
||||
// yawspeed feed-forward because we know the necessary angular rate
|
||||
_yawspeed_setpoint = _v / _r;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user