aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander/accelerometer_calibration.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-08-27 10:15:17 +0200
committerLorenz Meier <lm@inf.ethz.ch>2013-08-27 10:15:17 +0200
commit665a23259269d870e958543c6e6517323793c1dc (patch)
treefb545798598ccfa9371c04aa65b3342429164854 /src/modules/commander/accelerometer_calibration.cpp
parent94d8ec4a1c1f052a50f4871db7445fb6454057d3 (diff)
downloadpx4-firmware-665a23259269d870e958543c6e6517323793c1dc.tar.gz
px4-firmware-665a23259269d870e958543c6e6517323793c1dc.tar.bz2
px4-firmware-665a23259269d870e958543c6e6517323793c1dc.zip
More calibration polishing
Diffstat (limited to 'src/modules/commander/accelerometer_calibration.cpp')
-rw-r--r--src/modules/commander/accelerometer_calibration.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/modules/commander/accelerometer_calibration.cpp b/src/modules/commander/accelerometer_calibration.cpp
index e1616acd0..30ac07e33 100644
--- a/src/modules/commander/accelerometer_calibration.cpp
+++ b/src/modules/commander/accelerometer_calibration.cpp
@@ -217,20 +217,23 @@ int do_accel_calibration_measurements(int mavlink_fd, float accel_offs[3], float
while (true) {
bool done = true;
- char str[60];
- int str_ptr;
- str_ptr = sprintf(str, "keep the vehicle still in one of these axes:");
unsigned old_done_count = done_count;
done_count = 0;
+
for (int i = 0; i < 6; i++) {
if (!data_collected[i]) {
- str_ptr += sprintf(&(str[str_ptr]), " %s", orientation_strs[i]);
done = false;
- } else {
- done_count++;
}
}
+ mavlink_log_info(mavlink_fd, "directions left: %s%s%s%s%s%s",
+ (!data_collected[0]) ? "x+ " : "",
+ (!data_collected[0]) ? "x- " : "",
+ (!data_collected[0]) ? "y+ " : "",
+ (!data_collected[0]) ? "y- " : "",
+ (!data_collected[0]) ? "z+ " : "",
+ (!data_collected[0]) ? "z- " : "");
+
if (old_done_count != done_count)
mavlink_log_info(mavlink_fd, "accel cal progress <%u> percent", 17 * done_count);
@@ -242,19 +245,17 @@ int do_accel_calibration_measurements(int mavlink_fd, float accel_offs[3], float
return ERROR;
if (data_collected[orient]) {
- sprintf(str, "%s done, please rotate to a different axis", orientation_strs[orient]);
- mavlink_log_info(mavlink_fd, str);
+ mavlink_log_info(mavlink_fd, "%s done, please rotate to a different axis", orientation_strs[orient]);
continue;
}
- // sprintf(str,
mavlink_log_info(mavlink_fd, "accel measurement started: %s axis", orientation_strs[orient]);
read_accelerometer_avg(sensor_combined_sub, &(accel_ref[orient][0]), samples_num);
- str_ptr = sprintf(str, "result for %s axis: [ %.2f %.2f %.2f ]", orientation_strs[orient],
+ mavlink_log_info(mavlink_fd, "result for %s axis: [ %.2f %.2f %.2f ]", orientation_strs[orient],
(double)accel_ref[orient][0],
(double)accel_ref[orient][1],
(double)accel_ref[orient][2]);
- mavlink_log_info(mavlink_fd, str);
+
data_collected[orient] = true;
tune_neutral();
}