Paparazzi UAS  v6.2_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 {
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 */
VN_BUFFER_SIZE
#define VN_BUFFER_SIZE
Definition: vn200_serial.h:49
uint32_t
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
NedCoor_f
vector in North East Down coordinates Units: meters
Definition: pprz_geodetic_float.h:63
VNMsgGroup
@ VNMsgGroup
Definition: vn200_serial.h:57
VNPacket::chksm_error
uint32_t chksm_error
Definition: vn200_serial.h:64
VNNotTracking
@ VNNotTracking
Definition: vn200_serial.h:79
VNPacket::overrun_error
uint16_t overrun_error
Definition: vn200_serial.h:70
uint64_t
unsigned long long uint64_t
Definition: vl53l1_types.h:72
VNPacket::counter
uint16_t counter
Definition: vn200_serial.h:75
VNPacket::rec_chk
uint16_t rec_chk
Definition: vn200_serial.h:74
VNPacket::msg_idx
uint8_t msg_idx
Definition: vn200_serial.h:68
VNData::vel_ned
struct NedCoor_f vel_ned
The estimated velocity in the North East Down (NED) frame, given in m/s.
Definition: vn200_serial.h:103
VNPacket::msg_available
bool msg_available
Definition: vn200_serial.h:63
pprz_geodetic_int.h
Paparazzi fixed point math for geodetic calculations.
VNMsgStatus
VNMsgStatus
Definition: vn200_serial.h:54
VNPacket::hdr_error
uint32_t hdr_error
Definition: vn200_serial.h:65
VNMsgSync
@ VNMsgSync
Definition: vn200_serial.h:55
VNMsgCheck
@ VNMsgCheck
Definition: vn200_serial.h:59
VNData::gps_fix
uint8_t gps_fix
None|2D|3D.
Definition: vn200_serial.h:101
VNPacket::noise_error
uint16_t noise_error
Definition: vn200_serial.h:71
pprz_algebra_float.h
Paparazzi floating point algebra.
VNData::attitude
struct FloatEulers attitude
Attitude, float, [rad], yaw, pitch, roll.
Definition: vn200_serial.h:88
VNData::ins_status
uint16_t ins_status
see page 122 of VN-200 datasheet
Definition: vn200_serial.h:95
VNPacket
Definition: vn200_serial.h:62
VNData::lin_accel
struct FloatVect3 lin_accel
Linear acceleration in imu frame [m/s^2].
Definition: vn200_serial.h:93
VNData::num_sv
uint8_t num_sv
number of visible satellites
Definition: vn200_serial.h:100
VNData::ypr_u
struct FloatEulers ypr_u
Attitude uncertainty, 1sigma, float, [degrees], yaw, pitch, roll.
Definition: vn200_serial.h:94
FloatVect3
Definition: pprz_algebra_float.h:54
std.h
pprz_geodetic_float.h
Paparazzi floating point math for geodetic calculations.
VNData::accel
struct FloatVect3 accel
Acceleration in the imu frame, m/s.
Definition: vn200_serial.h:89
uart.h
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
VNData::pos_u
float pos_u[3]
The current GPS position uncertainty in the North East Down (NED) coordinate frame,...
Definition: vn200_serial.h:91
VNData::vel_body
struct FloatVect3 vel_body
The estimated velocity in the imu frame, given in m/s.
Definition: vn200_serial.h:98
VNData::nanostamp
uint64_t nanostamp
Definition: vn200_serial.h:85
VNPacket::calc_chk
uint16_t calc_chk
Definition: vn200_serial.h:73
VNData::mode
uint8_t mode
0-not tracking, 1 - poor performance, 2- OK
Definition: vn200_serial.h:96
VNStatus
VNStatus
Definition: vn200_serial.h:78
vn200_parse
void vn200_parse(struct VNPacket *vnp, uint8_t c)
Packet Collection & state machine.
Definition: vn200_serial.c:121
vn200_read_message
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
VNMsgHeader
@ VNMsgHeader
Definition: vn200_serial.h:56
VNData::gyro
struct FloatRates gyro
Rates in the imu frame m/s.
Definition: vn200_serial.h:90
VNData::vel_u
float vel_u
NED velocity uncertainty [m/s].
Definition: vn200_serial.h:92
vn200_event
void vn200_event(struct VNPacket *vnp)
Definition: vn200_serial.c:110
VNPacket::datalength
uint16_t datalength
Definition: vn200_serial.h:69
VNPacket::msg_buf
uint8_t msg_buf[VN_BUFFER_SIZE]
Definition: vn200_serial.h:66
VNOutOfSpecs
@ VNOutOfSpecs
Definition: vn200_serial.h:80
VNPacket::framing_error
uint16_t framing_error
Definition: vn200_serial.h:72
VNOK
@ VNOK
Definition: vn200_serial.h:81
VNData::ypr
float ypr[3]
yaw, pitch, roll [deg]
Definition: vn200_serial.h:87
VNData::err
uint8_t err
see page 122 of VN-200 datasheet
Definition: vn200_serial.h:97
VNMsgData
@ VNMsgData
Definition: vn200_serial.h:58
pprz_algebra.h
Paparazzi generic algebra macros.
VNData::timestamp
float timestamp
Time since VN startup [s].
Definition: vn200_serial.h:86
FloatEulers
euler angles
Definition: pprz_algebra_float.h:84
VNData::pos_lla
double pos_lla[3]
Definition: vn200_serial.h:102
uint16_t
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
VNData
Definition: vn200_serial.h:84
VNData::tow
uint64_t tow
tow (in nanoseconds), uint64
Definition: vn200_serial.h:99
FloatRates
angular rates
Definition: pprz_algebra_float.h:93
pprz_isa.h
Paparazzi atmospheric pressure conversion utilities.
VNPacket::status
enum VNMsgStatus status
Definition: vn200_serial.h:67