37 #include <gtest/gtest.h> 43 TEST(ParserTestSuite, testBestposAsciiParsing)
46 std::string bestpos_str =
"#BESTPOSA,ICOM1,0,87.5,FINESTEERING,1956,157432.000,00000800,7145,6938;" 47 "SOL_COMPUTED,SINGLE,29.44391220792,-98.61476921244,261.4344,-26.0000,WGS84,2.1382," 48 "3.1092,4.0429,\"\",0.000,0.000,8,8,8,8,0,06,00,03*ecf2202b\r\n" 49 "#BESTPOSA,COM1,0,83.5,FINESTEERING,1419,336148.000,02000040,6145,2724;SOL_COMPUTED,SINGLE," 50 "51.11636418888,-114.03832502118,1064.9520,-16.2712,WGS84,1.6961,1.3636,3.6449,\"\"," 51 "0.000,0.000,8,8,8,8,0,0,0,06,0,03*f181ad10\r\n" 52 "#BESTPOSA,COM1,0,78.5,FINESTEERING,1419,336208.000,02000040,6145,2724;SOL_COMPUTED," 53 "NARROW_INT,51.11635910984,-114.03833105168,1063.8416,-16.2712,WGS84,0.0135,0.0084," 54 "0.0172,\"AAAA\",1.000,0.000,8,8,8,8,0,01,0,03*072421c0\r\n";
55 std::string extracted_str;
59 std::vector<novatel_gps_driver::NmeaSentence> nmea_sentences;
60 std::vector<novatel_gps_driver::NovatelSentence> novatel_sentences;
61 std::vector<novatel_gps_driver::BinaryMessage> binary_messages;
62 std::string remaining;
65 binary_messages, remaining);
67 ASSERT_EQ(0, nmea_sentences.size());
68 ASSERT_EQ(0, binary_messages.size());
69 ASSERT_EQ(3, novatel_sentences.size());
75 novatel_gps_msgs::NovatelPositionPtr
msg = parser.
ParseAscii(sentence);
77 ASSERT_NE(msg.get(),
nullptr);
79 ASSERT_EQ(
"SOL_COMPUTED", msg->solution_status);
80 ASSERT_DOUBLE_EQ(29.44391220792, msg->lat);
81 ASSERT_DOUBLE_EQ(-98.61476921244, msg->lon);
84 TEST(ParserTestSuite, testCorrimudataAsciiParsing)
87 std::string sentence_str =
"#CORRIMUDATAA,COM1,0,77.5,FINESTEERING,1769,237601.000,02000020," 88 "bdba,12597;1769,237601.000000000,-0.000003356,0.000002872,0.000001398,0.000151593," 89 "0.000038348,-0.000078820*e370e1d9\r\n";
90 std::string extracted_str;
94 std::vector<novatel_gps_driver::NmeaSentence> nmea_sentences;
95 std::vector<novatel_gps_driver::NovatelSentence> novatel_sentences;
96 std::vector<novatel_gps_driver::BinaryMessage> binary_messages;
97 std::string remaining;
100 binary_messages, remaining);
102 ASSERT_EQ(0, nmea_sentences.size());
103 ASSERT_EQ(0, binary_messages.size());
104 ASSERT_EQ(1, novatel_sentences.size());
110 novatel_gps_msgs::NovatelCorrectedImuDataPtr
msg = parser.
ParseAscii(sentence);
112 ASSERT_NE(msg.get(),
nullptr);
113 ASSERT_EQ(1769, msg->gps_week_num);
114 ASSERT_DOUBLE_EQ(237601.0, msg->gps_seconds);
115 ASSERT_DOUBLE_EQ(-0.000003356, msg->pitch_rate);
116 ASSERT_DOUBLE_EQ(0.000002872, msg->roll_rate);
117 ASSERT_DOUBLE_EQ(0.000001398, msg->yaw_rate);
118 ASSERT_DOUBLE_EQ(0.000151593, msg->lateral_acceleration);
119 ASSERT_DOUBLE_EQ(0.000038348, msg->longitudinal_acceleration);
120 ASSERT_DOUBLE_EQ(-0.00007882, msg->vertical_acceleration);
123 TEST(ParserTestSuite, testGpgsvParsing)
126 std::string sentence_str =
"$GPGSV,3,3,11,12,07,00.,32,13,03,227,36,22,0.,041,*4A\r\n";
127 std::string extracted_str;
131 std::vector<novatel_gps_driver::NmeaSentence> nmea_sentences;
132 std::vector<novatel_gps_driver::NovatelSentence> novatel_sentences;
133 std::vector<novatel_gps_driver::BinaryMessage> binary_messages;
134 std::string remaining;
137 binary_messages, remaining);
139 ASSERT_EQ(1, nmea_sentences.size());
140 ASSERT_EQ(0, binary_messages.size());
141 ASSERT_EQ(0, novatel_sentences.size());
146 ASSERT_FALSE(sentence.body.empty());
148 novatel_gps_msgs::GpgsvPtr
msg = parser.
ParseAscii(sentence);
150 ASSERT_NE(msg.get(),
nullptr);
152 ASSERT_EQ(3, msg->n_msgs);
153 ASSERT_EQ(3, msg->msg_number);
154 ASSERT_EQ(3, msg->satellites.size());
155 ASSERT_EQ(11, msg->n_satellites);
156 ASSERT_EQ(12, msg->satellites[0].prn);
157 ASSERT_EQ(7, msg->satellites[0].elevation);
158 ASSERT_EQ(0, msg->satellites[0].azimuth);
159 ASSERT_EQ(32, msg->satellites[0].snr);
160 ASSERT_EQ(13, msg->satellites[1].prn);
161 ASSERT_EQ(3, msg->satellites[1].elevation);
162 ASSERT_EQ(227, msg->satellites[1].azimuth);
163 ASSERT_EQ(36, msg->satellites[1].snr);
164 ASSERT_EQ(22, msg->satellites[2].prn);
165 ASSERT_EQ(0, msg->satellites[2].elevation);
166 ASSERT_EQ(41, msg->satellites[2].azimuth);
167 ASSERT_EQ(-1, msg->satellites[2].snr);
170 TEST(ParserTestSuite, testInscovAsciiParsing)
173 std::string sentence_str =
"#INSCOVA,COM1,0,66.5,FINESTEERING,1959,336623.000,00000000," 174 "f078,13754;1959,336623.000000000,0.0211295047125775,-0.0018214277429204,-0.0016153828661881," 175 "-0.0018214277429204,0.0174981375607521,0.0049878113409426,-0.0016153828661881," 176 "0.0049878113409426,0.0285474196118174,0.0000332609098342,-0.0000003409117564," 177 "0.0000018468158360,-0.0000003409117564,0.0000340563145112,-0.0000136598582783," 178 "0.0000018468158360,-0.0000136598582783,0.1515644215075894,0.0000008850783906," 179 "0.0000000006144488,-0.0000001633832672,0.0000000006144488,0.0000010749675168," 180 "0.0000000004985751,-0.0000001633832672,0.0000000004985751,0.0000009343218169*bc5352ab\r\n";
181 std::string extracted_str;
185 std::vector<novatel_gps_driver::NmeaSentence> nmea_sentences;
186 std::vector<novatel_gps_driver::NovatelSentence> novatel_sentences;
187 std::vector<novatel_gps_driver::BinaryMessage> binary_messages;
188 std::string remaining;
191 binary_messages, remaining);
193 ASSERT_EQ(0, nmea_sentences.size());
194 ASSERT_EQ(0, binary_messages.size());
195 ASSERT_EQ(1, novatel_sentences.size());
201 novatel_gps_msgs::InscovPtr
msg = parser.
ParseAscii(sentence);
203 ASSERT_NE(msg.get(),
nullptr);
205 ASSERT_EQ(1959, msg->week);
206 ASSERT_DOUBLE_EQ(336623.0, msg->seconds);
207 ASSERT_DOUBLE_EQ(0.0211295047125775, msg->position_covariance[0]);
208 ASSERT_DOUBLE_EQ(0.0000009343218169, msg->velocity_covariance[8]);
211 TEST(ParserTestSuite, testInspvaAsciiParsing)
214 std::string sentence_str =
"#INSPVAA,COM1,0,31.0,FINESTEERING,1264,144088.000,02040000," 215 "5615,1541;1264,144088.002284950,51.116827527,-114.037738908,401.191547167,354.846489850," 216 "108.429407241,-10.837482850,1.116219952,-3.476059035,7.372686190,INS_ALIGNMENT_COMPLETE*a2913d36\r\n";
217 std::string extracted_str;
221 std::vector<novatel_gps_driver::NmeaSentence> nmea_sentences;
222 std::vector<novatel_gps_driver::NovatelSentence> novatel_sentences;
223 std::vector<novatel_gps_driver::BinaryMessage> binary_messages;
224 std::string remaining;
227 binary_messages, remaining);
229 ASSERT_EQ(0, nmea_sentences.size());
230 ASSERT_EQ(0, binary_messages.size());
231 ASSERT_EQ(1, novatel_sentences.size());
237 novatel_gps_msgs::InspvaPtr
msg = parser.
ParseAscii(sentence);
239 ASSERT_NE(msg.get(),
nullptr);
241 ASSERT_EQ(1264, msg->week);
242 ASSERT_DOUBLE_EQ(144088.002284950, msg->seconds);
243 ASSERT_DOUBLE_EQ(51.116827527, msg->latitude);
244 ASSERT_DOUBLE_EQ(-114.037738908, msg->longitude);
245 ASSERT_DOUBLE_EQ(401.191547167, msg->height);
246 ASSERT_DOUBLE_EQ(354.846489850, msg->north_velocity);
247 ASSERT_DOUBLE_EQ(108.429407241, msg->east_velocity);
248 ASSERT_DOUBLE_EQ(-10.837482850, msg->up_velocity);
249 ASSERT_DOUBLE_EQ(1.116219952, msg->roll);
250 ASSERT_DOUBLE_EQ(-3.476059035, msg->pitch);
251 ASSERT_DOUBLE_EQ(7.372686190, msg->azimuth);
252 ASSERT_EQ(
"INS_ALIGNMENT_COMPLETE", msg->status);
255 TEST(ParserTestSuite, testInsstdevAsciiParsing)
258 std::string sentence_str =
"#INSSTDEVA,COM1,0,78.0,FINESTEERING,1907,233990.000,02000020," 259 "3e6d,32768;0.4372,0.3139,0.7547,0.0015,0.0015,0.0014,3.7503,3.7534,5.1857,26000005," 260 "0,0,01ffd1bf,0*3deca7d2\r\n";
261 std::string extracted_str;
265 std::vector<novatel_gps_driver::NmeaSentence> nmea_sentences;
266 std::vector<novatel_gps_driver::NovatelSentence> novatel_sentences;
267 std::vector<novatel_gps_driver::BinaryMessage> binary_messages;
268 std::string remaining;
271 binary_messages, remaining);
273 ASSERT_EQ(0, nmea_sentences.size());
274 ASSERT_EQ(0, binary_messages.size());
275 ASSERT_EQ(1, novatel_sentences.size());
281 novatel_gps_msgs::InsstdevPtr
msg = parser.
ParseAscii(sentence);
283 ASSERT_NE(msg.get(),
nullptr);
285 ASSERT_FLOAT_EQ(0.4372, msg->latitude_dev);
286 ASSERT_FLOAT_EQ(0.3139, msg->longitude_dev);
287 ASSERT_FLOAT_EQ(0.7547, msg->height_dev);
288 ASSERT_FLOAT_EQ(0.0015, msg->north_velocity_dev);
289 ASSERT_FLOAT_EQ(0.0015, msg->east_velocity_dev);
290 ASSERT_FLOAT_EQ(0.0014, msg->up_velocity_dev);
291 ASSERT_FLOAT_EQ(3.7503, msg->roll_dev);
292 ASSERT_FLOAT_EQ(3.7534, msg->pitch_dev);
293 ASSERT_FLOAT_EQ(5.1857, msg->azimuth_dev);
294 ASSERT_EQ(26000005, msg->extended_solution_status.original_mask);
297 TEST(ParserTestSuite, testBestxyzAsciiParsing)
300 std::string bestxyz_str =
"#BESTXYZA,COM1,0,55.0,FINESTEERING,1419,340033.000,02000040,d821,2724;" 301 "SOL_COMPUTED,NARROW_INT,-1634531.5683,-3664618.0326,4942496.3270,0.0099," 302 "0.0219,0.0115,SOL_COMPUTED,NARROW_INT,0.0011,-0.0049,-0.0001,0.0199,0.0439," 303 "0.0230,\"AAAA\",0.250,1.000,0.000,12,11,11,11,0,01,0,33*1fe2f509\r\n";
305 std::string extracted_str;
309 std::vector<novatel_gps_driver::NmeaSentence> nmea_sentences;
310 std::vector<novatel_gps_driver::NovatelSentence> novatel_sentences;
311 std::vector<novatel_gps_driver::BinaryMessage> binary_messages;
312 std::string remaining;
315 binary_messages, remaining);
317 ASSERT_EQ(0, nmea_sentences.size());
318 ASSERT_EQ(0, binary_messages.size());
319 ASSERT_EQ(1, novatel_sentences.size());
325 novatel_gps_msgs::NovatelXYZPtr
msg = parser.
ParseAscii(sentence);
327 ASSERT_NE(msg.get(),
nullptr);
329 ASSERT_EQ(
"SOL_COMPUTED", msg->solution_status);
330 ASSERT_EQ(
"NARROW_INT", msg->position_type);
331 ASSERT_DOUBLE_EQ(-1634531.5683, msg->x);
332 ASSERT_DOUBLE_EQ(-3664618.0326, msg->y);
333 ASSERT_DOUBLE_EQ(4942496.3270, msg->z);
334 ASSERT_FLOAT_EQ(0.0099, msg->x_sigma);
335 ASSERT_FLOAT_EQ(0.0219, msg->y_sigma);
336 ASSERT_FLOAT_EQ(0.0115, msg->z_sigma);
337 ASSERT_EQ(
"SOL_COMPUTED", msg->velocity_solution_status);
338 ASSERT_EQ(
"NARROW_INT", msg->velocity_type);
339 ASSERT_DOUBLE_EQ(0.0011, msg->x_vel);
340 ASSERT_DOUBLE_EQ(-0.0049, msg->y_vel);
341 ASSERT_DOUBLE_EQ(-0.0001, msg->z_vel);
342 ASSERT_FLOAT_EQ(0.0199, msg->x_vel_sigma);
343 ASSERT_FLOAT_EQ(0.0439, msg->y_vel_sigma);
344 ASSERT_FLOAT_EQ(0.0230, msg->z_vel_sigma);
345 ASSERT_EQ(
"\"AAAA\"", msg->base_station_id);
346 ASSERT_FLOAT_EQ(0.250, msg->velocity_latency);
347 ASSERT_FLOAT_EQ(1.000, msg->diff_age);
348 ASSERT_FLOAT_EQ(0.000, msg->solution_age);
349 ASSERT_EQ(12, msg->num_satellites_tracked);
350 ASSERT_EQ(11, msg->num_satellites_used_in_solution);
351 ASSERT_EQ(11, msg->num_gps_and_glonass_l1_used_in_solution);
352 ASSERT_EQ(11, msg->num_gps_and_glonass_l1_and_l2_used_in_solution);
353 ASSERT_EQ(1, msg->extended_solution_status.original_mask);
356 TEST(ParserTestSuite, testHeading2AsciiParsing)
359 std::string heading2_str =
"#HEADING2A,COM1,0,39.5,FINESTEERING,1622,422892.200,02040000,f9bf,6521;" 360 "SOL_COMPUTED,NARROW_INT,0.927607417,178.347869873,-1.3037414550,0,0.261901051,0.391376048," 361 "\"R222\",\"AAAA\",18,17,17,16,0,01,0,33*8c48d77c\r\n";
363 std::string extracted_str;
367 std::vector<novatel_gps_driver::NmeaSentence> nmea_sentences;
368 std::vector<novatel_gps_driver::NovatelSentence> novatel_sentences;
369 std::vector<novatel_gps_driver::BinaryMessage> binary_messages;
370 std::string remaining;
373 binary_messages, remaining);
375 ASSERT_EQ(0, nmea_sentences.size());
376 ASSERT_EQ(0, binary_messages.size());
377 ASSERT_EQ(1, novatel_sentences.size());
383 novatel_gps_msgs::NovatelHeading2Ptr
msg = parser.
ParseAscii(sentence);
385 ASSERT_NE(msg.get(),
nullptr);
387 ASSERT_EQ(
"SOL_COMPUTED", msg->solution_status);
388 ASSERT_EQ(
"NARROW_INT", msg->position_type);
389 ASSERT_FLOAT_EQ(0.927607417, msg->baseline_length);
390 ASSERT_FLOAT_EQ(178.347869873, msg->heading);
391 ASSERT_FLOAT_EQ(-1.3037414550, msg->pitch);
392 ASSERT_FLOAT_EQ(0.261901051, msg->heading_sigma);
393 ASSERT_FLOAT_EQ(0.391376048, msg->pitch_sigma);
394 ASSERT_EQ(
"\"R222\"", msg->rover_station_id);
395 ASSERT_EQ(
"\"AAAA\"", msg->master_station_id);
396 ASSERT_EQ(18, msg->num_satellites_tracked);
397 ASSERT_EQ(17, msg->num_satellites_used_in_solution);
398 ASSERT_EQ(17, msg->num_satellites_above_elevation_mask_angle);
399 ASSERT_EQ(16, msg->num_satellites_above_elevation_mask_angle_l2);
400 ASSERT_EQ(0, msg->solution_source);
401 ASSERT_EQ(1, msg->extended_solution_status.original_mask);
404 TEST(ParserTestSuite, testDualAntennaHeadingAsciiParsing)
407 std::string heading_str =
"#DUALANTENNAHEADINGA,UNKNOWN,0,66.5,FINESTEERING,1949,575614.000,02000000,d426,32768;" 408 "SOL_COMPUTED,NARROW_INT,-1.000000000,255.538528442,0.006041416,0.0,0.043859947,0.052394450," 409 "\"J56X\",24,18,18,17,04,01,00,33*1f082ec5\r\n";
411 std::string extracted_str;
415 std::vector<novatel_gps_driver::NmeaSentence> nmea_sentences;
416 std::vector<novatel_gps_driver::NovatelSentence> novatel_sentences;
417 std::vector<novatel_gps_driver::BinaryMessage> binary_messages;
418 std::string remaining;
421 binary_messages, remaining);
423 ASSERT_EQ(0, nmea_sentences.size());
424 ASSERT_EQ(0, binary_messages.size());
425 ASSERT_EQ(1, novatel_sentences.size());
431 novatel_gps_msgs::NovatelDualAntennaHeadingPtr
msg = parser.
ParseAscii(sentence);
433 ASSERT_NE(msg.get(),
nullptr);
435 ASSERT_EQ(
"SOL_COMPUTED", msg->solution_status);
436 ASSERT_EQ(
"NARROW_INT", msg->position_type);
437 ASSERT_FLOAT_EQ(-1.000000000, msg->baseline_length);
438 ASSERT_FLOAT_EQ(255.538528442, msg->heading);
439 ASSERT_FLOAT_EQ(0.006041416, msg->pitch);
440 ASSERT_FLOAT_EQ(0.043859947, msg->heading_sigma);
441 ASSERT_FLOAT_EQ(0.052394450, msg->pitch_sigma);
442 ASSERT_EQ(
"\"J56X\"", msg->station_id);
443 ASSERT_EQ(24, msg->num_satellites_tracked);
444 ASSERT_EQ(18, msg->num_satellites_used_in_solution);
445 ASSERT_EQ(18, msg->num_satellites_above_elevation_mask_angle);
446 ASSERT_EQ(17, msg->num_satellites_above_elevation_mask_angle_l2);
447 ASSERT_EQ(1, msg->solution_source);
448 ASSERT_EQ(1, msg->extended_solution_status.original_mask);
451 int main(
int argc,
char **argv)
453 testing::InitGoogleTest(&argc, argv);
455 return RUN_ALL_TESTS();
novatel_gps_msgs::InsstdevPtr ParseAscii(const NovatelSentence &sentence) override
Converts sentence into a ROS message pointer and returns it.
const std::string GetMessageName() const override
const std::string GetMessageName() const override
const std::string GetMessageName() const override
const std::string GetMessageName() const override
novatel_gps_msgs::NovatelDualAntennaHeadingPtr ParseAscii(const NovatelSentence &sentence) override
Converts sentence into a ROS message pointer and returns it.
novatel_gps_msgs::InspvaPtr ParseAscii(const NovatelSentence &sentence) override
Converts sentence into a ROS message pointer and returns it.
TEST(ParserTestSuite, testBestposAsciiParsing)
novatel_gps_msgs::NovatelPositionPtr ParseAscii(const NovatelSentence &sentence) override
Converts sentence into a ROS message pointer and returns it.
const std::string GetMessageName() const override
novatel_gps_msgs::InscovPtr ParseAscii(const NovatelSentence &sentence) override
Converts sentence into a ROS message pointer and returns it.
const std::string GetMessageName() const override
novatel_gps_msgs::NovatelHeading2Ptr ParseAscii(const NovatelSentence &sentence) override
Converts sentence into a ROS message pointer and returns it.
novatel_gps_msgs::GpgsvPtr ParseAscii(const NmeaSentence &sentence) override
Converts sentence into a ROS message pointer and returns it.
const std::string GetMessageName() const override
int main(int argc, char **argv)
novatel_gps_msgs::NovatelCorrectedImuDataPtr ParseAscii(const NovatelSentence &sentence) override
Converts sentence into a ROS message pointer and returns it.
novatel_gps_msgs::NovatelXYZPtr ParseAscii(const NovatelSentence &sentence) override
Converts sentence into a ROS message pointer and returns it.
const std::string GetMessageName() const override
const std::string GetMessageName() const override