mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-13 21:41:35 +08:00
sensor_combined: replace accel & gyro integral with value, use float for dt
Reason: the value is easier to read & handle (for example plotting). In most places the value is needed, not the integral. Note that this breaks the replay format for sdlog2 replay
This commit is contained in:
@@ -1673,22 +1673,22 @@ MavlinkReceiver::handle_message_hil_sensor(mavlink_message_t *msg)
|
||||
{
|
||||
struct sensor_combined_s hil_sensors = {};
|
||||
|
||||
hil_sensors.gyro_integral_rad[0] = 0.5f * (imu.xgyro + _hil_prev_gyro[0]) * dt;
|
||||
hil_sensors.gyro_integral_rad[1] = 0.5f * (imu.ygyro + _hil_prev_gyro[1]) * dt;
|
||||
hil_sensors.gyro_integral_rad[2] = 0.5f * (imu.zgyro + _hil_prev_gyro[2]) * dt;
|
||||
hil_sensors.gyro_rad[0] = 0.5f * (imu.xgyro + _hil_prev_gyro[0]);
|
||||
hil_sensors.gyro_rad[1] = 0.5f * (imu.ygyro + _hil_prev_gyro[1]);
|
||||
hil_sensors.gyro_rad[2] = 0.5f * (imu.zgyro + _hil_prev_gyro[2]);
|
||||
_hil_prev_gyro[0] = imu.xgyro;
|
||||
_hil_prev_gyro[1] = imu.ygyro;
|
||||
_hil_prev_gyro[2] = imu.zgyro;
|
||||
hil_sensors.gyro_integral_dt = dt * 1e6f;
|
||||
hil_sensors.gyro_integral_dt = dt;
|
||||
hil_sensors.timestamp = timestamp;
|
||||
|
||||
hil_sensors.accelerometer_integral_m_s[0] = 0.5f * (imu.xacc + _hil_prev_accel[0]) * dt;
|
||||
hil_sensors.accelerometer_integral_m_s[1] = 0.5f * (imu.yacc + _hil_prev_accel[1]) * dt;
|
||||
hil_sensors.accelerometer_integral_m_s[2] = 0.5f * (imu.zacc + _hil_prev_accel[2]) * dt;
|
||||
hil_sensors.accelerometer_m_s2[0] = 0.5f * (imu.xacc + _hil_prev_accel[0]);
|
||||
hil_sensors.accelerometer_m_s2[1] = 0.5f * (imu.yacc + _hil_prev_accel[1]);
|
||||
hil_sensors.accelerometer_m_s2[2] = 0.5f * (imu.zacc + _hil_prev_accel[2]);
|
||||
_hil_prev_accel[0] = imu.xacc;
|
||||
_hil_prev_accel[1] = imu.yacc;
|
||||
_hil_prev_accel[2] = imu.zacc;
|
||||
hil_sensors.accelerometer_integral_dt = dt * 1e6f;
|
||||
hil_sensors.accelerometer_integral_dt = dt;
|
||||
hil_sensors.accelerometer_timestamp_relative = 0;
|
||||
|
||||
hil_sensors.magnetometer_ga[0] = imu.xmag;
|
||||
|
||||
Reference in New Issue
Block a user