Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorporate AHRS acc2q into zscilib as zsl_quat_from_accel
Currently, the zscilib's Madgwick orientation filter starts with an orientation of <1, 0, 0, 0> regardless of the physical IMU's orientation. The filter then begins the slow/painful process of converging to the correct orientation which can take literally minutes. For an IMU running at 120Hz, the worst-case Madgwick convergence time is about 47 seconds (β * Dt = 0.033 * 1/120Hz). This is far too long for a warm-up; a Madgwick filter that has not yet converged will output spurious and confusing orientations and result in a bad user experience. A python implementation of Magwick, called AHRS, solves this bootstrapping problem with a non-iterative algorithm called acc2q (acceleration => quat) AHRS Implementation: https://github.com/Mayitzin/ahrs/blob/595ab9877c77f5960e39b352c0ef551d2d2efcb9/ahrs/common/orientation.py#L970 Reference: ([Trimpe et al] https://idsc.ethz.ch/content/dam/ethz/special-interest/mavt/dynamic-systems-n-control/idsc-dam/Research_DAndrea/Balancing%20Cube/ICRA10_1597_web.pdf This algorithm that relies only on the current accelerometer sample. The integration of the acc2q algorithm is highlighted in the below flow diagram (dotted red block). https://github.com/user-attachments/assets/6a32fe55-2233-4b40-bec4-85e4af0750a3 Computing q0 and feeing this into Madgwick results in a very reasonable q0 orientation and a much better overall experience. Signed-off-by: Ismail Degani <deganii@gmail.com>
- Loading branch information