Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#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>
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_t * | ins_buffer |
struct VectornavData | vn_data |
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] |
#define GPS_SEC_IN_DAY 86400 |
Definition at line 37 of file nps_ins_vectornav.c.
#define VN_BUFFER_SIZE 512 |
Definition at line 36 of file nps_ins_vectornav.c.
#define VN_DATA_START 10 |
Definition at line 35 of file nps_ins_vectornav.c.
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.
void ins_vectornav_init | ( | void | ) |
Initialize Vectornav struct.
Definition at line 71 of file nps_ins_vectornav.c.
References InsVectornav::accel_i, InsVectornav::body_to_imu, VNPacket::chksm_error, DefaultPeriodic, VNPacket::framing_error, VNPacket::hdr_error, ins_init_origin_i_from_flightplan(), ins_vn, INS_VN_BODY_TO_IMU_PHI, INS_VN_BODY_TO_IMU_PSI, INS_VN_BODY_TO_IMU_THETA, INT32_VECT3_ZERO, InsVectornav::ltp_accel_i, InsVectornav::ltp_def, InsVectornav::ltp_initialized, InsVectornav::ltp_pos_i, InsVectornav::ltp_speed_i, VNPacket::msg_available, VNPacket::msg_idx, VNPacket::noise_error, orientationSetEulers_f(), VNPacket::overrun_error, register_periodic_telemetry(), send_accel(), send_accel_scaled(), send_gyro(), send_gyro_scaled(), send_ins(), send_ins_ref(), send_ins_z(), send_vn_info(), VNPacket::status, InsVectornav::vn_data, InsVectornav::vn_packet, InsVectornav::vn_rate, InsVectornav::vn_status, VNMsgSync, and VNNotTracking.
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.
Definition at line 125 of file nps_ins_vectornav.c.
References VectornavData::Accel, VectornavData::AngularRate, NpsFdm::body_accel, NpsFdm::body_ecef_accel, NpsFdm::body_ecef_rotvel, VectornavData::Fix, VectornavData::InsStatus, VectornavData::LinearAccelBody, NpsFdm::ltp_ecef_vel, NpsFdm::ltp_to_body_eulers, VectornavData::NumSats, DoubleRates::p, DoubleEulers::phi, VectornavData::Position, VectornavData::PosU, DoubleEulers::psi, DoubleRates::q, DoubleRates::r, sensors, DoubleEulers::theta, NpsFdm::time, VectornavData::TimeStartup, VectornavData::Tow, VectornavData::VelBody, VectornavData::Velocity, VectornavData::VelU, vn_data, vn_get_time_of_week(), DoubleVect3::x, NedCoor_d::x, DoubleVect3::y, NedCoor_d::y, VectornavData::YawPitchRoll, VectornavData::YprU, DoubleVect3::z, and NedCoor_d::z.
Referenced by nps_ins_data_loop().
uint16_t nps_ins_fill_buffer | ( | void | ) |
Definition at line 202 of file nps_ins_vectornav.c.
References VectornavData::Accel, VectornavData::AngularRate, VectornavData::Fix, idx, VectornavData::InsStatus, VectornavData::LinearAccelBody, VectornavData::NumSats, VectornavData::Position, VectornavData::PosU, VectornavData::TimeStartup, VectornavData::Tow, VectornavData::VelBody, VectornavData::Velocity, VectornavData::VelU, vn_buffer, vn_calculate_crc(), vn_data, VN_DATA_START, VN_GROUP_FIELD_1, VN_GROUP_FIELD_2, VN_GROUP_FIELD_3, VN_GROUP_FIELD_4, VN_OUTPUT_GROUP, VN_SYNC, VectornavData::YawPitchRoll, and VectornavData::YprU.
Referenced by nps_ins_data_loop().
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().
|
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().
|
static |
Definition at line 103 of file nps_ins_vectornav.c.
References GPS_SEC_IN_DAY.
Referenced by nps_ins_fetch_data().
uint8_t* ins_buffer |
Definition at line 48 of file nps_ins_vectornav.c.
Referenced by nps_ins_data_loop(), and nps_ins_init().
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().
struct VectornavData vn_data |
Definition at line 68 of file nps_ins_vectornav.c.
Referenced by nps_ins_fetch_data(), nps_ins_fill_buffer(), vn200_check_status(), and vn200_read_message().
|
static |
Definition at line 41 of file nps_ins_vectornav.c.
Referenced by nps_ins_fill_buffer().
|
static |
Definition at line 42 of file nps_ins_vectornav.c.
Referenced by nps_ins_fill_buffer().
|
static |
Definition at line 43 of file nps_ins_vectornav.c.
Referenced by nps_ins_fill_buffer().
|
static |
Definition at line 44 of file nps_ins_vectornav.c.
Referenced by nps_ins_fill_buffer().
|
static |
Definition at line 40 of file nps_ins_vectornav.c.
Referenced by nps_ins_fill_buffer().
|
static |
Definition at line 39 of file nps_ins_vectornav.c.
Referenced by nps_ins_fill_buffer().