mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-12-02 22:40:27 +08:00
fix(mavlink): derive unknown HIL_GPS ground speed from velocity (#28906)
Derive missing scalar ground speed from the valid horizontal velocity components instead of publishing the UINT16_MAX sentinel as 655.35 m/s. Assisted-by: Codex Signed-off-by: onelittlechildawa <onelittlechild@outlook.com>
This commit is contained in:
1 parent
0dd882e8a2
commit
320c912f57
2 files changed
+4
-2
No files matched your search
@@ -421,10 +421,11 @@ void SimulatorMavlink::handle_message_hil_gps(const mavlink_message_t *msg)
|
||||
gnss.jamming_state = 0;
|
||||
gnss.spoofing_state = 0;
|
||||
|
||||
gnss.ground_speed = (float)(hil_gps.vel) / 100.0f; // cm/s -> m/s
|
||||
gnss.vel_north = (float)(hil_gps.vn) / 100.0f; // cm/s -> m/s
|
||||
gnss.vel_east = (float)(hil_gps.ve) / 100.0f; // cm/s -> m/s
|
||||
gnss.vel_down = (float)(hil_gps.vd) / 100.0f; // cm/s -> m/s
|
||||
gnss.ground_speed = (hil_gps.vel == UINT16_MAX) ? matrix::Vector2f(gnss.vel_north, gnss.vel_east).norm() :
|
||||
(float)(hil_gps.vel) / 100.0f; // cm/s -> m/s
|
||||
|
||||
gnss.course = ((hil_gps.cog == 65535) ? NAN : matrix::wrap_2pi(math::radians(hil_gps.cog * 1e-2f))); // cdeg -> rad
|
||||
gnss.vel_ned_valid = true;
|
||||
|
||||
Reference in new issue
Block a user