replace geo _wrap_pi with matrix::wrap_pi

This commit is contained in:
Daniel Agar
2018-06-12 09:00:52 +02:00
committed by Lorenz Meier
parent 518daa4a8d
commit d0bde9ab2a
14 changed files with 60 additions and 313 deletions
+5 -9
View File
@@ -39,11 +39,6 @@
* @author Anton Babushkin <anton.babushkin@me.com>
*/
#include <stdio.h>
#include <errno.h>
#include <math.h>
#include <float.h>
#include "mavlink_main.h"
#include "mavlink_messages.h"
#include "mavlink_command_sender.h"
@@ -57,7 +52,6 @@
#include <mathlib/mathlib.h>
#include <matrix/math.hpp>
#include <px4_time.h>
#include <systemlib/err.h>
#include <systemlib/mavlink_log.h>
#include <uORB/topics/actuator_armed.h>
@@ -109,6 +103,8 @@
#include <uORB/topics/vehicle_magnetometer.h>
#include <uORB/uORB.h>
using matrix::wrap_2pi;
static uint16_t cm_uint16_from_m_float(float m);
static void get_mavlink_mode_state(const struct vehicle_status_s *const status, uint8_t *mavlink_state,
@@ -1082,7 +1078,7 @@ protected:
matrix::Eulerf euler = matrix::Quatf(att.q);
msg.airspeed = airspeed.indicated_airspeed_m_s;
msg.groundspeed = sqrtf(pos.vx * pos.vx + pos.vy * pos.vy);
msg.heading = _wrap_2pi(euler.psi()) * M_RAD_TO_DEG_F;
msg.heading = math::degrees(euler.psi());
if (armed.armed) {
actuator_controls_s act0 = {};
@@ -1198,7 +1194,7 @@ protected:
msg.vel_acc = gps.s_variance_m_s * 1e3f;
msg.hdg_acc = gps.c_variance_rad * 1e5f / M_DEG_TO_RAD_F;
msg.vel = cm_uint16_from_m_float(gps.vel_m_s);
msg.cog = _wrap_2pi(gps.cog_rad) * M_RAD_TO_DEG_F * 1e2f;
msg.cog = math::degrees(wrap_2pi(gps.cog_rad)) * 1e2f;
msg.satellites_visible = gps.satellites_used;
mavlink_msg_gps_raw_int_send_struct(_mavlink->get_channel(), &msg);
@@ -1795,7 +1791,7 @@ protected:
msg.vy = lpos.vy * 100.0f;
msg.vz = lpos.vz * 100.0f;
msg.hdg = _wrap_2pi(lpos.yaw) * M_RAD_TO_DEG_F * 100.0f;
msg.hdg = math::degrees(lpos.yaw) * 100.0f;
mavlink_msg_global_position_int_send_struct(_mavlink->get_channel(), &msg);