mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-27 00:48:23 +08:00
Add accel to vehicle_local_position_groundtruth
Related Issue: #18527
According to [this doc](92b1a43468/common/mavlink_msg_hil_state_quaternion.h (L102)), the *acc value are mili-Gee, so multiply the value with `CONSTANT_ONE_G/1000.0f` would get the acceleration in `m/s`.
This commit is contained in:
@@ -562,6 +562,9 @@ void Simulator::handle_message_hil_state_quaternion(const mavlink_message_t *msg
|
||||
hil_lpos.vy = hil_state.vy / 100.0f;
|
||||
hil_lpos.vz = hil_state.vz / 100.0f;
|
||||
matrix::Eulerf euler = matrix::Quatf(hil_attitude.q);
|
||||
hil_lpos.ax = hil_state.xacc * CONSTANTS_ONE_G / 1000.0f;
|
||||
hil_lpos.ay = hil_state.yacc * CONSTANTS_ONE_G / 1000.0f;
|
||||
hil_lpos.az = hil_state.zacc * CONSTANTS_ONE_G / 1000.0f;
|
||||
hil_lpos.heading = euler.psi();
|
||||
hil_lpos.xy_global = true;
|
||||
hil_lpos.z_global = true;
|
||||
|
||||
Reference in New Issue
Block a user