1 from sensor_msgs.msg
import NavSatFix
2 from sensor_msgs.msg
import NavSatStatus
3 from gps_common.msg
import GPSFix
4 from gps_common.msg
import GPSStatus
10 gpsfix_msg.header = navsat_msg.header
11 gpsfix_msg.status.status = navsat_msg.status.status
13 gpsfix_msg.status.motion_source = GPSStatus.SOURCE_NONE
14 gpsfix_msg.status.orientation_source = GPSStatus.SOURCE_NONE
15 gpsfix_msg.status.position_source = GPSStatus.SOURCE_NONE
16 if ((navsat_msg.status.service & NavSatStatus.SERVICE_GPS)
or
17 (navsat_msg.status.service & NavSatStatus.SERVICE_GLONASS)
or
18 (navsat_msg.status.service & NavSatStatus.SERVICE_GALILEO)):
19 gpsfix_msg.status.motion_source = \
20 gpsfix_msg.status.motion_source | GPSStatus.SOURCE_GPS
21 gpsfix_msg.status.orientation_source = \
22 gpsfix_msg.status.orientation_source | GPSStatus.SOURCE_GPS
23 gpsfix_msg.status.position_source = \
24 gpsfix_msg.status.position_source | GPSStatus.SOURCE_GPS
26 if navsat_msg.status.service & NavSatStatus.SERVICE_COMPASS:
27 gpsfix_msg.status.orientation_source = \
28 gpsfix_msg.status.orientation_source | GPSStatus.SOURCE_MAGNETIC
30 gpsfix_msg.latitude = navsat_msg.latitude
31 gpsfix_msg.longitude = navsat_msg.longitude
32 gpsfix_msg.altitude = navsat_msg.altitude
33 gpsfix_msg.position_covariance = navsat_msg.position_covariance
34 gpsfix_msg.position_covariance_type = navsat_msg.position_covariance_type
41 navsat_msg = NavSatFix()
42 navsat_msg.header = gpsfix_msg.header
46 navsat_msg.status.status = gpsfix_msg.status.status
48 navsat_msg.status.service = 0
49 if gpsfix_msg.status.position_source & GPSStatus.SOURCE_GPS:
50 navsat_msg.status.service = \
51 navsat_msg.status.service | NavSatStatus.SERVICE_GPS
52 if gpsfix_msg.status.orientation_source & GPSStatus.SOURCE_MAGNETIC:
53 navsat_msg.status.service = \
54 navsat_msg.status.service | NavSatStatus.SERVICE_COMPASS
56 navsat_msg.latitude = gpsfix_msg.latitude
57 navsat_msg.longitude = gpsfix_msg.longitude
58 navsat_msg.altitude = gpsfix_msg.altitude
59 navsat_msg.position_covariance = gpsfix_msg.position_covariance
60 navsat_msg.position_covariance_type = gpsfix_msg.position_covariance_type