Browse Source

Commander: Provide better calibration errors

sbg
Lorenz Meier 9 years ago
parent
commit
0a8a75af1f
  1. 6
      src/modules/commander/mag_calibration.cpp

6
src/modules/commander/mag_calibration.cpp

@ -520,15 +520,15 @@ calibrate_return mag_calibrate_all(int mavlink_fd, int32_t (&device_ids)[max_mag
&sphere_radius[cur_mag]); &sphere_radius[cur_mag]);
if (!PX4_ISFINITE(sphere_x[cur_mag]) || !PX4_ISFINITE(sphere_y[cur_mag]) || !PX4_ISFINITE(sphere_z[cur_mag])) { if (!PX4_ISFINITE(sphere_x[cur_mag]) || !PX4_ISFINITE(sphere_y[cur_mag]) || !PX4_ISFINITE(sphere_z[cur_mag])) {
mavlink_and_console_log_critical(mavlink_fd, "[cal] ERROR: NaN in sphere fit mag, #%u", cur_mag); mavlink_and_console_log_emergency(mavlink_fd, "ERROR: Retry calibration (sphere NaN, #%u)", cur_mag);
result = calibrate_return_error; result = calibrate_return_error;
} }
if (sqrtf(sphere_x[cur_mag] * sphere_x[cur_mag] + if (sqrtf(sphere_x[cur_mag] * sphere_x[cur_mag] +
sphere_y[cur_mag] * sphere_y[cur_mag] + sphere_z[cur_mag] * sphere_z[cur_mag]) sphere_y[cur_mag] * sphere_y[cur_mag] + sphere_z[cur_mag] * sphere_z[cur_mag])
> MAG_MAX_OFFSET_LEN) { > MAG_MAX_OFFSET_LEN) {
mavlink_and_console_log_critical(mavlink_fd, "[cal] ERROR: Excessive offset mag, #%u", cur_mag); mavlink_and_console_log_emergency(mavlink_fd, "ERROR: Replace board, fault in mag #%u", cur_mag);
mavlink_and_console_log_critical(mavlink_fd, "[cal] Offsets: %8.4f,%8.4f,%8.4f", sphere_x[cur_mag], mavlink_and_console_log_emergency(mavlink_fd, "Offsets: %8.4f, %8.4f, %8.4f", sphere_x[cur_mag],
sphere_y[cur_mag], sphere_z[cur_mag]); sphere_y[cur_mag], sphere_z[cur_mag]);
result = calibrate_return_error; result = calibrate_return_error;
} }

Loading…
Cancel
Save