From 0e78e38cda40b745ad30d7f51a5930bca3253f6b Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 27 Apr 2015 14:26:49 +0200 Subject: [PATCH] commander: Use pre-rotated topic in board frame --- src/modules/commander/calibration_routines.cpp | 14 +++++++------- src/modules/commander/commander.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/commander/calibration_routines.cpp b/src/modules/commander/calibration_routines.cpp index 7e8c0fa52e..e854c9aa7e 100644 --- a/src/modules/commander/calibration_routines.cpp +++ b/src/modules/commander/calibration_routines.cpp @@ -43,12 +43,12 @@ #include #include #include -#include #include #include #include #include +#include #include "calibration_routines.h" #include "calibration_messages.h" @@ -236,7 +236,7 @@ enum detect_orientation_return detect_orientation(int mavlink_fd, int cancel_sub { const unsigned ndim = 3; - struct accel_report sensor; + struct sensor_combined_s sensor; float accel_ema[ndim] = { 0.0f }; // exponential moving average of accel float accel_disp[3] = { 0.0f, 0.0f, 0.0f }; // max-hold dispersion of accel float ema_len = 0.5f; // EMA time constant in seconds @@ -264,7 +264,7 @@ enum detect_orientation_return detect_orientation(int mavlink_fd, int cancel_sub int poll_ret = poll(fds, 1, 1000); if (poll_ret) { - orb_copy(ORB_ID(sensor_accel), accel_sub, &sensor); + orb_copy(ORB_ID(sensor_combined), accel_sub, &sensor); t = hrt_absolute_time(); float dt = (t - t_prev) / 1000000.0f; t_prev = t; @@ -275,13 +275,13 @@ enum detect_orientation_return detect_orientation(int mavlink_fd, int cancel_sub float di = 0.0f; switch (i) { case 0: - di = sensor.x; + di = sensor.accelerometer_m_s2[0]; break; case 1: - di = sensor.y; + di = sensor.accelerometer_m_s2[1]; break; case 2: - di = sensor.z; + di = sensor.accelerometer_m_s2[2]; break; } @@ -410,7 +410,7 @@ calibrate_return calibrate_from_orientation(int mavlink_fd, // Setup subscriptions to onboard accel sensor - int sub_accel = orb_subscribe_multi(ORB_ID(sensor_accel), 0); + int sub_accel = orb_subscribe(ORB_ID(sensor_combined)); if (sub_accel < 0) { mavlink_and_console_log_critical(mavlink_fd, CAL_QGC_FAILED_MSG, "No onboard accel"); return calibrate_return_error; diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 5caf36e19a..50846ff4d0 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -1160,7 +1160,7 @@ int commander_thread_main(int argc, char *argv[]) /* initialize low priority thread */ pthread_attr_t commander_low_prio_attr; pthread_attr_init(&commander_low_prio_attr); - pthread_attr_setstacksize(&commander_low_prio_attr, 2000); + pthread_attr_setstacksize(&commander_low_prio_attr, 2600); struct sched_param param; (void)pthread_attr_getschedparam(&commander_low_prio_attr, ¶m);