mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 22:58:10 +08:00
mc_att_control: fix for Rattitude mode
When switching back from rate to attitude control, the code depended on a vehicle_control_mode topics update, but the publication frequency of that is low. So the switch was noticeably delayed.
This commit is contained in:
@@ -876,13 +876,12 @@ MulticopterAttitudeControl::run()
|
||||
attitude_dt += dt;
|
||||
|
||||
/* Check if we are in rattitude mode and the pilot is above the threshold on pitch
|
||||
* or roll (yaw can rotate 360 in normal att control). If both are true don't
|
||||
* or roll (yaw can rotate 360 in normal att control). If both are true don't
|
||||
* even bother running the attitude controllers */
|
||||
if (_v_control_mode.flag_control_rattitude_enabled) {
|
||||
if (fabsf(_manual_control_sp.y) > _rattitude_thres.get() ||
|
||||
fabsf(_manual_control_sp.x) > _rattitude_thres.get()) {
|
||||
_v_control_mode.flag_control_attitude_enabled = false;
|
||||
}
|
||||
_v_control_mode.flag_control_attitude_enabled =
|
||||
fabsf(_manual_control_sp.y) <= _rattitude_thres.get() &&
|
||||
fabsf(_manual_control_sp.x) <= _rattitude_thres.get();
|
||||
}
|
||||
|
||||
bool attitude_setpoint_generated = false;
|
||||
|
||||
Reference in New Issue
Block a user