|
M5Unit-IMU 0.0.2 git rev:e5b00aa
|
Angle-based first-order complementary filter. More...
#include <complementary.hpp>
Public Member Functions | |
| virtual void | reset () override |
| Reset the internal attitude estimate (and any filter state) to identity. | |
| virtual void | update (const float dt, const float accel[3], const float gyro[3], const float *mag) override |
| Fuse one IMU sample into the attitude estimate. | |
| virtual void | quaternion (float &w, float &x, float &y, float &z) const override |
| Current fused attitude. | |
| bool | writeAlpha (const float alpha) |
| Set the complementary blend factor. | |
| float | readAlpha () const |
| Current complementary blend factor. | |
Angle-based first-order complementary filter.
Blends the gyro-integrated angle with a reference angle independently for roll, pitch and yaw: angle = alpha * (angle + gyro * dt) + (1 - alpha) * angle_ref. Roll/pitch reference angles come from the accelerometer; the yaw reference comes from a tilt-compensated magnetometer heading when a magnetometer sample is supplied (pure gyro integration otherwise). See filter_base.hpp for the unit and coordinate convention this filter assumes.
|
overridevirtual |
Current fused attitude.
| [out] | w | Quaternion scalar part |
| [out] | x | Quaternion vector part X |
| [out] | y | Quaternion vector part Y |
| [out] | z | Quaternion vector part Z |
Implements m5::imu::AhrsFilterBase.
|
overridevirtual |
Reset the internal attitude estimate (and any filter state) to identity.
Implements m5::imu::AhrsFilterBase.
|
overridevirtual |
Fuse one IMU sample into the attitude estimate.
| dt | Time elapsed since the previous update(), in seconds |
| accel | Accelerometer reading (G), body frame, X/Y/Z |
| gyro | Gyroscope reading (dps), body frame, X/Y/Z |
| mag | Magnetometer reading (uT), body frame, X/Y/Z; pass nullptr for 6-axis (accel+gyro only) operation |
Implements m5::imu::AhrsFilterBase.
| bool m5::imu::ComplementaryFilter::writeAlpha | ( | const float | alpha | ) |
Set the complementary blend factor.
| alpha | Weight given to the gyro-integrated angle, must be in the open interval (0, 1) |