mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 17:43:34 +08:00
commander: accel cal rotate offsets and scales from body frame back into sensor frame before saving (#25626)
- fixes https://github.com/PX4/PX4-Autopilot/issues/25606
This commit is contained in:
@@ -366,17 +366,24 @@ int do_accel_calibration(orb_advert_t *mavlink_log_pub)
|
|||||||
const Matrix3f accel_T = mat_A.I() * CONSTANTS_ONE_G;
|
const Matrix3f accel_T = mat_A.I() * CONSTANTS_ONE_G;
|
||||||
|
|
||||||
// update calibration
|
// update calibration
|
||||||
worker_data.calibration[i].set_offset(offset);
|
const Dcmf &R = worker_data.calibration[i].rotation();
|
||||||
worker_data.calibration[i].set_scale(accel_T.diag());
|
|
||||||
|
const Vector3f sensor_frame_offsets{R.transpose() *offset};
|
||||||
|
const Matrix3f sensor_frame_scale{R.transpose() *accel_T * R};
|
||||||
|
|
||||||
|
worker_data.calibration[i].set_offset(sensor_frame_offsets);
|
||||||
|
worker_data.calibration[i].set_scale(sensor_frame_scale.diag());
|
||||||
|
|
||||||
#if defined(DEBUD_BUILD)
|
#if defined(DEBUD_BUILD)
|
||||||
PX4_INFO("accel %d: offset", i);
|
PX4_INFO("accel %d: offset", i);
|
||||||
offset.print();
|
sensor_frame_offsets.print();
|
||||||
|
|
||||||
PX4_INFO("accel %d: mat_A", i);
|
PX4_INFO("accel %d: mat_A", i);
|
||||||
mat_A.print();
|
mat_A.print();
|
||||||
PX4_INFO("accel %d: accel_T", i);
|
PX4_INFO("accel %d: accel_T", i);
|
||||||
accel_T.print();
|
accel_T.print();
|
||||||
|
PX4_INFO("accel %d: scale matrix", i);
|
||||||
|
sensor_frame_scale.print();
|
||||||
#endif // DEBUD_BUILD
|
#endif // DEBUD_BUILD
|
||||||
worker_data.calibration[i].PrintStatus();
|
worker_data.calibration[i].PrintStatus();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user