aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-03-27 18:07:39 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-03-27 18:07:39 +0100
commit9b1de5004c673ebe8bdf68f1b518565cccd6b05b (patch)
tree5ba9a134acc5ec1f6410701163459d6cf241d7d7 /src
parentbd290c65f843a81b180fc15c881b7481f52b570a (diff)
parent66527eea02ca6c8b1e33047f60bce1b832f82071 (diff)
downloadpx4-firmware-9b1de5004c673ebe8bdf68f1b518565cccd6b05b.tar.gz
px4-firmware-9b1de5004c673ebe8bdf68f1b518565cccd6b05b.tar.bz2
px4-firmware-9b1de5004c673ebe8bdf68f1b518565cccd6b05b.zip
Merge pull request #780 from PX4/hotfix_hil_rc_loss
commander: workaround to prevent RC loss in HIL
Diffstat (limited to 'src')
-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 d114a2e5c..cf7ba757e 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 1000000 /**< consider the local or global position estimate invalid after 1s */
#define RC_TIMEOUT 100000
+#define RC_TIMEOUT_HIL 500000
#define DIFFPRESS_TIMEOUT 2000000
#define PRINT_INTERVAL 5000000
@@ -1108,8 +1109,16 @@ int commander_thread_main(int argc, char *argv[])
}
}
+
+ /*
+ * 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;