aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander
diff options
context:
space:
mode:
authorAnton Babushkin <anton.babushkin@me.com>2014-03-28 10:44:28 +0400
committerAnton Babushkin <anton.babushkin@me.com>2014-03-28 10:44:28 +0400
commita991ebd8ca4aa1dc6fd69e307a74be6a93f4e6ff (patch)
tree6f96a4c1e8814cb9232b6b1f94a0f7be4d87116e /src/modules/commander
parent83da4ae02dfc61d6a7f80ae40660826fbbca81be (diff)
parent9b1de5004c673ebe8bdf68f1b518565cccd6b05b (diff)
downloadpx4-firmware-a991ebd8ca4aa1dc6fd69e307a74be6a93f4e6ff.tar.gz
px4-firmware-a991ebd8ca4aa1dc6fd69e307a74be6a93f4e6ff.tar.bz2
px4-firmware-a991ebd8ca4aa1dc6fd69e307a74be6a93f4e6ff.zip
Merge branch 'master' into mpc_local_pos
Diffstat (limited to 'src/modules/commander')
-rw-r--r--src/modules/commander/commander.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index 7da062961..bc63c810b 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -119,6 +119,7 @@ extern struct system_load_s system_load;
#define POSITION_TIMEOUT 20000 /**< consider the local or global position estimate invalid after 20ms */
#define RC_TIMEOUT 100000
+#define RC_TIMEOUT_HIL 500000
#define DIFFPRESS_TIMEOUT 2000000
#define PRINT_INTERVAL 5000000
@@ -1099,8 +1100,16 @@ int commander_thread_main(int argc, char *argv[])
orb_copy(ORB_ID(vehicle_gps_position), gps_sub, &gps_position);
}
+
+ /*
+ * XXX workaround:
+ * Prevent RC loss in HIL when sensors.cpp is only publishing sp_man at a low rate (e.g. 30Hz)
+ * which can trigger RC loss if the computer/simulator lags.
+ */
+ uint64_t rc_timeout = status.hil_state == HIL_STATE_ON ? RC_TIMEOUT_HIL : RC_TIMEOUT;
+
/* start RC input check */
- if (!status.rc_input_blocked && sp_man.timestamp != 0 && hrt_absolute_time() < sp_man.timestamp + RC_TIMEOUT) {
+ if (!status.rc_input_blocked && sp_man.timestamp != 0 && hrt_absolute_time() < sp_man.timestamp + rc_timeout) {
/* handle the case where RC signal was regained */
if (!status.rc_signal_found_once) {
status.rc_signal_found_once = true;