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:
Matthias Grob
2018-04-05 07:30:12 +02:00
committed by Beat Küng
parent 309237c4a2
commit eaf4f99e38
10 changed files with 36 additions and 79 deletions
@@ -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);
}
}