aboutsummaryrefslogtreecommitdiff
path: root/src/modules/fw_att_control/fw_att_control_main.cpp
diff options
context:
space:
mode:
authorAnton Babushkin <anton.babushkin@me.com>2014-04-06 22:20:18 +0400
committerAnton Babushkin <anton.babushkin@me.com>2014-04-06 22:20:18 +0400
commitb6e00431dc184997cf63489d15c7bd3c0712b597 (patch)
tree4922de31e41d26815f8fa02225e8aa1596e42fe9 /src/modules/fw_att_control/fw_att_control_main.cpp
parenta4ba705e2f64616e25456c71572661f6b5e7cc3b (diff)
parentceb287504c7460b024ecabbcf278462da9e2aca1 (diff)
downloadpx4-firmware-b6e00431dc184997cf63489d15c7bd3c0712b597.tar.gz
px4-firmware-b6e00431dc184997cf63489d15c7bd3c0712b597.tar.bz2
px4-firmware-b6e00431dc184997cf63489d15c7bd3c0712b597.zip
Merge branch 'master' into rc_timeout
Diffstat (limited to 'src/modules/fw_att_control/fw_att_control_main.cpp')
-rw-r--r--src/modules/fw_att_control/fw_att_control_main.cpp18
1 files changed, 12 insertions, 6 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 4464b5e01..4ab5c19cf 100644
--- a/src/modules/fw_att_control/fw_att_control_main.cpp
+++ b/src/modules/fw_att_control/fw_att_control_main.cpp
@@ -671,18 +671,24 @@ FixedwingAttitudeControl::task_main()
float airspeed;
- /* if airspeed is smaller than min, the sensor is not giving good readings */
- if ((_airspeed.indicated_airspeed_m_s < 0.5f * _parameters.airspeed_min) ||
- !isfinite(_airspeed.indicated_airspeed_m_s) ||
+ /* if airspeed is not updating, we assume the normal average speed */
+ if (!isfinite(_airspeed.true_airspeed_m_s) ||
hrt_elapsed_time(&_airspeed.timestamp) > 1e6) {
airspeed = _parameters.airspeed_trim;
} else {
- airspeed = _airspeed.indicated_airspeed_m_s;
+ airspeed = _airspeed.true_airspeed_m_s;
}
- float airspeed_scaling = _parameters.airspeed_trim / airspeed;
- //warnx("aspd scale: %6.2f act scale: %6.2f", airspeed_scaling, actuator_scaling);
+ /*
+ * For scaling our actuators using anything less than the min (close to stall)
+ * speed doesn't make any sense - its the strongest reasonable deflection we
+ * want to do in flight and its the baseline a human pilot would choose.
+ *
+ * Forcing the scaling to this value allows reasonable handheld tests.
+ */
+
+ float airspeed_scaling = _parameters.airspeed_trim / ((airspeed < _parameters.airspeed_min) ? _parameters.airspeed_min : airspeed);
float roll_sp = _parameters.rollsp_offset_rad;
float pitch_sp = _parameters.pitchsp_offset_rad;