Skip to content

Commit

Permalink
#109 Use GPS_RAW_INT to report lat, lon, alt, and time
Browse files Browse the repository at this point in the history
  • Loading branch information
envirover committed Apr 14, 2021
1 parent 339f3f5 commit 1b5c434
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions UVHub/src/main/java/com/envirover/uvhub/StateCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand Down

0 comments on commit 1b5c434

Please sign in to comment.