55 att_rad.
phi = RadOfDeg(vn_attitude->
psi);
57 att_rad.
psi = RadOfDeg(vn_attitude->
phi);
59 vn_attitude->
phi = att_rad.
phi;
61 vn_attitude->
psi = att_rad.
psi;
70 static inline unsigned short calculateCRC(
unsigned char data[],
unsigned int length)
73 unsigned short crc = 0;
74 for (i = 0; i < length; i++) {
75 crc = (
unsigned char)(crc >> 8) | (crc << 8);
77 crc ^= (
unsigned char)(crc & 0xff) >> 4;
79 crc ^= (crc & 0x00ff) << 5;
91 unsigned short rec_crc = (
unsigned short)(data[length] << 8 | data[length + 1]);
94 if (calc_crc == rec_crc) {
192 memcpy(&vn_data->
attitude, &vn_packet->
msg_buf[idx], 3 *
sizeof(
float));
193 idx += 3 *
sizeof(float);
199 memcpy(&vn_data->
gyro, &vn_packet->
msg_buf[idx], 3 *
sizeof(
float));
200 idx += 3 *
sizeof(float);
204 memcpy(&vn_data->
pos_lla, &vn_packet->
msg_buf[idx], 3 *
sizeof(
double));
205 idx += 3 *
sizeof(double);
209 memcpy(&vn_data->
vel_ned, &vn_packet->
msg_buf[idx], 3 *
sizeof(
float));
210 idx += 3 *
sizeof(float);
213 memcpy(&vn_data->
accel, &vn_packet->
msg_buf[idx], 3 *
sizeof(
float));
214 idx += 3 *
sizeof(float);
219 vn_data->
tow = vn_data->
tow / 1000000;
230 memcpy(&vn_data->
pos_u, &vn_packet->
msg_buf[idx], 3 *
sizeof(
float));
231 idx += 3 *
sizeof(float);
234 memcpy(&vn_data->
vel_u, &vn_packet->
msg_buf[idx],
sizeof(
float));
235 idx +=
sizeof(float);
246 idx += 3 *
sizeof(float);
249 memcpy(&vn_data->
ypr_u, &vn_packet->
msg_buf[idx], 3 *
sizeof(
float));
250 idx += 3 *
sizeof(float);
261 idx +=
sizeof(float);
struct NedCoor_f vel_ned
The estimated velocity in the North East Down (NED) frame, given in m/s.
uint8_t uart_getch(struct uart_periph *p)
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), roll(2) -> phi, theta, psi [deg] -> rad.
void vn200_parse(struct VNPacket *vnp, uint8_t c)
Packet Collection & state machine.
uint8_t num_sv
number of visible satellites
struct FloatVect3 lin_accel
Linear acceleration in imu frame [m/s^2].
void vn200_event(struct VNPacket *vnp)
uint8_t gps_fix
None|2D|3D.
struct FloatEulers attitude
Attitude, float, [rad], yaw, pitch, roll.
static void vn200_read_buffer(struct VNPacket *vnp)
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 pos_u[3]
The current GPS position uncertainty in the North East Down (NED) coordinate frame, given in meters.
struct FloatEulers ypr_u
Attitude uncertainty, 1sigma, float, [degrees], yaw, pitch, roll.
unsigned long long uint64_t
struct VectornavData vn_data
uint8_t mode
0-not tracking, 1 - poor performance, 2- OK
struct FloatVect3 accel
Acceleration in the imu frame, m/s.
Vectornav VN-200 INS subsystem.
void vn200_read_message(struct VNPacket *vn_packet, struct VNData *vn_data)
Read received message and populate data struct with new measurements.
static unsigned short calculateCRC(unsigned char data[], unsigned int length)
Calculates the 16-bit CRC for the given ASCII or binary message.
struct FloatRates gyro
Rates in the imu frame m/s.
static bool verify_chk(unsigned char data[], unsigned int length, uint16_t *calc_chk, uint16_t *rec_chk)
Verify checksum.
float vel_u
NED velocity uncertainty [m/s].
uint8_t msg_buf[VN_BUFFER_SIZE]
float timestamp
Time since VN startup [s].
uint8_t err
see page 122 of VN-200 datasheet
uint64_t tow
tow (in nanoseconds), uint64
void vn200_check_status(struct VNData *vn_data)
Check INS status.
int uart_char_available(struct uart_periph *p)
Check UART for available chars in receive buffer.