57 att_rad.
phi = RadOfDeg(vn_attitude->
psi);
59 att_rad.
psi = RadOfDeg(vn_attitude->
phi);
61 vn_attitude->
phi = att_rad.
phi;
63 vn_attitude->
psi = att_rad.
psi;
72 static 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]);
96 if (calc_crc == rec_crc) {
106 struct link_device *
dev = &(VN_PORT.device);
115 struct link_device *
dev = &(VN_PORT.device);
116 if (
dev->char_available(
dev->periph)) {
197 idx += 3 *
sizeof(float);
203 memcpy(&vn_data->
gyro, &vn_packet->
msg_buf[
idx], 3 *
sizeof(
float));
204 idx += 3 *
sizeof(float);
209 idx += 3 *
sizeof(double);
214 idx += 3 *
sizeof(float);
218 idx += 3 *
sizeof(float);
223 vn_data->
tow = vn_data->
tow / 1000000;
235 idx += 3 *
sizeof(float);
239 idx +=
sizeof(float);
250 idx += 3 *
sizeof(float);
254 idx += 3 *
sizeof(float);
265 idx +=
sizeof(float);
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.