Browse Source

Fix for dynamic / static part of calibration

sbg
Lorenz Meier 11 years ago
parent
commit
4824a4e8ac
  1. 19
      src/modules/commander/airspeed_calibration.cpp

19
src/modules/commander/airspeed_calibration.cpp

@ -121,19 +121,6 @@ int do_airspeed_calibration(int mavlink_fd) @@ -121,19 +121,6 @@ int do_airspeed_calibration(int mavlink_fd)
if (poll_ret) {
orb_copy(ORB_ID(differential_pressure), diff_pres_sub, &diff_pres);
if (calc_indicated_airspeed(fabsf(diff_pres.differential_pressure_raw_pa)) < 10.0f) {
mavlink_log_critical(mavlink_fd, "Put a finger on front hole of pitot");
usleep(5000 * 1000);
continue;
}
/* do not log negative values in the second go */
if ((diff_pres_offset / calibration_counter) < calc_indicated_airspeed(-5.0f)) {
mavlink_log_critical(mavlink_fd, "Negative val: swap static<->dynamic ports,restart");
close(diff_pres_sub);
return ERROR;
}
diff_pres_offset += diff_pres.differential_pressure_raw_pa;
calibration_counter++;
@ -197,16 +184,16 @@ int do_airspeed_calibration(int mavlink_fd) @@ -197,16 +184,16 @@ int do_airspeed_calibration(int mavlink_fd)
diff_pres_offset += diff_pres.differential_pressure_raw_pa;
calibration_counter++;
float curr_avg = (diff_pres_offset / calibration_counter);
float curr_avg_airspeed = calc_indicated_airspeed(diff_pres_offset / calibration_counter);
if (calc_indicated_airspeed(fabsf(curr_avg)) < 10.0f) {
if (fabsf(curr_avg) < 10.0f) {
mavlink_log_critical(mavlink_fd, "Put a finger on front hole of pitot (%.1f m/s)", (double)curr_avg);
usleep(5000 * 1000);
continue;
}
/* do not log negative values in the second go */
if (curr_avg < -calc_indicated_airspeed(5.0f)) {
if (curr_avg_airspeed < -calc_indicated_airspeed(5.0f)) {
mavlink_log_critical(mavlink_fd, "Negative val: swap static<->dynamic ports,restart");
close(diff_pres_sub);

Loading…
Cancel
Save