Browse Source

Harden calibration experience on master

sbg
Lorenz Meier 9 years ago
parent
commit
224aaeddfe
  1. 12
      src/modules/commander/calibration_routines.cpp
  2. 2
      src/modules/commander/mag_calibration.cpp

12
src/modules/commander/calibration_routines.cpp

@ -457,13 +457,15 @@ calibrate_return calibrate_from_orientation(orb_advert_t *mavlink_log_pub, @@ -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, @@ -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, @@ -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;

2
src/modules/commander/mag_calibration.cpp

@ -73,7 +73,7 @@ static constexpr unsigned int calibration_sides = 6; ///< The total number of @@ -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];

Loading…
Cancel
Save