File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -366,17 +366,24 @@ int do_accel_calibration(orb_advert_t *mavlink_log_pub)
366366 const Matrix3f accel_T = mat_A.I () * CONSTANTS_ONE_G;
367367
368368 // update calibration
369- worker_data.calibration [i].set_offset (offset);
370- worker_data.calibration [i].set_scale (accel_T.diag ());
369+ const Dcmf &R = worker_data.calibration [i].rotation ();
370+
371+ const Vector3f sensor_frame_offsets{R.transpose () *offset};
372+ const Matrix3f sensor_frame_scale{R.transpose () *accel_T * R};
373+
374+ worker_data.calibration [i].set_offset (sensor_frame_offsets);
375+ worker_data.calibration [i].set_scale (sensor_frame_scale.diag ());
371376
372377#if defined(DEBUD_BUILD)
373378 PX4_INFO (" accel %d: offset" , i);
374- offset .print ();
379+ sensor_frame_offsets .print ();
375380
376381 PX4_INFO (" accel %d: mat_A" , i);
377382 mat_A.print ();
378383 PX4_INFO (" accel %d: accel_T" , i);
379384 accel_T.print ();
385+ PX4_INFO (" accel %d: scale matrix" , i);
386+ sensor_frame_scale.print ();
380387#endif // DEBUD_BUILD
381388 worker_data.calibration [i].PrintStatus ();
382389
You can’t perform that action at this time.
0 commit comments