manual_control: update first, get diff after

Not sure why I had this the wrong way round.
This commit is contained in:
Julian Oes 2021-06-10 11:51:53 +02:00 committed by Matthias Grob
parent d0fea93d72
commit 2a41ade223

View File

@ -144,6 +144,11 @@ void ManualControl::Run()
_previous_disarm_gesture = false;
}
_x_diff.update(_selector.setpoint().chosen_input.x, dt_s);
_y_diff.update(_selector.setpoint().chosen_input.y, dt_s);
_z_diff.update(_selector.setpoint().chosen_input.z, dt_s);
_r_diff.update(_selector.setpoint().chosen_input.r, dt_s);
// user wants override
const float minimum_stick_change = 0.01f * _param_com_rc_stick_ov.get();
@ -156,11 +161,6 @@ void ManualControl::Run()
_selector.setpoint().user_override = rpy_moved || throttle_moved;
_x_diff.update(_selector.setpoint().chosen_input.x, dt_s);
_y_diff.update(_selector.setpoint().chosen_input.y, dt_s);
_z_diff.update(_selector.setpoint().chosen_input.z, dt_s);
_r_diff.update(_selector.setpoint().chosen_input.r, dt_s);
if (switches_updated) {
// Only use switches if current source is RC as well.
if (_selector.setpoint().chosen_input.data_source == manual_control_input_s::SOURCE_RC) {