MC att control: do not update the attitude setpoint directly in transition mode

That enables us to update the pitch setpoint in Stabilized mode
in the VTOL controller (pitch ramp for transition).

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer 2023-12-04 14:13:50 +01:00
parent 8a031677d5
commit e260a92ccb
1 changed files with 6 additions and 3 deletions

View File

@ -193,9 +193,12 @@ MulticopterAttitudeControl::generate_attitude_setpoint(const Quatf &q, float dt,
attitude_setpoint.timestamp = hrt_absolute_time();
_vehicle_attitude_setpoint_pub.publish(attitude_setpoint);
// update attitude controller setpoint immediately
_attitude_control.setAttitudeSetpoint(q_sp, attitude_setpoint.yaw_sp_move_rate);
_thrust_setpoint_body = Vector3f(attitude_setpoint.thrust_body);
// update attitude controller setpoint immediately (don't do it in vtol transition, then the VTOL module generates the attitude setpoint)
if (!_vtol_in_transition_mode) {
_attitude_control.setAttitudeSetpoint(q_sp, attitude_setpoint.yaw_sp_move_rate);
_thrust_setpoint_body = Vector3f(attitude_setpoint.thrust_body);
}
_last_attitude_setpoint = attitude_setpoint.timestamp;
}