mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 20:03:34 +08:00
Fixed correct RC loss detection, AR.Drone is now shutting down motors after 1 s of RC loss. Added debug topic.
This commit is contained in:
@@ -69,6 +69,7 @@
|
||||
#include <uORB/topics/vehicle_gps_position.h>
|
||||
#include <uORB/topics/vehicle_command.h>
|
||||
#include <uORB/topics/subsystem_info.h>
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
#include <mavlink/mavlink_log.h>
|
||||
|
||||
#include <systemlib/param/param.h>
|
||||
@@ -1174,6 +1175,7 @@ int commander_thread_main(int argc, char *argv[])
|
||||
/* End battery voltage check */
|
||||
|
||||
/* Start RC state check */
|
||||
bool prev_lost = current_status.rc_signal_lost;
|
||||
|
||||
if (rc.chan_count > 4 && (hrt_absolute_time() - rc.timestamp) < 100000) {
|
||||
|
||||
@@ -1238,10 +1240,18 @@ int commander_thread_main(int argc, char *argv[])
|
||||
/* flag as lost and update interval since when the signal was lost (to initiate RTL after some time) */
|
||||
current_status.rc_signal_cutting_off = true;
|
||||
current_status.rc_signal_lost_interval = hrt_absolute_time() - rc.timestamp;
|
||||
|
||||
/* if the RC signal is gone for a full second, consider it lost */
|
||||
if (current_status.rc_signal_lost_interval > 1000000) current_status.rc_signal_lost = true;
|
||||
}
|
||||
|
||||
/* Check if this is the first loss or first gain*/
|
||||
if ((!prev_lost && current_status.rc_signal_lost) ||
|
||||
prev_lost && !current_status.rc_signal_lost) {
|
||||
/* publish rc lost */
|
||||
publish_armed_status(¤t_status);
|
||||
}
|
||||
|
||||
/* End mode switch */
|
||||
|
||||
/* END RC state check */
|
||||
|
||||
Reference in New Issue
Block a user