mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 04:13:33 +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:
+12
-14
@@ -1551,12 +1551,12 @@ int sdlog2_thread_main(int argc, char *argv[])
|
||||
log_msg.body.log_RPL1.accelerometer_integral_dt = buf.replay.accelerometer_integral_dt;
|
||||
log_msg.body.log_RPL1.magnetometer_timestamp = buf.replay.magnetometer_timestamp;
|
||||
log_msg.body.log_RPL1.baro_timestamp = buf.replay.baro_timestamp;
|
||||
log_msg.body.log_RPL1.gyro_integral_x_rad = buf.replay.gyro_integral_rad[0];
|
||||
log_msg.body.log_RPL1.gyro_integral_y_rad = buf.replay.gyro_integral_rad[1];
|
||||
log_msg.body.log_RPL1.gyro_integral_z_rad = buf.replay.gyro_integral_rad[2];
|
||||
log_msg.body.log_RPL1.accelerometer_integral_x_m_s = buf.replay.accelerometer_integral_m_s[0];
|
||||
log_msg.body.log_RPL1.accelerometer_integral_y_m_s = buf.replay.accelerometer_integral_m_s[1];
|
||||
log_msg.body.log_RPL1.accelerometer_integral_z_m_s = buf.replay.accelerometer_integral_m_s[2];
|
||||
log_msg.body.log_RPL1.gyro_x_rad = buf.replay.gyro_rad[0];
|
||||
log_msg.body.log_RPL1.gyro_y_rad = buf.replay.gyro_rad[1];
|
||||
log_msg.body.log_RPL1.gyro_z_rad = buf.replay.gyro_rad[2];
|
||||
log_msg.body.log_RPL1.accelerometer_x_m_s2 = buf.replay.accelerometer_m_s2[0];
|
||||
log_msg.body.log_RPL1.accelerometer_y_m_s2 = buf.replay.accelerometer_m_s2[1];
|
||||
log_msg.body.log_RPL1.accelerometer_z_m_s2 = buf.replay.accelerometer_m_s2[2];
|
||||
log_msg.body.log_RPL1.magnetometer_x_ga = buf.replay.magnetometer_ga[0];
|
||||
log_msg.body.log_RPL1.magnetometer_y_ga = buf.replay.magnetometer_ga[1];
|
||||
log_msg.body.log_RPL1.magnetometer_z_ga = buf.replay.magnetometer_ga[2];
|
||||
@@ -1660,14 +1660,12 @@ int sdlog2_thread_main(int argc, char *argv[])
|
||||
if (write_IMU) {
|
||||
log_msg.msg_type = LOG_IMU_MSG;
|
||||
|
||||
float gyro_dt = buf.sensor.gyro_integral_dt / 1.e6f;
|
||||
log_msg.body.log_IMU.gyro_x = buf.sensor.gyro_integral_rad[0] / gyro_dt;
|
||||
log_msg.body.log_IMU.gyro_y = buf.sensor.gyro_integral_rad[1] / gyro_dt;
|
||||
log_msg.body.log_IMU.gyro_z = buf.sensor.gyro_integral_rad[2] / gyro_dt;
|
||||
float accel_dt = buf.sensor.accelerometer_integral_dt / 1.e6f;
|
||||
log_msg.body.log_IMU.acc_x = buf.sensor.accelerometer_integral_m_s[0] / accel_dt;
|
||||
log_msg.body.log_IMU.acc_y = buf.sensor.accelerometer_integral_m_s[1] / accel_dt;
|
||||
log_msg.body.log_IMU.acc_z = buf.sensor.accelerometer_integral_m_s[2] / accel_dt;
|
||||
log_msg.body.log_IMU.gyro_x = buf.sensor.gyro_rad[0];
|
||||
log_msg.body.log_IMU.gyro_y = buf.sensor.gyro_rad[1];
|
||||
log_msg.body.log_IMU.gyro_z = buf.sensor.gyro_rad[2];
|
||||
log_msg.body.log_IMU.acc_x = buf.sensor.accelerometer_m_s2[0];
|
||||
log_msg.body.log_IMU.acc_y = buf.sensor.accelerometer_m_s2[1];
|
||||
log_msg.body.log_IMU.acc_z = buf.sensor.accelerometer_m_s2[2];
|
||||
log_msg.body.log_IMU.mag_x = buf.sensor.magnetometer_ga[0];
|
||||
log_msg.body.log_IMU.mag_y = buf.sensor.magnetometer_ga[1];
|
||||
log_msg.body.log_IMU.mag_z = buf.sensor.magnetometer_ga[2];
|
||||
|
||||
@@ -520,16 +520,16 @@ struct log_EST5_s {
|
||||
#define LOG_RPL1_MSG 51
|
||||
struct log_RPL1_s {
|
||||
uint64_t time_ref;
|
||||
uint64_t gyro_integral_dt;
|
||||
uint64_t accelerometer_integral_dt;
|
||||
float gyro_integral_dt;
|
||||
float accelerometer_integral_dt;
|
||||
uint64_t magnetometer_timestamp;
|
||||
uint64_t baro_timestamp;
|
||||
float gyro_integral_x_rad;
|
||||
float gyro_integral_y_rad;
|
||||
float gyro_integral_z_rad;
|
||||
float accelerometer_integral_x_m_s;
|
||||
float accelerometer_integral_y_m_s;
|
||||
float accelerometer_integral_z_m_s;
|
||||
float gyro_x_rad;
|
||||
float gyro_y_rad;
|
||||
float gyro_z_rad;
|
||||
float accelerometer_x_m_s2;
|
||||
float accelerometer_y_m_s2;
|
||||
float accelerometer_z_m_s2;
|
||||
float magnetometer_x_ga;
|
||||
float magnetometer_y_ga;
|
||||
float magnetometer_z_ga;
|
||||
|
||||
Reference in New Issue
Block a user