diff --git a/src/modules/fw_att_control/FixedwingAttitudeControl.cpp b/src/modules/fw_att_control/FixedwingAttitudeControl.cpp index 483959e2d7..a9b814243d 100644 --- a/src/modules/fw_att_control/FixedwingAttitudeControl.cpp +++ b/src/modules/fw_att_control/FixedwingAttitudeControl.cpp @@ -613,7 +613,6 @@ void FixedwingAttitudeControl::run() float roll_sp = _att_sp.roll_body; float pitch_sp = _att_sp.pitch_body; float yaw_sp = _att_sp.yaw_body; - float throttle_sp = _att_sp.thrust; /* Prepare data for attitude controllers */ struct ECL_ControlData control_input = {}; @@ -708,8 +707,8 @@ void FixedwingAttitudeControl::run() } /* throttle passed through if it is finite and if no engine failure was detected */ - _actuators.control[actuator_controls_s::INDEX_THROTTLE] = (PX4_ISFINITE(throttle_sp) - && !_vehicle_status.engine_failure) ? throttle_sp : 0.0f; + _actuators.control[actuator_controls_s::INDEX_THROTTLE] = (PX4_ISFINITE(_att_sp.thrust) + && !_vehicle_status.engine_failure) ? _att_sp.thrust : 0.0f; /* scale effort by battery status */ if (_parameters.bat_scale_en && @@ -772,7 +771,7 @@ void FixedwingAttitudeControl::run() _actuators.control[actuator_controls_s::INDEX_YAW] = (PX4_ISFINITE(yaw_u)) ? yaw_u + _parameters.trim_yaw : _parameters.trim_yaw; - _actuators.control[actuator_controls_s::INDEX_THROTTLE] = PX4_ISFINITE(throttle_sp) ? throttle_sp : 0.0f; + _actuators.control[actuator_controls_s::INDEX_THROTTLE] = PX4_ISFINITE(_rates_sp.thrust) ? _rates_sp.thrust : 0.0f; } rate_ctrl_status_s rate_ctrl_status;