Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ins_vectornav.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Michal Podhradsky, michal.podhradsky@aggiemail.usu.edu
3  * Utah State University, http://aggieair.usu.edu/
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
31 
33 
34 #if PERIODIC_TELEMETRY
36 
37 static void send_ins(struct transport_tx *trans, struct link_device *dev)
38 {
39  pprz_msg_send_INS(trans, dev, AC_ID,
43 }
44 
45 static void send_ins_z(struct transport_tx *trans, struct link_device *dev)
46 {
47  pprz_msg_send_INS_Z(trans, dev, AC_ID,
49 }
50 
51 static void send_ins_ref(struct transport_tx *trans, struct link_device *dev)
52 {
53  if (ins_vn.ltp_initialized) {
54  pprz_msg_send_INS_REF(trans, dev, AC_ID,
58  }
59 }
60 
61 static void send_vn_info(struct transport_tx *trans, struct link_device *dev)
62 {
63  // we want at least 75% of periodic frequency to be able to control the airfcraft
64  if (ins_vn.vn_freq < (PERIODIC_FREQUENCY*0.75)) {
66  }
67 
68  static uint16_t last_cnt = 0;
69  static uint16_t sec_cnt = 0;
70 
71  sec_cnt = ins_vn.vn_packet.counter - last_cnt;
72  ins_vn.vn_freq = sec_cnt; // update frequency counter
73 
74  pprz_msg_send_VECTORNAV_INFO(trans, dev, AC_ID,
78  &sec_cnt,
79  &ins_vn.mode,
80  &ins_vn.err,
81  &ins_vn.ypr_u.phi,
83  &ins_vn.ypr_u.psi);
84 
85  // update counter
86  last_cnt = ins_vn.vn_packet.counter;
87 
88  // reset mode
89  ins_vn.mode = 0;
90 }
91 
92 static void send_accel(struct transport_tx *trans, struct link_device *dev)
93 {
94  pprz_msg_send_IMU_ACCEL(trans, dev, AC_ID,
96 }
97 
98 static void send_gyro(struct transport_tx *trans, struct link_device *dev)
99 {
100  pprz_msg_send_IMU_GYRO(trans, dev, AC_ID,
101  &ins_vn.gyro.p, &ins_vn.gyro.q, &ins_vn.gyro.r);
102 }
103 
104 static void send_accel_scaled(struct transport_tx *trans, struct link_device *dev)
105 {
106  pprz_msg_send_IMU_ACCEL_SCALED(trans, dev, AC_ID,
108 }
109 
110 static void send_gyro_scaled(struct transport_tx *trans, struct link_device *dev)
111 {
112  pprz_msg_send_IMU_GYRO_SCALED(trans, dev, AC_ID,
114 }
115 #endif
116 
117 #ifndef USE_INS_NAV_INIT
118 #define USE_INS_NAV_INIT TRUE
119 PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE");
120 #endif
121 
126 {
127  // receive data
129 
130  // read message
134  }
135 }
136 
137 
142 {
143  // Initialize variables
146  ins_vn.vn_freq = 0;
147 
148  // Initialize packet
157 
161 
165 
166 #if USE_INS_NAV_INIT
168  ins_vn.ltp_initialized = true;
169 #else
170  ins_vn.ltp_initialized = false;
171 #endif
172 
173  struct FloatEulers body_to_imu_eulers =
175  orientationSetEulers_f(&ins_vn.body_to_imu, &body_to_imu_eulers);
176 
177 #if PERIODIC_TELEMETRY
181  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_VECTORNAV_INFO, send_vn_info);
182  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_IMU_ACCEL, send_accel);
183  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_IMU_GYRO, send_gyro);
184  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_IMU_ACCEL_SCALED, send_accel_scaled);
185  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_IMU_GYRO_SCALED, send_gyro_scaled);
186 #endif
187 }
188 
193 {
195 
197 
198  // Timestamp [nanoseconds] since startup
199  static uint64_t nanostamp = 0;
200  memcpy(&nanostamp, &ins_vn.vn_packet.msg_buf[idx], sizeof(uint64_t));
201  idx += sizeof(uint64_t);
202 
203  // Timestamp [s]
204  ins_vn.timestamp = ((float)nanostamp / 1000000000); // [nanoseconds to seconds]
205 
206  //Attitude, float, [degrees], yaw, pitch, roll, NED frame
207  memcpy(&ins_vn.attitude, &ins_vn.vn_packet.msg_buf[idx], 3 * sizeof(float));
208  idx += 3 * sizeof(float);
209 
210  // Rates (imu frame), float, [rad/s]
211  memcpy(&ins_vn.gyro, &ins_vn.vn_packet.msg_buf[idx], 3 * sizeof(float));
212  idx += 3 * sizeof(float);
213 
214  //Pos LLA, double,[deg, deg, m]
215  //The estimated position given as latitude, longitude, and altitude given in [deg, deg, m] respectfully.
216  memcpy(&ins_vn.pos_lla, &ins_vn.vn_packet.msg_buf[idx], 3 * sizeof(double));
217  idx += 3 * sizeof(double);
218 
219  //VelNed, float [m/s]
220  //The estimated velocity in the North East Down (NED) frame, given in m/s.
221  memcpy(&ins_vn.vel_ned, &ins_vn.vn_packet.msg_buf[idx], 3 * sizeof(float));
222  idx += 3 * sizeof(float);
223 
224  // Accel (imu-frame), float, [m/s^-2]
225  memcpy(&ins_vn.accel, &ins_vn.vn_packet.msg_buf[idx], 3 * sizeof(float));
226  idx += 3 * sizeof(float);
227 
228  // tow (in nanoseconds), uint64
229  static uint64_t tow = 0;
230  memcpy(&tow, &ins_vn.vn_packet.msg_buf[idx], sizeof(uint64_t));
231  idx += sizeof(uint64_t);
232  tow = tow / 1000000; // nanoseconds to miliseconds
233  gps.tow = (uint32_t) tow;
234 
235  //num sats, uint8
237  idx++;
238 
239  //gps fix, uint8
241  idx++;
242 
243  //posU, float[3]
244  memcpy(&ins_vn.pos_u, &ins_vn.vn_packet.msg_buf[idx], 3 * sizeof(float));
245  idx += 3 * sizeof(float);
246 
247  //velU, float
248  memcpy(&ins_vn.vel_u, &ins_vn.vn_packet.msg_buf[idx], sizeof(float));
249  idx += sizeof(float);
250 
251  //linear acceleration imu-body frame, float [m/s^2]
252  //The estimated linear acceleration (without gravity) reported in m/s^2, and given in the body frame. The
253  //acceleration measurement has been bias compensated by the onboard INS filter, and the gravity
254  //component has been removed using the current gravity reference vector model. This measurement is
255  //attitude dependent, since the attitude solution is required to map the gravity reference vector (known
256  //in the inertial NED frame), into the body frame so that it can be removed from the measurement. If the
257  //device is stationary and the onboard INS filter is tracking, the measurement nominally will read 0 in all
258  //three axes.
259  memcpy(&ins_vn.lin_accel, &ins_vn.vn_packet.msg_buf[idx], 3 * sizeof(float));
260  idx += 3 * sizeof(float);
261 
262  //YprU, float[3]
263  memcpy(&ins_vn.ypr_u, &ins_vn.vn_packet.msg_buf[idx], 3 * sizeof(float));
264  idx += 3 * sizeof(float);
265 
266  //instatus, uint16
267  memcpy(&ins_vn.ins_status, &ins_vn.vn_packet.msg_buf[idx], sizeof(uint16_t));
268  idx += sizeof(uint16_t);
269 
270  //Vel body, float [m/s]
271  // The estimated velocity in the body (i.e. imu) frame, given in m/s.
272  memcpy(&ins_vn.vel_body, &ins_vn.vn_packet.msg_buf[idx], sizeof(float));
273  idx += sizeof(float);
274 
275  // Propaget the ins states
277 }
278 
283 {
284  ins_vn.mode = (uint8_t)(ins_vn.ins_status & 0x03);
285  ins_vn.err = (uint8_t)((ins_vn.ins_status >> 3) & 0x0F);
286 }
287 
293 {
294  gps.sacc = (uint32_t)(ins_vn.vel_u * 100);
295 }
296 
302 {
303  float pacc = ins_vn.pos_u[0]; // in meters
304  if (ins_vn.pos_u[1] > pacc) {
305  pacc = ins_vn.pos_u[1];
306  }
307  if (ins_vn.pos_u[2] > pacc) {
308  pacc = ins_vn.pos_u[2];
309  }
310 
311  gps.pacc = (uint32_t)(pacc * 100);
312 }
313 
321 {
322  static struct FloatEulers att_rad;
323  att_rad.phi = RadOfDeg(vn_attitude->psi);
324  att_rad.theta = RadOfDeg(vn_attitude->theta);
325  att_rad.psi = RadOfDeg(vn_attitude->phi);
326 
327  vn_attitude->phi = att_rad.phi;
328  vn_attitude->theta = att_rad.theta;
329  vn_attitude->psi = att_rad.psi;
330 }
331 
337 {
338  // Acceleration [m/s^2]
339  // in fixed point for sending as ABI and telemetry msgs
341 
342  // Rates [rad/s]
343  static struct FloatRates body_rate;
344  // in fixed point for sending as ABI and telemetry msgs
346  float_rmat_ratemult(&body_rate, orientationGetRMat_f(&ins_vn.body_to_imu), &ins_vn.gyro); // compute body rates
347  stateSetBodyRates_f(&body_rate); // Set state [rad/s]
348 
349  // Attitude [deg]
350  ins_vectornav_yaw_pitch_roll_to_attitude(&ins_vn.attitude); // convert to correct units and axis [rad]
351  static struct FloatQuat imu_quat; // convert from euler to quat
352  float_quat_of_eulers(&imu_quat, &ins_vn.attitude);
353  static struct FloatRMat imu_rmat; // convert from quat to rmat
354  float_rmat_of_quat(&imu_rmat, &imu_quat);
355  static struct FloatRMat ltp_to_body_rmat; // rotate to body frame
356  float_rmat_comp(&ltp_to_body_rmat, &imu_rmat, orientationGetRMat_f(&ins_vn.body_to_imu));
357  stateSetNedToBodyRMat_f(&ltp_to_body_rmat); // set body states [rad]
358 
359  // NED (LTP) velocity [m/s]
360  // North east down (NED), also known as local tangent plane (LTP),
361  // is a geographical coordinate system for representing state vectors that is commonly used in aviation.
362  // It consists of three numbers: one represents the position along the northern axis,
363  // one along the eastern axis, and one represents vertical position. Down is chosen as opposed to
364  // up in order to comply with the right-hand rule.
365  // The origin of this coordinate system is usually chosen to be the aircraft's center of gravity.
366  // x = North
367  // y = East
368  // z = Down
369  stateSetSpeedNed_f(&ins_vn.vel_ned); // set state
370 
371  // NED (LTP) acceleration [m/s^2]
372  static struct FloatVect3 accel_meas_ltp;// first we need to rotate linear acceleration from imu-frame to body-frame
374  static struct NedCoor_f ltp_accel; // assign to NedCoord_f struct
375  VECT3_ASSIGN(ltp_accel, accel_meas_ltp.x, accel_meas_ltp.y, accel_meas_ltp.z);
376  stateSetAccelNed_f(&ltp_accel); // then set the states
377  ins_vn.ltp_accel_f = ltp_accel;
378 
379  // LLA position [rad, rad, m]
380  //static struct LlaCoor_f lla_pos; // convert from deg to rad, and from double to float
381  ins_vn.lla_pos.lat = RadOfDeg((float)ins_vn.pos_lla[0]); // ins_impl.pos_lla[0] = lat
382  ins_vn.lla_pos.lon = RadOfDeg((float)ins_vn.pos_lla[1]); // ins_impl.pos_lla[1] = lon
383  ins_vn.lla_pos.alt = ((float)ins_vn.pos_lla[2]); // ins_impl.pos_lla[2] = alt
387 
388  // ECEF position
389  struct LtpDef_f def;
391  struct EcefCoor_f ecef_vel;
392  ecef_of_ned_point_f(&ecef_vel, &def, &ins_vn.vel_ned);
393  ECEF_BFP_OF_REAL(gps.ecef_vel, ecef_vel);
395 
396  // ECEF velocity
401 
402  // GPS Ground speed
403  float speed = sqrt(ins_vn.vel_ned.x * ins_vn.vel_ned.x + ins_vn.vel_ned.y * ins_vn.vel_ned.y);
404  gps.gspeed = ((uint16_t)(speed * 100));
405 
406  // GPS course
407  gps.course = (int32_t)(1e7 * (atan2(ins_vn.vel_ned.y, ins_vn.vel_ned.x)));
409 
410  // Because we have not HMSL data from Vectornav, we are using LLA-Altitude
411  // as a workaround
413  gps.hmsl = (int32_t)((ins_vn.lla_pos.alt - geoid_h)* 1000.0f);
415 
416  // set position uncertainty
418 
419  // set velocity uncertainty
421 
422  // check GPS status
425  if (gps.fix == GPS_FIX_3D) {
428  }
429 
430  // read INS status
432 
433  // update internal states for telemetry purposes
434  // TODO: directly convert vectornav output instead of using state interface
435  // to support multiple INS running at the same time
439 
440  // send ABI messages
441  uint32_t now_ts = get_sys_time_usec();
442  AbiSendMsgGPS(GPS_UBX_ID, now_ts, &gps);
443  AbiSendMsgIMU_GYRO_INT32(IMU_ASPIRIN_ID, now_ts, &ins_vn.gyro_i);
444  AbiSendMsgIMU_ACCEL_INT32(IMU_ASPIRIN_ID, now_ts, &ins_vn.accel_i);
445 }
double pos_lla[3]
Definition: ins_vectornav.h:93
unsigned short uint16_t
Definition: types.h:16
struct NedCoor_f ltp_accel_f
Definition: ins_vectornav.h:75
#define VN_HEADER_SIZE
Definition: vn200_serial.h:43
int32_t z
in centimeters
#define RATES_BFP_OF_REAL(_ri, _rf)
Definition: pprz_algebra.h:698
static void stateSetNedToBodyRMat_f(struct FloatRMat *ned_to_body_rmat)
Set vehicle body attitude from rotation matrix (float).
Definition: state.h:1081
uint16_t overrun_error
Definition: vn200_serial.h:63
#define ECEF_BFP_OF_REAL(_o, _i)
void float_quat_of_eulers(struct FloatQuat *q, struct FloatEulers *e)
Quaternion from Euler angles.
static uint32_t idx
void ins_vectornav_propagate()
Propagate the received states into the vehicle state machine.
static float wgs84_ellipsoid_to_geoid_f(float lat, float lon)
Get WGS84 ellipsoid/geoid separation.
definition of the local (flat earth) coordinate system
float y
in meters
uint8_t msg_idx
Definition: vn200_serial.h:61
float phi
in radians
uint32_t pacc
position accuracy in cm
Definition: gps.h:94
static void send_ins_z(struct transport_tx *trans, struct link_device *dev)
Definition: ins_vectornav.c:45
struct VNPacket vn_packet
Packet struct.
Definition: ins_vectornav.h:82
uint8_t err
see page 122 of VN-200 datasheet
void ins_vectornav_set_sacc(void)
Set speed (velocity) uncertainty (NED) speed accuracy in cm/s.
#define INS_VN_BODY_TO_IMU_PSI
Definition: ins_vectornav.h:59
struct NedCoor_i ltp_accel_i
Definition: ins_vectornav.h:71
static struct EcefCoor_i * stateGetPositionEcef_i(void)
Get position in ECEF coordinates (int).
Definition: state.h:650
Periodic telemetry system header (includes downlink utility and generated code).
uint32_t chksm_error
Definition: vn200_serial.h:57
vector in EarthCenteredEarthFixed coordinates
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
Definition: gps.h:82
int32_t y
in centimeters
void ecef_of_ned_point_f(struct EcefCoor_f *ecef, struct LtpDef_f *def, struct NedCoor_f *ned)
uint16_t counter
Definition: vn200_serial.h:68
struct FloatEulers ypr_u
Attitude uncertainty, 1sigma, float, [degrees], yaw, pitch, roll.
static struct FloatRMat * orientationGetRMat_f(struct OrientationReps *orientation)
Get vehicle body attitude rotation matrix (float).
float r
in rad/s
#define INT32_VECT3_ZERO(_v)
#define VECT3_ASSIGN(_a, _x, _y, _z)
Definition: pprz_algebra.h:124
#define GPS_UBX_ID
enum VNStatus vn_status
VN status.
Definition: ins_vectornav.h:83
uint32_t hdr_error
Definition: vn200_serial.h:58
float psi
in radians
struct FloatVect3 lin_accel
Linear acceleration in imu frame [m/s^2].
uint16_t noise_error
Definition: vn200_serial.h:64
bool msg_available
Definition: vn200_serial.h:56
#define INS_VN_BODY_TO_IMU_THETA
Definition: ins_vectornav.h:58
struct FloatEulers attitude
Attitude, float, [degrees], yaw, pitch, roll.
Definition: ins_vectornav.h:91
#define GPS_FIX_3D
3D GPS fix
Definition: gps.h:39
float q
in rad/s
float p
in rad/s
Vectornav VN-200 INS subsystem.
#define IMU_ASPIRIN_ID
int32_t z
Down.
static float get_sys_time_float(void)
Get the time in seconds since startup.
Definition: sys_time.h:129
void vn200_event(struct VNPacket *vnp)
Definition: vn200_serial.c:77
struct EcefCoor_i ecef
Reference point in ecef.
int32_t hmsl
Height above mean sea level in mm.
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
Definition: gps.h:106
struct FloatRates gyro
Rates in the imu frame m/s.
int32_t alt
in millimeters above WGS84 reference ellipsoid
WGS-84 Geoid Heights.
euler angles
#define ACCELS_BFP_OF_REAL(_ef, _ei)
Definition: pprz_algebra.h:734
uint32_t sacc
speed accuracy in cm/s
Definition: gps.h:95
Roation quaternion.
int32_t y
East.
uint32_t last_msg_time
cpu time in sec at last received GPS message
Definition: gps.h:109
#define GPS_VALID_COURSE_BIT
Definition: gps.h:54
float theta
in radians
int32_t r
in rad/s with INT32_RATE_FRAC
static struct NedCoor_i * stateGetSpeedNed_i(void)
Get ground speed in local NED coordinates (int).
Definition: state.h:851
#define FLOAT_VECT3_ZERO(_v)
static void stateSetSpeedNed_f(struct NedCoor_f *ned_speed)
Set ground speed in local NED coordinates (float).
Definition: state.h:803
void float_rmat_comp(struct FloatRMat *m_a2c, struct FloatRMat *m_a2b, struct FloatRMat *m_b2c)
Composition (multiplication) of two rotation matrices.
unsigned long long uint64_t
Definition: types.h:20
int32_t hmsl
height above mean sea level (MSL) in mm
Definition: gps.h:88
void float_rmat_transp_vmult(struct FloatVect3 *vb, struct FloatRMat *m_b2a, struct FloatVect3 *va)
rotate 3D vector by transposed rotation matrix.
vector in North East Down coordinates Units: meters
uint8_t mode
0-not tracking, 1 - poor performance, 2- OK
uint32_t tow
GPS time of week in ms.
Definition: gps.h:101
void float_rmat_of_quat(struct FloatRMat *rm, struct FloatQuat *q)
#define GPS_FIX_NONE
No GPS fix.
Definition: gps.h:37
static void stateSetPositionLla_i(struct LlaCoor_i *lla_pos)
Set position from LLA coordinates (int).
Definition: state.h:541
struct FloatVect3 accel
Acceleration in the imu frame, m/s.
float pos_u[3]
The current GPS position uncertainty in the North East Down (NED) coordinate frame, given in meters.
Definition: ins_vectornav.h:98
void ins_vectornav_yaw_pitch_roll_to_attitude(struct FloatEulers *vn_attitude)
Convert yaw, pitch, and roll data from VectorNav to correct attitude yaw(0), pitch(1), roll(2) -> phi, theta, psi [deg] -> rad.
int32_t x
North.
unsigned long uint32_t
Definition: types.h:18
struct EcefCoor_i ecef_pos
position in ECEF in cm
Definition: gps.h:85
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
struct LtpDef_i ltp_def
Definition: ins_vectornav.h:65
struct Int32Rates gyro_i
#define GPS_VALID_HMSL_BIT
Definition: gps.h:53
struct LlaCoor_i lla
Reference point in lla.
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
int32_t lon
in degrees*1e7
void ins_init_origin_i_from_flightplan(struct LtpDef_i *ltp_def)
initialize the local origin (ltp_def in fixed point) from flight plan position
Definition: ins.c:39
struct LlaCoor_f lla_pos
Definition: ins_vectornav.h:73
float baro_z
z-position calculated from baro in meters (z-down)
Definition: ins_vectornav.h:78
float vel_u
NED velocity uncertainty [m/s].
Definition: ins_vectornav.h:99
static void send_gyro_scaled(struct transport_tx *trans, struct link_device *dev)
void ins_vectornav_set_pacc(void)
Find maximum uncertainty (NED) position accuracy in cm.
void ins_vectornav_read_message(void)
Read received data.
bool ltp_initialized
Definition: ins_vectornav.h:66
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
Definition: sys_time.h:73
static void send_ins_ref(struct transport_tx *trans, struct link_device *dev)
Definition: ins_vectornav.c:51
signed long int32_t
Definition: types.h:19
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:73
float alt
in meters (normally above WGS84 reference ellipsoid)
void ltp_def_from_lla_f(struct LtpDef_f *def, struct LlaCoor_f *lla)
static void send_accel_scaled(struct transport_tx *trans, struct link_device *dev)
uint16_t framing_error
Definition: vn200_serial.h:65
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
Definition: gps.h:107
struct InsVectornav ins_vn
Definition: ins_vectornav.c:32
unsigned char uint8_t
Definition: types.h:14
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
Definition: gps.h:93
struct Int32Vect3 accel_i
struct NedCoor_i ltp_speed_i
Definition: ins_vectornav.h:70
struct OrientationReps body_to_imu
body_to_imu rotation
volatile uint32_t nb_sec
full seconds since startup
Definition: sys_time.h:72
uint8_t msg_buf[VN_BUFFER_SIZE]
Definition: vn200_serial.h:59
#define GPS_VALID_POS_ECEF_BIT
Definition: gps.h:48
#define LLA_BFP_OF_REAL(_o, _i)
uint16_t ins_status
see page 122 of VN-200 datasheet
int32_t p
in rad/s with INT32_RATE_FRAC
float lon
in radians
static void send_accel(struct transport_tx *trans, struct link_device *dev)
Definition: ins_vectornav.c:92
struct NedCoor_i ltp_pos_i
Definition: ins_vectornav.h:69
rotation matrix
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
Definition: gps.h:108
#define INS_VN_BODY_TO_IMU_PHI
Definition: ins_vectornav.h:57
#define GPS_VALID_POS_LLA_BIT
Definition: gps.h:49
uint8_t num_sv
number of sat in fix
Definition: gps.h:98
int32_t x
in centimeters
uint16_t gspeed
norm of 2d ground speed in cm/s
Definition: gps.h:91
float vn_freq
data frequency
Definition: ins_vectornav.h:84
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
Definition: gps.h:89
float lat
in radians
#define GPS_VALID_VEL_ECEF_BIT
Definition: gps.h:51
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
Definition: gps.h:86
void float_rmat_ratemult(struct FloatRates *rb, struct FloatRMat *m_a2b, struct FloatRates *ra)
rotate anglular rates by rotation matrix.
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
Definition: state.h:659
static void send_vn_info(struct transport_tx *trans, struct link_device *dev)
Definition: ins_vectornav.c:61
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Definition: sys_time_arch.c:68
int32_t lat
in degrees*1e7
static void stateSetBodyRates_f(struct FloatRates *body_rate)
Set vehicle body angular rate (float).
Definition: state.h:1163
uint8_t fix
status of fix
Definition: gps.h:99
struct FloatVect3 vel_body
The estimated velocity in the imu frame, given in m/s.
enum VNMsgStatus status
Definition: vn200_serial.h:60
void ins_vectornav_event(void)
Event handling for Vectornav.
static void stateSetAccelNed_f(struct NedCoor_f *ned_accel)
Set acceleration in NED coordinates (float).
Definition: state.h:984
int32_t q
in rad/s with INT32_RATE_FRAC
static void send_gyro(struct transport_tx *trans, struct link_device *dev)
Definition: ins_vectornav.c:98
struct NedCoor_f vel_ned
The estimated velocity in the North East Down (NED) frame, given in m/s.
Definition: ins_vectornav.h:94
uint32_t vn_time
VN time stamp.
Definition: ins_vectornav.h:86
struct GpsState gps
global GPS state
Definition: gps.c:75
angular rates
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:46
static void send_ins(struct transport_tx *trans, struct link_device *dev)
Definition: ins_vectornav.c:37
float timestamp
System time [s].
Definition: ins_vectornav.h:90
static struct NedCoor_i * stateGetAccelNed_i(void)
Get acceleration in NED coordinates (int).
Definition: state.h:1002
float x
in meters
void ins_vectornav_init(void)
Initialize Vectornav struct.
void ins_vectornav_check_status(void)
Check INS status.
static void orientationSetEulers_f(struct OrientationReps *orientation, struct FloatEulers *eulers)
Set vehicle body attitude from euler angles (float).