mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 04:13:34 +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:
@@ -101,18 +101,15 @@ int px4_simple_app_main(int argc, char *argv[])
|
||||
struct sensor_combined_s raw;
|
||||
/* copy sensors raw data into local buffer */
|
||||
orb_copy(ORB_ID(sensor_combined), sensor_sub_fd, &raw);
|
||||
float sensor_accel[3];
|
||||
float accel_dt = raw.accelerometer_integral_dt / 1.e6f;
|
||||
sensor_accel[0] = raw.accelerometer_integral_m_s[0] / accel_dt;
|
||||
sensor_accel[1] = raw.accelerometer_integral_m_s[1] / accel_dt;
|
||||
sensor_accel[2] = raw.accelerometer_integral_m_s[2] / accel_dt;
|
||||
PX4_WARN("[px4_simple_app] Accelerometer:\t%8.4f\t%8.4f\t%8.4f",
|
||||
(double)sensor_accel[0], (double)sensor_accel[1], (double)sensor_accel[2]);
|
||||
(double)raw.accelerometer_m_s2[0],
|
||||
(double)raw.accelerometer_m_s2[1],
|
||||
(double)raw.accelerometer_m_s2[2]);
|
||||
|
||||
/* set att and publish this information for other apps */
|
||||
att.roll = sensor_accel[0];
|
||||
att.pitch = sensor_accel[1];
|
||||
att.yaw = sensor_accel[2];
|
||||
att.roll = raw.accelerometer_m_s2[0];
|
||||
att.pitch = raw.accelerometer_m_s2[1];
|
||||
att.yaw = raw.accelerometer_m_s2[2];
|
||||
orb_publish(ORB_ID(vehicle_attitude), att_pub, &att);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user