gauteh/sfy

Kalman + quaternion processing

jerabaul29 opened this issue · 0 comments

The workflow is:

  • the accel and gyro gets measured
  • the AHRS Kalman filter "more or less":
    • keep track internally of the quaternion orientation and uncertainties in it and the measurements
    • uses gyro measurements to integrate in time the orientation quaternion
    • uses the accel measurements, compared with the expected value (on average, in the Earth frame of reference, ie after rotation by the quaternion, should point downwards at 1g), to correct for the orientation drift due to integration
    • this results in a quaternion orientation estimate that is both quick / accurate to react (thanks to integrating the gyro), and should not have drift over long time regarding the position of the vertical (thanks to comparing the average acceleration over some time with the expected gravity acceleration)

The typical output, the orientation quaternion, is a rotation on the unit sphere S3 defined as a quaternion, and is non dimensional. See for some quaternion introduction: https://jerabaul29.github.io/jekyll/update/2021/01/17/Integrating-Quaternions.html and https://jerabaul29.github.io/assets/quaternions/quaternions.pdf .

The tricky thing is what to feed to the Kalman filter (unit convention, orientation / sign orientation), and what rotation is outputed (quaternion that describes the rotation from the chip frame of reference to the Earth frame of reference, or the inverse of it? in practice, this is easy to convert back and forth, as for unit quaternions, q-1 = q*)