mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 12:03:35 +08:00
fixed offboard loss timing handling
This commit is contained in:
@@ -1668,7 +1668,11 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
} else {
|
} else {
|
||||||
if (!status_flags.offboard_control_signal_lost) {
|
if (!status_flags.offboard_control_signal_lost) {
|
||||||
status_flags.offboard_control_signal_lost = true;
|
status_flags.offboard_control_signal_lost = true;
|
||||||
|
status_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check timer if offboard was there but now lost */
|
||||||
|
if (!status_flags.offboard_control_loss_timeout && offboard_control_mode.timestamp != 0) {
|
||||||
if (offboard_loss_timeout < FLT_EPSILON) {
|
if (offboard_loss_timeout < FLT_EPSILON) {
|
||||||
/* execute loss action immediately */
|
/* execute loss action immediately */
|
||||||
status_flags.offboard_control_loss_timeout = true;
|
status_flags.offboard_control_loss_timeout = true;
|
||||||
@@ -1676,9 +1680,12 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
} else {
|
} else {
|
||||||
/* wait for timeout if set */
|
/* wait for timeout if set */
|
||||||
status_flags.offboard_control_loss_timeout = offboard_control_mode.timestamp +
|
status_flags.offboard_control_loss_timeout = offboard_control_mode.timestamp +
|
||||||
OFFBOARD_TIMEOUT + offboard_loss_timeout * 1e6f > hrt_absolute_time();
|
OFFBOARD_TIMEOUT + offboard_loss_timeout * 1e6f < hrt_absolute_time();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status_flags.offboard_control_loss_timeout) {
|
||||||
|
status_changed = true;
|
||||||
}
|
}
|
||||||
status_changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user