35 #define VN_DATA_START 10
36 #define VN_BUFFER_SIZE 512
37 #define GPS_SEC_IN_DAY 86400
83 unsigned short crc = 0;
84 for (i = 0; i < length; i++) {
85 crc = (
unsigned char)(
crc >> 8) | (
crc << 8);
87 crc ^= (
unsigned char)(
crc & 0xff) >> 4;
89 crc ^= (
crc & 0x00ff) << 5;
105 struct timeval curTime;
106 gettimeofday(&curTime, NULL);
107 int milli = curTime.tv_usec / 1000;
109 localtime_r(&curTime.tv_sec, &t_res);
110 struct tm *tt = &t_res;
128 memcpy(&fdm_data, fdm_ins,
sizeof(
struct NpsFdm));
172 vn_data.
PosU[0] = 2.5+(((float)rand())/RAND_MAX)*0.1;
173 vn_data.
PosU[1] = 2.5+(((float)rand())/RAND_MAX)*0.1;
174 vn_data.
PosU[2] = 2.5+(((float)rand())/RAND_MAX)*0.1;
187 vn_data.
YprU[0] = 2.5+(((
float)rand())/RAND_MAX)*0.1;
188 vn_data.
YprU[1] = 0.5+(((float)rand())/RAND_MAX)*0.1;
189 vn_data.
YprU[2] = 0.5+(((float)rand())/RAND_MAX)*0.1;
225 idx += 3 *
sizeof(float);
229 idx += 3 *
sizeof(float);
234 idx += 3 *
sizeof(double);
239 idx += 3 *
sizeof(float);
243 idx += 3 *
sizeof(float);
259 idx += 3 *
sizeof(float);
263 idx +=
sizeof(float);
267 idx += 3 *
sizeof(float);
271 idx += 3 *
sizeof(float);
280 idx += 3 *
sizeof(float);
struct NedCoor_d ltp_ecef_vel
velocity in LTP frame, wrt ECEF frame
struct DoubleEulers ltp_to_body_eulers
struct DoubleRates body_ecef_rotvel
struct DoubleVect3 body_ecef_accel
acceleration in body frame, wrt ECEF frame
struct DoubleVect3 body_accel
acceleration in body frame as measured by an accelerometer (incl.
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,...
struct VectornavData vn_data
static uint16_t VN_GROUP_FIELD_1
uint16_t nps_ins_fill_buffer(void)
static uint16_t VN_GROUP_FIELD_4
static short vn_calculate_crc(unsigned char data[], unsigned int length)
Calculates the 16-bit CRC for the given ASCII or binary message.
static uint16_t VN_GROUP_FIELD_3
static uint16_t VN_GROUP_FIELD_2
static uint8_t VN_OUTPUT_GROUP
uint8_t vn_buffer[VN_BUFFER_SIZE]
void ins_vectornav_init(void)
Initialize Vectornav struct.
void ins_vectornav_event(void)
Event handling for Vectornav.
static uint64_t vn_get_time_of_week(void)
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.