Paparazzi UAS  v6.3_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 #include "mcu_periph/uart.h"
34 
35 // Geodetic / Math
36 #include "math/pprz_algebra.h"
37 #include "math/pprz_geodetic_int.h"
40 #include "math/pprz_isa.h"
41 
42 /*
43  * Defines for the serial communication
44  */
45 #define VN_SYNC 0xFA
46 #define VN_OUTPUT_GROUP 0x39
47 #define VN_GROUP_BYTES 8
48 
49 #define VN_BUFFER_SIZE 512
50 #define VN_HEADER_SIZE 9
51 #define VN_PAYLOAD_SIZE 144
52 
53 
60 };
61 
62 struct VNPacket {
67  enum VNMsgStatus status;
76 };
77 
78 enum VNStatus {
81  VNOK
82 };
83 
84 struct VNData {
85  uint64_t nanostamp; // Timestamp [nanoseconds] since startup
86  float timestamp;
87  float ypr[3];
88  struct FloatEulers attitude;
89  struct FloatVect3 accel;
90  struct FloatRates gyro;
91  float pos_u[3];
92  float vel_u;
93  struct FloatVect3 lin_accel;
94  struct FloatEulers ypr_u;
98  struct FloatVect3 vel_body;
102  double pos_lla[3]; // Lla [deg, deg, m above elipsoid]
103  struct NedCoor_f vel_ned;
104 };
105 
106 void vn200_event(struct VNPacket *vnp);
107 void vn200_read_message(struct VNPacket *vnp, struct VNData *vndata);
108 void vn200_parse(struct VNPacket *vnp, uint8_t c);
109 
110 
111 #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.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
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:72
uint32_t hdr_error
Definition: vn200_serial.h:65
uint8_t err
see page 122 of VN-200 datasheet
Definition: vn200_serial.h:97
VNStatus
Definition: vn200_serial.h:78
@ VNOutOfSpecs
Definition: vn200_serial.h:80
@ VNNotTracking
Definition: vn200_serial.h:79
@ VNOK
Definition: vn200_serial.h:81
uint16_t overrun_error
Definition: vn200_serial.h:70
struct FloatRates gyro
Rates in the imu frame m/s.
Definition: vn200_serial.h:90
struct FloatEulers attitude
Attitude, float, [rad], yaw, pitch, roll.
Definition: vn200_serial.h:88
uint16_t datalength
Definition: vn200_serial.h:69
uint8_t msg_buf[VN_BUFFER_SIZE]
Definition: vn200_serial.h:66
uint16_t calc_chk
Definition: vn200_serial.h:73
void vn200_event(struct VNPacket *vnp)
Definition: vn200_serial.c:110
struct FloatEulers ypr_u
Attitude uncertainty, 1sigma, float, [degrees], yaw, pitch, roll.
Definition: vn200_serial.h:94
float ypr[3]
yaw, pitch, roll [deg]
Definition: vn200_serial.h:87
uint64_t tow
tow (in nanoseconds), uint64
Definition: vn200_serial.h:99
#define VN_BUFFER_SIZE
Definition: vn200_serial.h:49
struct FloatVect3 accel
Acceleration in the imu frame, m/s.
Definition: vn200_serial.h:89
uint8_t mode
0-not tracking, 1 - poor performance, 2- OK
Definition: vn200_serial.h:96
float timestamp
Time since VN startup [s].
Definition: vn200_serial.h:86
float pos_u[3]
The current GPS position uncertainty in the North East Down (NED) coordinate frame,...
Definition: vn200_serial.h:91
VNMsgStatus
Definition: vn200_serial.h:54
@ VNMsgData
Definition: vn200_serial.h:58
@ VNMsgHeader
Definition: vn200_serial.h:56
@ VNMsgCheck
Definition: vn200_serial.h:59
@ VNMsgSync
Definition: vn200_serial.h:55
@ VNMsgGroup
Definition: vn200_serial.h:57
uint16_t ins_status
see page 122 of VN-200 datasheet
Definition: vn200_serial.h:95
struct FloatVect3 vel_body
The estimated velocity in the imu frame, given in m/s.
Definition: vn200_serial.h:98
double pos_lla[3]
Definition: vn200_serial.h:102
float vel_u
NED velocity uncertainty [m/s].
Definition: vn200_serial.h:92
uint8_t gps_fix
None|2D|3D.
Definition: vn200_serial.h:101
uint8_t num_sv
number of visible satellites
Definition: vn200_serial.h:100
void vn200_read_message(struct VNPacket *vnp, struct VNData *vndata)
Read received message and populate data struct with new measurements.
Definition: vn200_serial.c:180
struct FloatVect3 lin_accel
Linear acceleration in imu frame [m/s^2].
Definition: vn200_serial.h:93
uint16_t counter
Definition: vn200_serial.h:75
uint64_t nanostamp
Definition: vn200_serial.h:85
bool msg_available
Definition: vn200_serial.h:63
struct NedCoor_f vel_ned
The estimated velocity in the North East Down (NED) frame, given in m/s.
Definition: vn200_serial.h:103
void vn200_parse(struct VNPacket *vnp, uint8_t c)
Packet Collection & state machine.
Definition: vn200_serial.c:121
uint16_t noise_error
Definition: vn200_serial.h:71
uint16_t rec_chk
Definition: vn200_serial.h:74
uint32_t chksm_error
Definition: vn200_serial.h:64
uint8_t msg_idx
Definition: vn200_serial.h:68
enum VNMsgStatus status
Definition: vn200_serial.h:67