From 224aaeddfecee3db00ab64bda783521e3b070fa8 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 9 Apr 2016 13:44:53 -0700 Subject: [PATCH] Harden calibration experience on master --- src/modules/commander/calibration_routines.cpp | 12 ++++++++++-- src/modules/commander/mag_calibration.cpp | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/modules/commander/calibration_routines.cpp b/src/modules/commander/calibration_routines.cpp index 3ffa556e48..f0e9d2366d 100644 --- a/src/modules/commander/calibration_routines.cpp +++ b/src/modules/commander/calibration_routines.cpp @@ -457,13 +457,15 @@ calibrate_return calibrate_from_orientation(orb_advert_t *mavlink_log_pub, } } calibration_log_info(mavlink_log_pub, "[cal] pending:%s", pendingStr); - + usleep(20000); calibration_log_info(mavlink_log_pub, "[cal] hold vehicle still on a pending side"); + usleep(20000); enum detect_orientation_return orient = detect_orientation(mavlink_log_pub, cancel_sub, sub_accel, lenient_still_position); if (orient == DETECT_ORIENTATION_ERROR) { orientation_failures++; calibration_log_info(mavlink_log_pub, "[cal] detected motion, hold still..."); + usleep(20000); continue; } @@ -471,11 +473,14 @@ calibrate_return calibrate_from_orientation(orb_advert_t *mavlink_log_pub, if (side_data_collected[orient]) { orientation_failures++; calibration_log_critical(mavlink_log_pub, "%s side already completed", detect_orientation_str(orient)); - calibration_log_critical(mavlink_log_pub, "rotate to a pending side"); + usleep(20000); continue; } calibration_log_info(mavlink_log_pub, CAL_QGC_ORIENTATION_DETECTED_MSG, detect_orientation_str(orient)); + usleep(20000); + calibration_log_info(mavlink_log_pub, CAL_QGC_ORIENTATION_DETECTED_MSG, detect_orientation_str(orient)); + usleep(20000); orientation_failures = 0; // Call worker routine @@ -485,6 +490,9 @@ calibrate_return calibrate_from_orientation(orb_advert_t *mavlink_log_pub, } calibration_log_info(mavlink_log_pub, CAL_QGC_SIDE_DONE_MSG, detect_orientation_str(orient)); + usleep(20000); + calibration_log_info(mavlink_log_pub, CAL_QGC_SIDE_DONE_MSG, detect_orientation_str(orient)); + usleep(20000); // Note that this side is complete side_data_collected[orient] = true; diff --git a/src/modules/commander/mag_calibration.cpp b/src/modules/commander/mag_calibration.cpp index 7675c860c3..d303ea09b7 100644 --- a/src/modules/commander/mag_calibration.cpp +++ b/src/modules/commander/mag_calibration.cpp @@ -73,7 +73,7 @@ static constexpr unsigned int calibration_sides = 6; ///< The total number of static constexpr unsigned int calibration_total_points = 240; ///< The total points per magnetometer static constexpr unsigned int calibraton_duration_seconds = 42; ///< The total duration the routine is allowed to take -static constexpr float MAG_MAX_OFFSET_LEN = 0.6f; ///< The maximum measurement range is ~1.4 Ga, the earth field is ~0.6 Ga, so an offset larger than ~0.8-0.6 Ga means the mag will saturate in some directions. +static constexpr float MAG_MAX_OFFSET_LEN = 0.75f; ///< The maximum measurement range is ~1.4 Ga, the earth field is ~0.6 Ga, so an offset larger than ~0.8-0.6 Ga means the mag will saturate in some directions. int32_t device_ids[max_mags]; bool internal[max_mags];