Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
nps_ins_vectornav.c File Reference
#include "nps_ins.h"
#include <sys/time.h>
#include "nps_fdm.h"
#include <time.h>
#include <stdio.h>
#include "nps_sensors.h"
#include <stdlib.h>
+ Include dependency graph for nps_ins_vectornav.c:

Go to the source code of this file.

Data Structures

struct  VectornavData
 

Macros

#define VN_DATA_START   10
 
#define VN_BUFFER_SIZE   512
 
#define GPS_SEC_IN_DAY   86400
 

Functions

void ins_vectornav_init (void)
 Initialize Vectornav struct. More...
 
void ins_vectornav_event (void)
 Event handling for Vectornav. More...
 
static short vn_calculate_crc (unsigned char data[], unsigned int length)
 Calculates the 16-bit CRC for the given ASCII or binary message. More...
 
void nps_ins_init (void)
 
static uint64_t vn_get_time_of_week (void)
 
void nps_ins_fetch_data (struct NpsFdm *fdm_ins)
 Fetch data from FDM and store them into vectornav packet NOTE: some noise is being added, see Vectornav specifications for details about the precision: http://www.vectornav.com/products/vn-200/specifications. More...
 
uint16_t nps_ins_fill_buffer (void)
 

Variables

static uint8_t VN_SYNC = 0xFA
 
static uint8_t VN_OUTPUT_GROUP = 0x39
 
static uint16_t VN_GROUP_FIELD_1 = 0x01E9
 
static uint16_t VN_GROUP_FIELD_2 = 0x061A
 
static uint16_t VN_GROUP_FIELD_3 = 0x0140
 
static uint16_t VN_GROUP_FIELD_4 = 0x0009
 
uint8_t vn_buffer [VN_BUFFER_SIZE]
 
uint8_tins_buffer
 
struct VectornavData vn_data
 

Data Structure Documentation

◆ VectornavData

struct VectornavData

Definition at line 50 of file nps_ins_vectornav.c.

Data Fields
float Accel[3]
float AngularRate[3]
uint8_t Fix
uint16_t InsStatus
float LinearAccelBody[3]
uint8_t NumSats
double Position[3]
float PosU[3]
uint64_t TimeStartup
uint64_t Tow
float VelBody[3]
float Velocity[3]
float VelU
float YawPitchRoll[3]
float YprU[3]

Macro Definition Documentation

◆ GPS_SEC_IN_DAY

#define GPS_SEC_IN_DAY   86400

Definition at line 37 of file nps_ins_vectornav.c.

◆ VN_BUFFER_SIZE

#define VN_BUFFER_SIZE   512

Definition at line 36 of file nps_ins_vectornav.c.

◆ VN_DATA_START

#define VN_DATA_START   10

Definition at line 35 of file nps_ins_vectornav.c.

Function Documentation

◆ ins_vectornav_event()

void ins_vectornav_event ( void  )

Event handling for Vectornav.

Definition at line 73 of file nps_ins_vectornav.c.

References ins_vectornav_propagate(), ins_vn, VNPacket::msg_available, vn200_event(), vn200_read_message(), InsVectornav::vn_data, and InsVectornav::vn_packet.

+ Here is the call graph for this function:

◆ ins_vectornav_init()

◆ nps_ins_fetch_data()

◆ nps_ins_fill_buffer()

◆ nps_ins_init()

void nps_ins_init ( void  )

Definition at line 94 of file nps_ins_vectornav.c.

References ins_buffer, and vn_buffer.

Referenced by nps_ins_data_loop().

+ Here is the caller graph for this function:

◆ vn_calculate_crc()

static short vn_calculate_crc ( unsigned char  data[],
unsigned int  length 
)
static

Calculates the 16-bit CRC for the given ASCII or binary message.

The CRC is calculated over the packet starting just after the sync byte (not including the sync byte) and ending at the end of payload.

Definition at line 80 of file nps_ins_vectornav.c.

References crc.

Referenced by nps_ins_fill_buffer().

+ Here is the caller graph for this function:

◆ vn_get_time_of_week()

static uint64_t vn_get_time_of_week ( void  )
static
Returns
GPS TOW

Definition at line 103 of file nps_ins_vectornav.c.

References GPS_SEC_IN_DAY.

Referenced by nps_ins_fetch_data().

+ Here is the caller graph for this function:

Variable Documentation

◆ ins_buffer

uint8_t* ins_buffer

Definition at line 48 of file nps_ins_vectornav.c.

Referenced by nps_ins_data_loop(), and nps_ins_init().

◆ vn_buffer

uint8_t vn_buffer[VN_BUFFER_SIZE]

Definition at line 46 of file nps_ins_vectornav.c.

Referenced by nps_ins_fill_buffer(), and nps_ins_init().

◆ vn_data

◆ VN_GROUP_FIELD_1

uint16_t VN_GROUP_FIELD_1 = 0x01E9
static

Definition at line 41 of file nps_ins_vectornav.c.

Referenced by nps_ins_fill_buffer().

◆ VN_GROUP_FIELD_2

uint16_t VN_GROUP_FIELD_2 = 0x061A
static

Definition at line 42 of file nps_ins_vectornav.c.

Referenced by nps_ins_fill_buffer().

◆ VN_GROUP_FIELD_3

uint16_t VN_GROUP_FIELD_3 = 0x0140
static

Definition at line 43 of file nps_ins_vectornav.c.

Referenced by nps_ins_fill_buffer().

◆ VN_GROUP_FIELD_4

uint16_t VN_GROUP_FIELD_4 = 0x0009
static

Definition at line 44 of file nps_ins_vectornav.c.

Referenced by nps_ins_fill_buffer().

◆ VN_OUTPUT_GROUP

uint8_t VN_OUTPUT_GROUP = 0x39
static

Definition at line 40 of file nps_ins_vectornav.c.

Referenced by nps_ins_fill_buffer().

◆ VN_SYNC

uint8_t VN_SYNC = 0xFA
static

Definition at line 39 of file nps_ins_vectornav.c.

Referenced by nps_ins_fill_buffer().