Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 {
76 };
77 
78 enum VNStatus {
82 };
83 
84 struct VNData {
85  uint64_t nanostamp; // Timestamp [nanoseconds] since startup
86  float timestamp;
87  float ypr[3];
89  struct FloatVect3 accel;
90  struct FloatRates gyro;
91  float pos_u[3];
92  float vel_u;
94  struct FloatEulers ypr_u;
102  double pos_lla[3]; // Lla [deg, deg, m above elipsoid]
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 */
unsigned short uint16_t
Definition: types.h:16
uint16_t overrun_error
Definition: vn200_serial.h:70
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define VN_BUFFER_SIZE
Definition: vn200_serial.h:49
uint8_t msg_idx
Definition: vn200_serial.h:68
struct NedCoor_f vel_ned
The estimated velocity in the North East Down (NED) frame, given in m/s.
Definition: vn200_serial.h:103
uint16_t rec_chk
Definition: vn200_serial.h:74
uint32_t chksm_error
Definition: vn200_serial.h:64
uint16_t counter
Definition: vn200_serial.h:75
uint32_t hdr_error
Definition: vn200_serial.h:65
uint16_t noise_error
Definition: vn200_serial.h:71
VNMsgStatus
Definition: vn200_serial.h:54
bool msg_available
Definition: vn200_serial.h:63
uint8_t num_sv
number of visible satellites
Definition: vn200_serial.h:100
struct FloatVect3 lin_accel
Linear acceleration in imu frame [m/s^2].
Definition: vn200_serial.h:93
uint8_t gps_fix
None|2D|3D.
Definition: vn200_serial.h:101
struct FloatEulers attitude
Attitude, float, [rad], yaw, pitch, roll.
Definition: vn200_serial.h:88
euler angles
uint16_t ins_status
see page 122 of VN-200 datasheet
Definition: vn200_serial.h:95
Paparazzi floating point math for geodetic calculations.
struct FloatVect3 vel_body
The estimated velocity in the imu frame, given in m/s.
Definition: vn200_serial.h:98
float pos_u[3]
The current GPS position uncertainty in the North East Down (NED) coordinate frame, given in meters.
Definition: vn200_serial.h:91
uint64_t nanostamp
Definition: vn200_serial.h:85
struct FloatEulers ypr_u
Attitude uncertainty, 1sigma, float, [degrees], yaw, pitch, roll.
Definition: vn200_serial.h:94
unsigned long long uint64_t
Definition: types.h:20
uint8_t mode
0-not tracking, 1 - poor performance, 2- OK
Definition: vn200_serial.h:96
uint16_t calc_chk
Definition: vn200_serial.h:73
vector in North East Down coordinates Units: meters
Paparazzi floating point algebra.
void vn200_parse(struct VNPacket *vnp, uint8_t c)
Packet Collection & state machine.
Definition: vn200_serial.c:121
struct FloatVect3 accel
Acceleration in the imu frame, m/s.
Definition: vn200_serial.h:89
Paparazzi generic algebra macros.
Paparazzi atmospheric pressure conversion utilities.
unsigned long uint32_t
Definition: types.h:18
VNStatus
Definition: vn200_serial.h:78
Paparazzi fixed point math for geodetic calculations.
struct FloatRates gyro
Rates in the imu frame m/s.
Definition: vn200_serial.h:90
uint16_t datalength
Definition: vn200_serial.h:69
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
uint16_t framing_error
Definition: vn200_serial.h:72
unsigned char uint8_t
Definition: types.h:14
float ypr[3]
yaw, pitch, roll [deg]
Definition: vn200_serial.h:87
void vn200_event(struct VNPacket *vnp)
Definition: vn200_serial.c:110
float vel_u
NED velocity uncertainty [m/s].
Definition: vn200_serial.h:92
uint8_t msg_buf[VN_BUFFER_SIZE]
Definition: vn200_serial.h:66
double pos_lla[3]
Definition: vn200_serial.h:102
float timestamp
Time since VN startup [s].
Definition: vn200_serial.h:86
uint8_t err
see page 122 of VN-200 datasheet
Definition: vn200_serial.h:97
uint64_t tow
tow (in nanoseconds), uint64
Definition: vn200_serial.h:99
enum VNMsgStatus status
Definition: vn200_serial.h:67
angular rates