mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 04:41:35 +08:00
FlightTasks: adapt tasks to member setpoints
The FlightTaskManual... tasks already had their internal setpoint member variables. I switched them to use the architecture with setpoint member variables as it was implemented the commit before. They simplify a lot.
This commit is contained in:
@@ -61,11 +61,11 @@ protected:
|
||||
FlightTaskManualPosition::_updateSetpoints(); // get all setpoints from position task
|
||||
|
||||
/* Scale horizontal velocity setpoint by maximum allowed velocity. */
|
||||
if (PX4_ISFINITE(_vel_sp(0)) && Vector2f(&_vel_sp(0)).length() > 0.0f) {
|
||||
Vector2f vel_sp_xy = Vector2f(&_vel_sp(0));
|
||||
if (PX4_ISFINITE(_velocity_setpoint(0)) && Vector2f(&_velocity_setpoint(0)).length() > 0.0f) {
|
||||
Vector2f vel_sp_xy = Vector2f(&_velocity_setpoint(0));
|
||||
vel_sp_xy = vel_sp_xy.normalized() * _vel_xy_max.get() / _vel_xy_manual_max.get() * vel_sp_xy.length();
|
||||
_vel_sp(0) = vel_sp_xy(0);
|
||||
_vel_sp(1) = vel_sp_xy(1);
|
||||
_velocity_setpoint(0) = vel_sp_xy(0);
|
||||
_velocity_setpoint(1) = vel_sp_xy(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user