Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ins_vectornav.h
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  */
29 #ifndef INS_VECTORNAV_H
30 #define INS_VECTORNAV_H
31 
32 // Subsystems
33 #include "subsystems/gps.h"
34 #include "subsystems/ins.h"
35 
36 // Peripheral
38 
39 // Geodetic / Math
40 #include "math/pprz_algebra.h"
41 #include "math/pprz_geodetic_int.h"
43 #include "math/pprz_geodetic_int.h"
44 #include "math/pprz_isa.h"
45 
46 // Generated
47 #include "generated/airframe.h"
48 #include "generated/flight_plan.h"
49 
50 // Systime
51 #include "mcu_periph/sys_time.h"
52 
53 // Abi
54 #include "subsystems/abi.h"
55 
56 #if GPS_USE_LATLONG
57 /* currently needed to get nav_utm_zone0 */
60 #endif
61 
62 
63 #if !defined INS_VN_BODY_TO_IMU_PHI && !defined INS_VN_BODY_TO_IMU_THETA && !defined INS_VN_BODY_TO_IMU_PSI
64 #define INS_VN_BODY_TO_IMU_PHI 0
65 #define INS_VN_BODY_TO_IMU_THETA 0
66 #define INS_VN_BODY_TO_IMU_PSI 0
67 #endif
68 
69 
70 // Ins implementation state (fixed point)
71 struct InsVectornav {
72  struct LtpDef_i ltp_def; // initial position
73  bool_t ltp_initialized; // status indicator
74 
75  // output LTP NED for telemetry messages
79 
81 
83 
84  // baro [height above ground]
85  float baro_z;
86  float qfe;
87 
88  // Packet data
91  float vn_freq;
95 
96  // Auxilliary data fields
97  float timestamp;
99  // rates -> imu
100  double pos_lla[3]; // Lla [deg, deg, m above elipsoid]
102  // accel -> imu
103  // num sats -> GPS
104  // GPS fix -> GPS
105  float pos_u[3];
106  float vel_u;
113  struct FloatVect3 accel;
114  struct FloatRates gyro;
115 
116  // in fixed point for sending as ABI and telemetry msgs
119 
122 };
123 
124 
125 // global INS state
126 extern struct InsVectornav ins_vn;
127 
128 extern void ins_vectornav_init(void);
129 extern void ins_vectornav_event(void);
130 
131 extern void ins_vectornav_read_message(void);
132 extern void ins_vectornav_check_status(void);
133 extern void ins_vectornav_set_sacc(void);
134 extern void ins_vectornav_set_pacc(void);
135 extern void ins_vectornav_propagate(void);
136 extern void ins_vectornav_yaw_pitch_roll_to_attitude(struct FloatEulers *vn_attitude);
137 extern void ins_init_origin_from_flightplan(void);
138 
139 #endif /* INS_VECTORNAV_H */
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.
double pos_lla[3]
unsigned short uint16_t
Definition: types.h:16
struct NedCoor_f ltp_accel_f
Definition: ins_vectornav.h:82
angular rates
definition of the local (flat earth) coordinate system
void ins_vectornav_read_message(void)
Read received data.
struct VNPacket vn_packet
Packet struct.
Definition: ins_vectornav.h:89
uint8_t err
see page 122 of VN-200 datasheet
struct NedCoor_i ltp_accel_i
Definition: ins_vectornav.h:78
void ins_vectornav_check_status(void)
Check INS status.
uint32_t vn_ltime
aux time stamp
Definition: ins_vectornav.h:94
struct FloatEulers ypr_u
Attitude uncertainty, 1sigma, float, [degrees], yaw, pitch, roll.
Main include for ABI (AirBorneInterface).
enum VNStatus vn_status
VN status.
Definition: ins_vectornav.h:90
void ins_init_origin_from_flightplan(void)
initialize the local origin (ltp_def) from flight plan position
struct FloatVect3 lin_accel
Linear acceleration in imu frame [m/s^2].
Integrated Navigation System interface.
uint16_t vn_chksm
aux variable for checksum
Definition: ins_vectornav.h:92
struct FloatEulers attitude
Attitude, float, [degrees], yaw, pitch, roll.
Definition: ins_vectornav.h:98
struct FloatRates gyro
Rates in the imu frame m/s.
euler angles
Paparazzi floating point math for geodetic calculations.
vector in Latitude, Longitude and Altitude
void ins_vectornav_event(void)
Event handling for Vectornav.
vector in North East Down coordinates Units: meters
Paparazzi floating point algebra.
Architecture independent timing functions.
uint8_t mode
0-not tracking, 1 - poor performance, 2- OK
void ins_vectornav_init(void)
Initialize Vectornav struct.
Vectornav VN-200 INS subsystem.
struct FloatVect3 accel
Acceleration in the imu frame, m/s.
Paparazzi generic algebra macros.
float pos_u[3]
The current GPS position uncertainty in the North East Down (NED) coordinate frame, given in meters.
Device independent GPS code (interface)
Paparazzi atmospheric pressure conversion utilities.
unsigned long uint32_t
Definition: types.h:18
struct LtpDef_i ltp_def
Definition: ins_vectornav.h:72
struct Int32Rates gyro_i
struct LlaCoor_f lla_pos
Definition: ins_vectornav.h:80
VNStatus
Definition: vn200_serial.h:71
float baro_z
z-position calculated from baro in meters (z-down)
Definition: ins_vectornav.h:85
float vel_u
NED velocity uncertainty [m/s].
Paparazzi fixed point math for geodetic calculations.
void ins_vectornav_set_sacc(void)
Set speed (velocity) uncertainty (NED) speed accuracy in cm/s.
bool_t ltp_initialized
Definition: ins_vectornav.h:73
void ins_vectornav_propagate(void)
Propagate the received states into the vehicle state machine.
unsigned char uint8_t
Definition: types.h:14
struct Int32Vect3 accel_i
vector in North East Down coordinates
struct NedCoor_i ltp_speed_i
Definition: ins_vectornav.h:77
struct OrientationReps body_to_imu
body_to_imu rotation
void ins_vectornav_set_pacc(void)
Find maximum uncertainty (NED) position accuracy in cm.
struct InsVectornav ins_vn
Definition: ins_vectornav.c:31
uint16_t ins_status
see page 122 of VN-200 datasheet
struct NedCoor_i ltp_pos_i
Definition: ins_vectornav.h:76
float vn_freq
data frequency
Definition: ins_vectornav.h:91
struct FloatVect3 vel_body
The estimated velocity in the imu frame, given in m/s.
struct NedCoor_f vel_ned
The estimated velocity in the North East Down (NED) frame, given in m/s.
uint32_t vn_time
VN time stamp.
Definition: ins_vectornav.h:93
angular rates
float timestamp
System time [s].
Definition: ins_vectornav.h:97