Skip to content

Commit 148fb8d

Browse files
committed
DroneCAN: add navsat publisher
- Correct latitude_deg_1e8 and populate height_msl_mm. - Note: missing geoid calculation. Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
1 parent 8ee3c3d commit 148fb8d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/dronecan_sensor.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,17 @@ def uavcan_equipment_gnss_fix2(self):
222222
nsec = gz_msg.header.stamp.nsec
223223
usec = int(1000000 * sec + nsec / 1000)
224224

225-
lat_deg = gz_msg.longitude_deg
225+
lat_deg = gz_msg.latitude_deg
226226
lon_deg = gz_msg.longitude_deg
227227
alt_wgs84_m = gz_msg.altitude
228228
vel_e = gz_msg.velocity_east
229229
vel_n = gz_msg.velocity_north
230230
vel_u = gz_msg.velocity_up
231231

232+
# TODO: look up the geoid height and adjust
233+
geoid_m = 0
234+
alt_msl_m = alt_wgs84_m + geoid_m
235+
232236
# TODO: need a conversion from height_ellipsoid_mm to height_msl_mm
233237

234238
# TODO: consolidate conversions - perhaps use a @dataclass to collect
@@ -252,7 +256,7 @@ class NatSatAuxData:
252256
msg.longitude_deg_1e8 = int(lon_deg * 1e8)
253257
msg.latitude_deg_1e8 = int(lat_deg * 1e8)
254258
msg.height_ellipsoid_mm = int(alt_wgs84_m * 1e3)
255-
msg.height_msl_mm = 0
259+
msg.height_msl_mm = int(alt_msl_m * 1e3)
256260
msg.ned_velocity = [vel_n, vel_e, vel_u * -1.0]
257261
msg.sats_used = 0
258262
msg.status = msg.STATUS_3D_FIX

0 commit comments

Comments
 (0)