Comments (3)
The acceleration rejection feature is not based on the magnitude of the accelerometer. As stated in the README, the "acceleration rejection works by comparing the instantaneous measurement of inclination provided by the accelerometer with the current measurement of inclination of the algorithm output."
The angle between these two measurements of inclination can be calculated as
θ = arcsin [ |a × b| / (|a| |b|) ]
where a is the Earth's vertical axis indicated by the accelerometer, and b is the Earth's vertical axis indicated by the algorithm output. If vectors a and b are of unit magnitude then the equation simplifies to
θ = arcsin [ |a × b| ]
The normalised accelerometer measurement is a unit vector that can be assumed to describe the Earth's vertical axis and so be substituted for a to get
θ = arcsin [ |FusionVectorNormalise(accelerometer)
× b| ]
The Earth's vertical axis indicated by the algorithm output is equal to the third column of the transposed rotation matrix. The algorithm calculates this scaled by 0.5 on line 117 as halfGravity
. This can be multiplied by 2 and then substituted for b to get
θ = arcsin [ |FusionVectorNormalise(accelerometer)
× 2 halfGravity
| ]
This can be rearranged to
θ = arcsin [ 2 |FusionVectorNormalise(accelerometer)
× halfGravity
| ]
The cross product of FusionVectorNormalise(accelerometer)
and halfGravity
is calculated on line 138 as ahrs->halfAccelerometerFeedback
. The equation can therefore be written as
θ = arcsin [ 2 |ahrs->halfAccelerometerFeedback
| ]
The acceleration rejection feature compares θ with the threshold ahrs->settings.accelerationRejection
. This comparison can be written as
arcsin [ 2 |ahrs->halfAccelerometerFeedback
| ] ≤ ahrs->settings.accelerationRejection
The left hand side of this equation is computationally expensive, and the right hand side is a constant. The equation can be rearranged so that operations are applied to a pre-calculated constant, and so reduce the computational load of the algorithm. The optimised equation is
|ahrs->halfAccelerometerFeedback
|² ≤ ( 0.5 sin [ ahrs->settings.accelerationRejection
] )²
The right hand side is in the form |x|² to avoid the square root operation. The equation can now be re-written as
FusionVectorMagnitudeSquared(ahrs->halfAccelerometerFeedback)
≤ ( 0.5 sin [ ahrs->settings.accelerationRejection
])²
Line 77 overwrites ahrs->settings.accelerationRejection
with a value equal to the left hand side. The equation therefore becomes
FusionVectorMagnitudeSquared(ahrs->halfAccelerometerFeedback)
≤ ahrs->settings.accelerationRejection
This is the comparison implemented on line 141 to determine if the accelerometer should be ignored for a given algorithm update.
A threshold of 10 degrees is recommended for most applications. If you wish to tune this value for your specific application then I suggest you log sensor data representative of both typical motion and edge case scenarios (e.g. extreme motion), and then process this data using advanced_example.py. This script will plot the algorithm outputs, internal states, and flags. An optimal threshold will maximise the amount of time the accelerometer is ignored during motion without triggering an acceleration rejection timeout.
from fusion.
Hi there, follow up on this one. Thanks for the extensive detailing on the mechanics of how accelero rejection works
""acceleration rejection works by comparing the instantaneous measurement of inclination provided by the accelerometer with the current measurement of inclination of the algorithm output.""
So the idea is to reject the accelero measurements when the orientation/inclination outputted by the algorithm, differs to much from the orientation derived from the accelero.
What is the added value of this approach? Because if I understand correctly as soon as there is lots of acceleration or rotation it's likely that the orientation of algo vs accelerometer will be too different, and the accelerometer will get rejected. But this will only contribute to more drift from that point on right, because now we are only relying on the gyroscope while we are already drifted from the accelerometer orientation?
So it's basically impossible to recover from an accelero rejection, except when the rejectiontimeout occurs or when the gyro inclination and accelero inclination coincidentally coincides, which will then start taking the accelero into account again..
Maybe I'm still not getting it completely, but I don't understand this approach from a conceptual point of view as to me it looks like rejecting accelero as soon as the orientation drifts to much only contributes to more drifting.
from fusion.
The acceleration rejection feature provides a demonstrable improvement to accuracy and reliability in a range of real-world applications.
There are several issues with your description. Perhaps you will understand things better if you see the feature in action. I suggest you run the Gait Tracking script with and without the acceleration rejection feature to see the difference in performance. Change the value on line 42 to 0
to disable the feature. You will then see the error increases from 82 mm to 2.5 m. The script also plots the algorithm internal states so you can see how the accelerometer is used or rejected throughout the data.
from fusion.
Related Issues (20)
- Python 3.12 Install Issue HOT 3
- After most recent changes, FusionAhrs.initialising flag never set. HOT 8
- Question: About the details of the Fusion algorithm HOT 2
- Rust bindings HOT 7
- Guidance on tuning Fusion for "responsiveness" HOT 2
- Inferring gyroscope range HOT 3
- Roll and pitch relative to device, yaw relative to earth HOT 2
- Linear/earth acceleration very slow to catch up with movement HOT 3
- TEST data HOT 1
- Python "No code object available for imufusion" with Setup.py or pip install HOT 4
- Measurement convention for sensors other than x-imu HOT 3
- How to use the magnetometer data with different sampling frequency from the inertial sensors? HOT 1
- Gyroscope Offset Algorithm HOT 7
- Link to dissertation is broken HOT 1
- Q: Influence of motion and external acceleration HOT 3
- Very noisy Roll Pitch Yaw data HOT 5
- Recommended sampling rate? HOT 2
- yaw value changes while rotating on only roll or pitch axis. HOT 3
- 5 seconds delay in real-time operation (python) HOT 2
- Need some help setting up the algorithm. HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fusion.