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 degree_to_radians = 6.283185307179586232 / 360.0;
98 static const double angular_coefficient = 300.0 / 32768;
99 static const double acc_coefficient = 12.0 / 32768 * 9.7883105;
100 static const double velocity_coefficient = 100.0 / 32768;
101 static const double deg_to_rad = M_PI / 180.0;
104 uint8_t check_sum = 0;
107 for (
int i = 0; i < dataLength - 1; ++i) {
108 check_sum ^= data[i];
111 if (check_sum == data[dataLength - 1]) {
113 float roll = (toValue<int16_t>(data, sub_index)) * deg_coefficient;
114 float pitch = (toValue<int16_t>(data, sub_index)) * deg_coefficient;
115 float x = (toValue<int16_t>(data, sub_index)) * deg_coefficient;
119 x = 90.0 - (360.0 + x);
124 double imu_msg_y_angular_velocity =
125 (toValue<int16_t>(data, sub_index)) * angular_coefficient;
126 double imu_msg_x_angular_velocity =
127 (toValue<int16_t>(data, sub_index)) * angular_coefficient;
128 double imu_msg_z_angular_velocity =
129 -(toValue<int16_t>(data, sub_index)) * angular_coefficient;
130 double imu_msg_y_acc =
131 (toValue<int16_t>(data, sub_index)) * acc_coefficient;
132 double imu_msg_x_acc =
133 (toValue<int16_t>(data, sub_index)) * acc_coefficient;
134 double imu_msg_z_acc =
135 -(toValue<int16_t>(data, sub_index)) * acc_coefficient;
137 double imu_msg_latitude = (toValue<int32_t>(data, sub_index)) * 0.0000001;
138 double imu_msg_longitude = (toValue<int32_t>(data, sub_index)) * 0.0000001;
139 double imu_msg_altitude = (toValue<int32_t>(data, sub_index)) * 0.001;
141 float imu_msg_north_velocity =
142 (toValue<int16_t>(data, sub_index)) * velocity_coefficient;
143 float imu_msg_east_velocity =
144 (toValue<int16_t>(data, sub_index)) * velocity_coefficient;
145 float imu_msg_ground_velocity =
146 (toValue<int16_t>(data, sub_index)) * velocity_coefficient;
147 uint8_t imu_msg_ins_status = toValue<uint8_t>(data, sub_index);
149 uint8_t modestatus = toValue<uint8_t>(data, sub_index);
151 int16_t data1 = toValue<uint16_t>(data, sub_index);
152 int16_t data2 = toValue<uint16_t>(data, sub_index);
153 int16_t data3 = toValue<uint16_t>(data, sub_index);
156 uint32_t timiddle = toValue<uint32_t>(data, sub_index);
157 double t_ms = timiddle * 2.5 * 0.0001;
158 uint8_t loop_type = toValue<uint8_t>(data, sub_index);
160 uint32_t t_week = (toValue<uint32_t>(data, sub_index));
164 int64_t system_ms = (
static_cast<double>(ts_time.
time) * 1000.0) +
165 (
static_cast<double>(ts_time.
sec) * 1000.0);
178 insdata.
GyroX = imu_msg_x_angular_velocity * deg_to_rad;
179 insdata.
GyroY = imu_msg_y_angular_velocity * deg_to_rad;
180 insdata.
GyroZ = imu_msg_z_angular_velocity * deg_to_rad;
190 imu_msg_north_velocity;
192 imu_msg_east_velocity;
194 imu_msg_ground_velocity;
238 uint8_t check_sum = 0;
241 for (
int i = 0; i < dataLength - 1; ++i) {
242 check_sum ^= data[i];
245 if (check_sum == data[dataLength - 1]) {
246 double m_gnssMsg_longitude =
247 (toValue<int32_t>(data, sub_index)) * 0.0000001;
248 double m_gnssMsg_lon_sigma = (toValue<int16_t>(data, sub_index)) * 0.001;
249 double m_gnssMsg_latitude = (toValue<int32_t>(data, sub_index)) * 0.0000001;
250 double m_gnssMsg_lat_sigma = (toValue<int16_t>(data, sub_index)) * 0.001;
251 double m_gnssMsg_altitude = (toValue<int32_t>(data, sub_index)) * 0.001;
252 double m_gnssMsg_alt_sigma = (toValue<int16_t>(data, sub_index)) * 0.001;
254 double m_gnssMsg_gps_fix = toValue<uint16_t>(data, sub_index);
255 float m_gnssMsg_rtk_age = toValue<uint16_t>(data, sub_index);
256 uint8_t m_gnssMsg_flags_pos = data[sub_index++];
257 uint8_t m_gnssMsg_flags_vel = data[sub_index++];
258 uint8_t m_gnssMsg_flags_attitude = data[sub_index++];
259 uint8_t m_gnssMsg_flags_time = data[sub_index++];
261 double m_gnssMsg_hor_vel = (toValue<int16_t>(data, sub_index)) * 0.01;
262 double m_gnssMsg_track_angle = (toValue<int16_t>(data, sub_index)) * 0.01;
263 double m_gnssMsg_ver_vel = (toValue<int16_t>(data, sub_index)) * 0.01;
264 double m_gnssMsg_latency_vel = (toValue<int16_t>(data, sub_index)) * 0.001;
265 double m_gnssMsg_base_length = (toValue<int16_t>(data, sub_index)) * 0.001;
267 double m_gnssMsg_yaw = (toValue<int16_t>(data, sub_index)) * 0.01;
268 double m_gnssMsg_yaw_sigma = (toValue<int16_t>(data, sub_index)) * 0.001;
269 double m_gnssMsg_pitch = (toValue<int16_t>(data, sub_index)) * 0.001;
270 double m_gnssMsg_pitch_sigma = (toValue<int16_t>(data, sub_index)) * 0.001;
272 uint16_t utc_year_m = toValue<uint16_t>(data, sub_index);
273 uint16_t utc_year = (utc_year_m & 0x3f) + 2000;
275 uint8_t utc_mon = data[sub_index++];
276 uint8_t utc_day = data[sub_index++];
277 uint8_t utc_hour = data[sub_index++];
278 uint8_t utc_min = data[sub_index++];
279 float utc_sec = toValue<uint16_t>(data, sub_index) * 0.001;
281 double m_gnssMsg_ts_pos = toValue<uint32_t>(data, sub_index);
282 double m_gnssMsg_ts_vel = toValue<uint32_t>(data, sub_index);
283 double m_gnssMsg_ts_heading = toValue<uint32_t>(data, sub_index);
284 double m_gnssMsg_state = data[sub_index++];
285 double m_gnssMsg_num_master = data[sub_index++];
288 double m_gnssMsg_gdop = (toValue<int16_t>(data, sub_index)) * 0.01;
289 double m_gnssMsg_pdop = (toValue<int16_t>(data, sub_index)) * 0.01;
290 double m_gnssMsg_hdop = (toValue<int16_t>(data, sub_index)) * 0.01;
291 double m_gnssMsg_htdop = (toValue<int16_t>(data, sub_index)) * 0.01;
292 double m_gnssMsg_tdop = (toValue<int16_t>(data, sub_index)) * 0.01;
293 double m_gnssMsg_num_reserve = data[sub_index++];