Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
vn200_serial.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 VN200_SERIAl_H
30 #define VN200_SERIAl_H
31 
32 #include "std.h"
33 
34 // Geodetic / Math
35 #include "math/pprz_algebra.h"
36 #include "math/pprz_geodetic_int.h"
39 #include "math/pprz_isa.h"
40 
41 /*
42  * Defines for the serial communication
43  */
44 #define VN_SYNC 0xFA
45 #define VN_OUTPUT_GROUP 0x39
46 #define VN_GROUP_BYTES 8
47 
48 #define VN_BUFFER_SIZE 512
49 #define VN_HEADER_SIZE 9
50 #define VN_PAYLOAD_SIZE 144
51 
52 
59 };
60 
61 struct VNPacket {
66  enum VNMsgStatus status;
75 };
76 
77 enum VNStatus {
80  VNOK
81 };
82 
83 struct VNData {
84  uint64_t nanostamp; // Timestamp [nanoseconds] since startup
85  float timestamp;
86  float ypr[3];
87  struct FloatEulers attitude;
88  struct FloatVect3 accel;
89  struct FloatRates gyro;
90  float pos_u[3];
91  float vel_u;
92  struct FloatVect3 lin_accel;
93  struct FloatEulers ypr_u;
97  struct FloatVect3 vel_body;
101  double pos_lla[3]; // Lla [deg, deg, m above elipsoid]
102  struct NedCoor_f vel_ned;
103 };
104 
105 void vn200_event(struct VNPacket *vnp);
106 void vn200_read_message(struct VNPacket *vnp, struct VNData *vndata);
107 void vn200_parse(struct VNPacket *vnp, uint8_t c);
108 
109 
110 #endif /* VN200_SERIAl_H */
euler angles
angular rates
Paparazzi generic algebra macros.
Paparazzi floating point algebra.
Paparazzi floating point math for geodetic calculations.
vector in North East Down coordinates Units: meters
Paparazzi fixed point math for geodetic calculations.
Paparazzi atmospheric pressure conversion utilities.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
unsigned long long uint64_t
Definition: vl53l1_types.h:72
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
uint16_t framing_error
Definition: vn200_serial.h:71
uint32_t hdr_error
Definition: vn200_serial.h:64
uint8_t err
see page 122 of VN-200 datasheet
Definition: vn200_serial.h:96
VNStatus
Definition: vn200_serial.h:77
@ VNOutOfSpecs
Definition: vn200_serial.h:79
@ VNNotTracking
Definition: vn200_serial.h:78
@ VNOK
Definition: vn200_serial.h:80
uint16_t overrun_error
Definition: vn200_serial.h:69
struct FloatRates gyro
Rates in the imu frame m/s.
Definition: vn200_serial.h:89
struct FloatEulers attitude
Attitude, float, [rad], yaw, pitch, roll.
Definition: vn200_serial.h:87
uint16_t datalength
Definition: vn200_serial.h:68
uint8_t msg_buf[VN_BUFFER_SIZE]
Definition: vn200_serial.h:65
uint16_t calc_chk
Definition: vn200_serial.h:72
void vn200_event(struct VNPacket *vnp)
Definition: vn200_serial.c:113
struct FloatEulers ypr_u
Attitude uncertainty, 1sigma, float, [degrees], yaw, pitch, roll.
Definition: vn200_serial.h:93
float ypr[3]
yaw, pitch, roll [deg]
Definition: vn200_serial.h:86
uint64_t tow
tow (in nanoseconds), uint64
Definition: vn200_serial.h:98
#define VN_BUFFER_SIZE
Definition: vn200_serial.h:48
struct FloatVect3 accel
Acceleration in the imu frame, m/s.
Definition: vn200_serial.h:88
uint8_t mode
0-not tracking, 1 - poor performance, 2- OK
Definition: vn200_serial.h:95
float timestamp
Time since VN startup [s].
Definition: vn200_serial.h:85
float pos_u[3]
The current GPS position uncertainty in the North East Down (NED) coordinate frame,...
Definition: vn200_serial.h:90
VNMsgStatus
Definition: vn200_serial.h:53
@ VNMsgData
Definition: vn200_serial.h:57
@ VNMsgHeader
Definition: vn200_serial.h:55
@ VNMsgCheck
Definition: vn200_serial.h:58
@ VNMsgSync
Definition: vn200_serial.h:54
@ VNMsgGroup
Definition: vn200_serial.h:56
uint16_t ins_status
see page 122 of VN-200 datasheet
Definition: vn200_serial.h:94
struct FloatVect3 vel_body
The estimated velocity in the imu frame, given in m/s.
Definition: vn200_serial.h:97
double pos_lla[3]
Definition: vn200_serial.h:101
float vel_u
NED velocity uncertainty [m/s].
Definition: vn200_serial.h:91
uint8_t gps_fix
None|2D|3D.
Definition: vn200_serial.h:100
uint8_t num_sv
number of visible satellites
Definition: vn200_serial.h:99
void vn200_read_message(struct VNPacket *vnp, struct VNData *vndata)
Read received message and populate data struct with new measurements.
Definition: vn200_serial.c:184
struct FloatVect3 lin_accel
Linear acceleration in imu frame [m/s^2].
Definition: vn200_serial.h:92
uint16_t counter
Definition: vn200_serial.h:74
uint64_t nanostamp
Definition: vn200_serial.h:84
bool msg_available
Definition: vn200_serial.h:62
struct NedCoor_f vel_ned
The estimated velocity in the North East Down (NED) frame, given in m/s.
Definition: vn200_serial.h:102
void vn200_parse(struct VNPacket *vnp, uint8_t c)
Packet Collection & state machine.
Definition: vn200_serial.c:125
uint16_t noise_error
Definition: vn200_serial.h:70
uint16_t rec_chk
Definition: vn200_serial.h:73
uint32_t chksm_error
Definition: vn200_serial.h:63
uint8_t msg_idx
Definition: vn200_serial.h:67
enum VNMsgStatus status
Definition: vn200_serial.h:66