aboutsummaryrefslogtreecommitdiff
path: root/src/modules/fw_att_control
diff options
context:
space:
mode:
authorRoman Bapst <romanbapst@yahoo.de>2014-11-10 17:16:30 +0100
committerRoman Bapst <romanbapst@yahoo.de>2014-11-10 17:16:30 +0100
commit31238516b537debd695f5cdf8e6c6e969907fe76 (patch)
tree8a1101258382a155832a2afa1141c27cbf061399 /src/modules/fw_att_control
parent43ebaf287c86acbf7fba13b5203de68afcc79b44 (diff)
parent4e8e6e653beb21808f532b83c6c6e827103ea379 (diff)
downloadpx4-firmware-31238516b537debd695f5cdf8e6c6e969907fe76.tar.gz
px4-firmware-31238516b537debd695f5cdf8e6c6e969907fe76.tar.bz2
px4-firmware-31238516b537debd695f5cdf8e6c6e969907fe76.zip
pulled from PX4 master
Diffstat (limited to 'src/modules/fw_att_control')
-rw-r--r--src/modules/fw_att_control/fw_att_control_main.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/modules/fw_att_control/fw_att_control_main.cpp b/src/modules/fw_att_control/fw_att_control_main.cpp
index 5cff390e2..80b58ec71 100644
--- a/src/modules/fw_att_control/fw_att_control_main.cpp
+++ b/src/modules/fw_att_control/fw_att_control_main.cpp
@@ -721,8 +721,14 @@ void FixedwingAttitudeControl::task_main() {
float pitch_sp = _parameters.pitchsp_offset_rad;
float throttle_sp = 0.0f;
- if (_vcontrol_mode.flag_control_velocity_enabled
- || _vcontrol_mode.flag_control_position_enabled) {
+ /* Read attitude setpoint from uorb if
+ * - velocity control or position control is enabled (pos controller is running)
+ * - manual control is disabled (another app may send the setpoint, but it should
+ * for sure not be set from the remote control values)
+ */
+ if (_vcontrol_mode.flag_control_velocity_enabled ||
+ _vcontrol_mode.flag_control_position_enabled ||
+ !_vcontrol_mode.flag_control_manual_enabled) {
/* read in attitude setpoint from attitude setpoint uorb topic */
roll_sp = _att_sp.roll_body + _parameters.rollsp_offset_rad;
pitch_sp = _att_sp.pitch_body
@@ -890,9 +896,13 @@ void FixedwingAttitudeControl::task_main() {
}
}
- /* throttle passed through */
- _actuators.control[3] =
- (isfinite(throttle_sp)) ? throttle_sp : 0.0f;
+
+ /* throttle passed through if it is finite and if no engine failure was
+ * detected */
+ _actuators.control[3] = (isfinite(throttle_sp) &&
+ !(_vehicle_status.engine_failure ||
+ _vehicle_status.engine_failure_cmd)) ?
+ throttle_sp : 0.0f;
if (!isfinite(throttle_sp)) {
if (_debug && loop_counter % 10 == 0) {
warnx("throttle_sp %.4f", (double) throttle_sp);