35 #define VN_DATA_START 10
36 #define VN_BUFFER_SIZE 512
37 #define GPS_SEC_IN_DAY 86400
81 unsigned short crc = 0;
82 for (i = 0; i < length; i++) {
83 crc = (
unsigned char)(crc >> 8) | (crc << 8);
85 crc ^= (
unsigned char)(crc & 0xff) >> 4;
87 crc ^= (crc & 0x00ff) << 5;
103 struct timeval curTime;
104 gettimeofday(&curTime, NULL);
105 int milli = curTime.tv_usec / 1000;
107 localtime_r(&curTime.tv_sec, &t_res);
108 struct tm *tt = &t_res;
126 memcpy(&fdm_data, fdm_ins,
sizeof(
struct NpsFdm));
170 vn_data.
PosU[0] = 2.5+(((float)rand())/RAND_MAX)*0.1;
171 vn_data.
PosU[1] = 2.5+(((float)rand())/RAND_MAX)*0.1;
172 vn_data.
PosU[2] = 2.5+(((float)rand())/RAND_MAX)*0.1;
185 vn_data.
YprU[0] = 2.5+(((
float)rand())/RAND_MAX)*0.1;
186 vn_data.
YprU[1] = 0.5+(((float)rand())/RAND_MAX)*0.1;
187 vn_data.
YprU[2] = 0.5+(((float)rand())/RAND_MAX)*0.1;
223 idx += 3 *
sizeof(float);
227 idx += 3 *
sizeof(float);
232 idx += 3 *
sizeof(double);
237 idx += 3 *
sizeof(float);
241 idx += 3 *
sizeof(float);
257 idx += 3 *
sizeof(float);
261 idx +=
sizeof(float);
265 idx += 3 *
sizeof(float);
269 idx += 3 *
sizeof(float);
278 idx += 3 *
sizeof(float);
static uint16_t VN_GROUP_FIELD_4
uint8_t vn_buffer[VN_BUFFER_SIZE]
struct DoubleRates body_ecef_rotvel
unsigned 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_1
static uint16_t VN_GROUP_FIELD_3
double alt
in meters above WGS84 reference ellipsoid
static uint8_t VN_OUTPUT_GROUP
struct DoubleEulers ltp_to_body_eulers
struct NedCoor_d ltp_ecef_vel
velocity in LTP frame, wrt ECEF frame
unsigned long long uint64_t
static uint64_t vn_get_time_of_week(void)
struct VectornavData vn_data
struct DoubleVect3 body_accel
acceleration in body frame as measured by an accelerometer (incl.
static uint16_t VN_GROUP_FIELD_2
void ins_vectornav_event(void)
Event handling for Vectornav.
struct NpsSensors sensors
void ins_vectornav_init(void)
Initialize Vectornav struct.
struct DoubleVect3 body_ecef_accel
acceleration in body frame, wrt ECEF frame
uint16_t nps_ins_fill_buffer(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...