From fa5010109edf0c71914fc04bb2dc887918336f65 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Mon, 4 Dec 2017 13:15:50 +1100 Subject: [PATCH] commander: Reset nav test when vehicle is disarmed Previously, the only way to clear a failed nav test was to reboot. This hindered testing. --- src/modules/commander/commander.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index d6fb4d20c3..3630dd3cf1 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -2193,9 +2193,13 @@ int commander_thread_main(int argc, char *argv[]) orb_check(estimator_status_sub, &estimator_status_updated); if (estimator_status_updated) { orb_copy(ORB_ID(estimator_status), estimator_status_sub, &estimator_status); - - // record time of takeoff - if (land_detector.landed) { + if (status.arming_state == vehicle_status_s::ARMING_STATE_STANDBY) { + // reset flags and timer + time_at_takeoff = hrt_absolute_time(); + nav_test_failed = false; + nav_test_passed = false; + } else if (land_detector.landed) { + // record time of takeoff time_at_takeoff = hrt_absolute_time(); } else { // if nav status is unconfirmed, confirm yaw angle as passed after 30 seconds or achieving 5 m/s of speed