mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 04:03:34 +08:00
gps: use UTC timestamp when GPS fixed (#26127)
This commit is contained in:
@@ -68,7 +68,13 @@ private:
|
|||||||
hrt_abstime now{};
|
hrt_abstime now{};
|
||||||
|
|
||||||
if (_sensor_gps_sub.update(&gps)) {
|
if (_sensor_gps_sub.update(&gps)) {
|
||||||
msg.time_usec = gps.timestamp;
|
if (gps.time_utc_usec > 0) {
|
||||||
|
msg.time_usec = gps.timestamp;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
msg.time_usec = gps.time_utc_usec;
|
||||||
|
}
|
||||||
|
|
||||||
msg.fix_type = gps.fix_type;
|
msg.fix_type = gps.fix_type;
|
||||||
msg.lat = static_cast<int32_t>(round(gps.latitude_deg * 1e7));
|
msg.lat = static_cast<int32_t>(round(gps.latitude_deg * 1e7));
|
||||||
msg.lon = static_cast<int32_t>(round(gps.longitude_deg * 1e7));
|
msg.lon = static_cast<int32_t>(round(gps.longitude_deg * 1e7));
|
||||||
|
|||||||
@@ -68,7 +68,13 @@ private:
|
|||||||
hrt_abstime now{};
|
hrt_abstime now{};
|
||||||
|
|
||||||
if (_sensor_gps_sub.update(&gps)) {
|
if (_sensor_gps_sub.update(&gps)) {
|
||||||
msg.time_usec = gps.timestamp;
|
if (gps.time_utc_usec > 0) {
|
||||||
|
msg.time_usec = gps.timestamp;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
msg.time_usec = gps.time_utc_usec;
|
||||||
|
}
|
||||||
|
|
||||||
msg.fix_type = gps.fix_type;
|
msg.fix_type = gps.fix_type;
|
||||||
msg.lat = static_cast<int32_t>(round(gps.latitude_deg * 1e7));
|
msg.lat = static_cast<int32_t>(round(gps.latitude_deg * 1e7));
|
||||||
msg.lon = static_cast<int32_t>(round(gps.longitude_deg * 1e7));
|
msg.lon = static_cast<int32_t>(round(gps.longitude_deg * 1e7));
|
||||||
|
|||||||
Reference in New Issue
Block a user