23 bool GPS::ros2mrpt(
const sensor_msgs::NavSatFix& msg, CObservationGPS& obj)
25 mrpt::obs::gnss::Message_NMEA_GGA gga;
26 gga.fields.altitude_meters = msg.altitude;
27 gga.fields.latitude_degrees = msg.latitude;
28 gga.fields.longitude_degrees = msg.longitude;
30 switch (msg.status.status)
33 gga.fields.fix_quality = 0;
36 gga.fields.fix_quality = 1;
39 gga.fields.fix_quality = 2;
42 gga.fields.fix_quality = 3;
45 gga.fields.fix_quality = 0;
56 sensor_msgs::NavSatFix& msg)
59 msg.header = msg_header;
63 if (obj.hasMsgClass<mrpt::obs::gnss::Message_NMEA_GGA>())
65 const mrpt::obs::gnss::Message_NMEA_GGA& gga =
66 obj.getMsgByClass<mrpt::obs::gnss::Message_NMEA_GGA>();
67 msg.altitude = gga.fields.altitude_meters;
68 msg.latitude = gga.fields.latitude_degrees;
69 msg.longitude = gga.fields.longitude_degrees;
74 switch (gga.fields.fix_quality)
77 msg.status.status = -1;
80 msg.status.status = 0;
83 msg.status.status = 2;
86 msg.status.status = 1;
91 msg.status.status = 0;
95 msg.status.service = 1;