From 1b5c434476ec46015c65f3a0f69c934a34b323df Mon Sep 17 00:00:00 2001 From: Pavel Bobov Date: Tue, 13 Apr 2021 21:24:16 -0700 Subject: [PATCH] #109 Use GPS_RAW_INT to report lat, lon, alt, and time --- UVHub/src/main/java/com/envirover/uvhub/StateCodec.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/UVHub/src/main/java/com/envirover/uvhub/StateCodec.java b/UVHub/src/main/java/com/envirover/uvhub/StateCodec.java index 62d1586..81412f3 100644 --- a/UVHub/src/main/java/com/envirover/uvhub/StateCodec.java +++ b/UVHub/src/main/java/com/envirover/uvhub/StateCodec.java @@ -90,12 +90,11 @@ private static MAVLinkMessage getSysStatusMsg(msg_high_latency2 state) { private static MAVLinkMessage getGpsRawIntMsg(msg_high_latency2 state) { msg_gps_raw_int msg = new msg_gps_raw_int(); msg.sysid = state.sysid; + msg.time_usec = state.timestamp * 1000; msg.lat = state.latitude; msg.lon = state.longitude; msg.alt = state.altitude * 1000; - //msg.eph = state.eph; - //msg.epv = state.epv; - //msg.satellites_visible = 4; + msg.vel = state.groundspeed / 5 * 100; msg.fix_type = GPS_FIX_TYPE.GPS_FIX_TYPE_3D_FIX; return msg; } @@ -119,11 +118,11 @@ private static MAVLinkMessage getGlobalPositionIntMsg(msg_high_latency2 state) { msg_global_position_int msg = new msg_global_position_int(); msg.sysid = state.sysid; msg.time_boot_ms = state.timestamp; - msg.alt = state.altitude * 1000; + msg.alt = state.target_altitude * 1000; + msg.relative_alt = state.target_altitude * 1000; msg.lat = state.latitude; msg.lon = state.longitude; msg.hdg = state.heading; - msg.relative_alt = state.target_altitude * 1000; return msg; }