72static inline unsigned short calculateCRC(
unsigned char data[], 
unsigned int length)
 
   75  unsigned short crc = 0;
 
   76  for (i = 0; i < length; i++) {
 
   77    crc = (
unsigned char)(crc >> 8) | (crc << 8);
 
   79    crc ^= (
unsigned char)(crc & 0xff) >> 4;
 
   81    crc ^= (crc & 0x00ff) << 5;
 
 
   93  unsigned short rec_crc = (
unsigned short)(data[length] << 8 | data[length + 1]);
 
 
  107  while (
dev->char_available(
dev->periph) && !(
vnp->msg_available)) {
 
 
  116  if (
dev->char_available(
dev->periph)) {
 
 
  127  switch (
vnp->status) {
 
  142        vnp->msg_buf[
vnp->msg_idx] = c;
 
  152      vnp->msg_buf[
vnp->msg_idx] = c;
 
  160      vnp->msg_buf[
vnp->msg_idx] =  c;
 
  162      if (
vnp->msg_idx == (
vnp->datalength + 2)) {
 
  164          vnp->msg_available = 
true;
 
  167          vnp->msg_available = 
false;
 
 
  223  vn_data->
tow = vn_data->
tow / 1000000; 
 
 
static const struct usb_device_descriptor dev
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned long long uint64_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
void vn200_read_message(struct VNPacket *vn_packet, struct VNData *vn_data)
Read received message and populate data struct with new measurements.
void vn200_event(struct VNPacket *vnp)
void vn200_yaw_pitch_roll_to_attitude(struct FloatEulers *vn_attitude)
Convert yaw, pitch, and roll data from VectorNav to correct attitude yaw(0), pitch(1),...
static unsigned short calculateCRC(unsigned char data[], unsigned int length)
Calculates the 16-bit CRC for the given ASCII or binary message.
void vn200_check_status(struct VNData *vn_data)
Check INS status.
static void vn200_read_buffer(struct VNPacket *vnp)
void vn200_parse(struct VNPacket *vnp, uint8_t c)
Packet Collection & state machine.
static bool verify_chk(unsigned char data[], unsigned int length, uint16_t *calc_chk, uint16_t *rec_chk)
Verify checksum.
Vectornav VN-200 INS subsystem.
uint8_t err
see page 122 of VN-200 datasheet
struct FloatRates gyro
Rates in the imu frame m/s.
struct FloatEulers attitude
Attitude, float, [rad], yaw, pitch, roll.
uint8_t msg_buf[VN_BUFFER_SIZE]
struct FloatEulers ypr_u
Attitude uncertainty, 1sigma, float, [degrees], yaw, pitch, roll.
uint64_t tow
tow (in nanoseconds), uint64
struct FloatVect3 accel
Acceleration in the imu frame, m/s.
uint8_t mode
0-not tracking, 1 - poor performance, 2- OK
float timestamp
Time since VN startup [s].
float pos_u[3]
The current GPS position uncertainty in the North East Down (NED) coordinate frame,...
uint16_t ins_status
see page 122 of VN-200 datasheet
struct FloatVect3 vel_body
The estimated velocity in the imu frame, given in m/s.
float vel_u
NED velocity uncertainty [m/s].
uint8_t gps_fix
None|2D|3D.
uint8_t num_sv
number of visible satellites
struct FloatVect3 lin_accel
Linear acceleration in imu frame [m/s^2].
struct NedCoor_f vel_ned
The estimated velocity in the North East Down (NED) frame, given in m/s.