29 const int doy[] = {1, 32, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};
31 int days, sec, year =
static_cast<int>(ep[0]), mon =
static_cast<int>(ep[1]),
32 day =
static_cast<int>(ep[2]);
34 if (year < 1970 || 2099 < year || mon < 1 || 12 < mon)
return time;
37 days = (year - 1970) * 365 + (year - 1969) / 4 + doy[mon - 1] + day - 2 +
38 (year % 4 == 0 && mon >= 3 ? 1 : 0);
39 sec =
static_cast<int>(floor(ep[5]));
40 time.
time =
static_cast<time_t
>(days) * 86400 +
41 static_cast<int>(ep[3]) * 3600 +
static_cast<int>(ep[4]) * 60 +
43 time.
sec = ep[5] - sec;
96 static const double deg_coefficient = 360.0 / 32768;
97 static const double angular_coefficient = 300.0 / 32768;
98 static const double acc_coefficient = 12.0 / 32768 * 9.7883105;
99 static const double velocity_coefficient = 100.0 / 32768;
100 static const double deg_to_rad = M_PI / 180.0;
103 uint8_t check_sum = 0;
106 for (
int i = 0; i < dataLength - 1; ++i) {
107 check_sum ^= data[i];
110 if (check_sum == data[dataLength - 1]) {
112 float roll = (toValue<int16_t>(data, sub_index)) * deg_coefficient;
113 float pitch = (toValue<int16_t>(data, sub_index)) * deg_coefficient;
114 float x = (toValue<int16_t>(data, sub_index)) * deg_coefficient;
121 double imu_msg_y_angular_velocity =
122 (toValue<int16_t>(data, sub_index)) * angular_coefficient;
123 double imu_msg_x_angular_velocity =
124 (toValue<int16_t>(data, sub_index)) * angular_coefficient;
125 double imu_msg_z_angular_velocity =
126 -(toValue<int16_t>(data, sub_index)) * angular_coefficient;
127 double imu_msg_y_acc =
128 (toValue<int16_t>(data, sub_index)) * acc_coefficient;
129 double imu_msg_x_acc =
130 (toValue<int16_t>(data, sub_index)) * acc_coefficient;
131 double imu_msg_z_acc =
132 -(toValue<int16_t>(data, sub_index)) * acc_coefficient;
134 double imu_msg_latitude = (toValue<int32_t>(data, sub_index)) * 0.0000001;
135 double imu_msg_longitude = (toValue<int32_t>(data, sub_index)) * 0.0000001;
136 double imu_msg_altitude = (toValue<int32_t>(data, sub_index)) * 0.001;
138 float imu_msg_north_velocity =
139 (toValue<int16_t>(data, sub_index)) * velocity_coefficient;
140 float imu_msg_east_velocity =
141 (toValue<int16_t>(data, sub_index)) * velocity_coefficient;
142 float imu_msg_ground_velocity =
143 (toValue<int16_t>(data, sub_index)) * velocity_coefficient;
144 uint8_t imu_msg_ins_status = toValue<uint8_t>(data, sub_index);
146 uint8_t modestatus = toValue<uint8_t>(data, sub_index);
148 int16_t data1 = toValue<uint16_t>(data, sub_index);
149 int16_t data2 = toValue<uint16_t>(data, sub_index);
150 int16_t data3 = toValue<uint16_t>(data, sub_index);
153 uint32_t timiddle = toValue<uint32_t>(data, sub_index);
154 double t_ms = timiddle * 2.5 * 0.0001;
155 uint8_t loop_type = toValue<uint8_t>(data, sub_index);
157 uint32_t t_week = (toValue<uint32_t>(data, sub_index));
161 int64_t system_ms = (
static_cast<double>(ts_time.
time) * 1000.0) +
162 (
static_cast<double>(ts_time.
sec) * 1000.0);
173 insdata.
GyroX = imu_msg_x_angular_velocity * deg_to_rad;
174 insdata.
GyroY = imu_msg_y_angular_velocity * deg_to_rad;
175 insdata.
GyroZ = imu_msg_z_angular_velocity * deg_to_rad;
186 imu_msg_north_velocity;
188 imu_msg_east_velocity;
190 imu_msg_ground_velocity;
234 uint8_t check_sum = 0;
237 for (
int i = 0; i < dataLength - 1; ++i) {
238 check_sum ^= data[i];
241 if (check_sum == data[dataLength - 1]) {
242 double m_gnssMsg_longitude =
243 (toValue<int32_t>(data, sub_index)) * 0.0000001;
244 double m_gnssMsg_lon_sigma = (toValue<int16_t>(data, sub_index)) * 0.001;
245 double m_gnssMsg_latitude = (toValue<int32_t>(data, sub_index)) * 0.0000001;
246 double m_gnssMsg_lat_sigma = (toValue<int16_t>(data, sub_index)) * 0.001;
247 double m_gnssMsg_altitude = (toValue<int32_t>(data, sub_index)) * 0.001;
248 double m_gnssMsg_alt_sigma = (toValue<int16_t>(data, sub_index)) * 0.001;
250 double m_gnssMsg_gps_fix = toValue<uint16_t>(data, sub_index);
251 float m_gnssMsg_rtk_age = toValue<uint16_t>(data, sub_index);
252 uint8_t m_gnssMsg_flags_pos = data[sub_index++];
253 uint8_t m_gnssMsg_flags_vel = data[sub_index++];
254 uint8_t m_gnssMsg_flags_attitude = data[sub_index++];
255 uint8_t m_gnssMsg_flags_time = data[sub_index++];
257 double m_gnssMsg_hor_vel = (toValue<int16_t>(data, sub_index)) * 0.01;
258 double m_gnssMsg_track_angle = (toValue<int16_t>(data, sub_index)) * 0.01;
259 double m_gnssMsg_ver_vel = (toValue<int16_t>(data, sub_index)) * 0.01;
260 double m_gnssMsg_latency_vel = (toValue<int16_t>(data, sub_index)) * 0.001;
261 double m_gnssMsg_base_length = (toValue<int16_t>(data, sub_index)) * 0.001;
263 double m_gnssMsg_yaw = (toValue<int16_t>(data, sub_index)) * 0.01;
264 double m_gnssMsg_yaw_sigma = (toValue<int16_t>(data, sub_index)) * 0.001;
265 double m_gnssMsg_pitch = (toValue<int16_t>(data, sub_index)) * 0.001;
266 double m_gnssMsg_pitch_sigma = (toValue<int16_t>(data, sub_index)) * 0.001;
268 uint16_t utc_year_m = toValue<uint16_t>(data, sub_index);
269 uint16_t utc_year = (utc_year_m & 0x3f) + 2000;
271 uint8_t utc_mon = data[sub_index++];
272 uint8_t utc_day = data[sub_index++];
273 uint8_t utc_hour = data[sub_index++];
274 uint8_t utc_min = data[sub_index++];
275 float utc_sec = toValue<uint16_t>(data, sub_index) * 0.001;
277 double m_gnssMsg_ts_pos = toValue<uint32_t>(data, sub_index);
278 double m_gnssMsg_ts_vel = toValue<uint32_t>(data, sub_index);
279 double m_gnssMsg_ts_heading = toValue<uint32_t>(data, sub_index);
280 double m_gnssMsg_state = data[sub_index++];
281 double m_gnssMsg_num_master = data[sub_index++];
284 double m_gnssMsg_gdop = (toValue<int16_t>(data, sub_index)) * 0.01;
285 double m_gnssMsg_pdop = (toValue<int16_t>(data, sub_index)) * 0.01;
286 double m_gnssMsg_hdop = (toValue<int16_t>(data, sub_index)) * 0.01;
287 double m_gnssMsg_htdop = (toValue<int16_t>(data, sub_index)) * 0.01;
288 double m_gnssMsg_tdop = (toValue<int16_t>(data, sub_index)) * 0.01;
289 double m_gnssMsg_num_reserve = data[sub_index++];