Comments (11)
Could you please elaborate more on in what conditions you recorded the data?
Static position, moving, etc.
from ahrs.
I got the same results using the example file in the tests folder.
data = ahrs.utils.io.load("repoIMU.csv")
orientation = ahrs.filters.ekf.EKF(data.gyr, data.acc, data.mag)
q_ekf = orientation.Q
orientation = ahrs.filters.mahony.Mahony(data.gyr, data.acc, data.mag)
q_mahony= orientation.Q
and I get different results after few samples, here you can see the difference in the the different quaternion components
from ahrs.
Hi everyone, what I can see, the initial values might be off.
Quaternions must have a Euclidean norm is equal to 1 (a.k.a. versors) to be used as orientations (or rotation operators).
What I can see is that all initial values are equal to zero, which would give you a norm equal to 0. That is not a valid versor and, therefore, does not represent any orientation.
Even worse, starting with an invalid quaternion would yield a set of invalid orientations, as explained in #11 .
It is recommended to give a valid initial quaternion for algorithms using the gyroscope to integrate the angular rate (Madgwick, Mahony, EKF, etc.) Many use the common quaternion identity [1, 0, 0, 0]
, (whose norm is visibly equal to 1), but you're also welcome to use a static attitude estimator like (Tilt, TRIAD, Davenport's, etc.)
In the meantime, I will try to add some warnings of invalid orientations to save us the future headaches.
from ahrs.
@Mayitzin thanks for the answer. I rechecked the script and effectively I was doing something wrong. The new script gives me these results. I am still using the repoIMU.csv file that you uploaded in the test folder. As you can see now the norm is always 1 but the results are significantly different, especially for the EKF
from ahrs.
There are two points to highlight:
- The negative of a quaternion represents the same orientation. For example, if we have the quaternion
[0.18, 0.37, 0.55, 0.72]
, its inverted quaternion[-0.18, -0.37, -0.55, -0.72]
would represent the exact same orientation. So, if linesq0
,q1
,q2
andq3
flip with respect to another estimation, it is still ok. They are actually the same orientation. - The EKF requires a set of noise variances, which define the certainty of each sensor. By default, they are defined as 0.3^2 for the gyroscopes, 0.5^2 for the accelerometers, and 0.8^2 for the magnetometer. The smaller they are, the more you "trust" the sensor. Try redefining them when you create the class. You can do that by passing a 3-element array to the parameters
noises
:
ekf = EKF(noises=[0.1**2, 0.5**2, 0.8**2]) # Here I set gyroscope to 0.1^2
Unfortunately, there isn't a standard noise variance value for each type of sensor. Those values have to be determined for your own precise model and design. There are certain techniques that would help you to estimate these variances, but that is out of the scope. Here you can try and tweak the noises to see what works for you.
I will directly mention this in the documentation of the EKF (working on it.) Thanks for pointing it out!
from ahrs.
Thanks, I will try to tweak the noises in the EKF filter to get something closer to the others. Since it is the file in the repo, do you have noise values that can be used?
from ahrs.
I've not tested enough with all the values, but I think the noises [0.02**2, 0.5**2, 0.9**2]
work quite well. A Gradient Descent Algorithm could be handy here, if anybody is up for playing a bit further ;)
from ahrs.
hello, I'm trying to figure out how to build graphs and I get an error
1 import ahrs
2 data = loadmat("ExampleData.mat")
----> 3 ahrs.utils.plot_sensors(data.gyr, data.acc, data.mag,
4 x_axis=data.time, subtitles=["Gyroscopes", "Accelerometers", "Magnetometers"])
AttributeError: module 'ahrs.utils' has no attribute 'plot_sensors'
from ahrs.
hello, I'm trying to figure out how to build graphs and I get an error
1 import ahrs 2 data = loadmat("ExampleData.mat")
----> 3 ahrs.utils.plot_sensors(data.gyr, data.acc, data.mag,
4 x_axis=data.time, subtitles=["Gyroscopes", "Accelerometers", "Magnetometers"])AttributeError: module 'ahrs.utils' has no attribute 'plot_sensors'
Which version are you using? The plotting functions are no longer available importing the newest versions.
from ahrs.
from ahrs.
Hi,
sorry for the late reply. As plotting is being removed from the package, I would suggest to use matplotlib for your project. It is the most common plotting package for Python, with plenty of support from the community and even more
resources to create nice visualizations of it.
For a simple visualization of an N-by-3 array with sensor data you would simply do:
import matplotlib.pyplot as plt
plt(data[:, 0], 'r-')
plt(data[:, 1], 'g-')
plt(data[:, 2], 'b-')
plt.show()
which would open a window showing the X-, Y- and Z-axis data with red, green and blue lines, respectively. It is that simple. Further customization can be done with few parameters passed to these functions.
from ahrs.
Related Issues (20)
- Bug in Madgwick filter _compute_all() HOT 2
- Error when intializing FAMC filter without acc or mag samples.
- Math errors in AQUA filter
- Installing from setup.py is deprecated
- performance: probably unnecessary array copies in `_compute_all` method from `EKF` class HOT 1
- Weird behavior in to_DCM and from_DCM in Quaternion class HOT 2
- Madgwick with asynchronous sensors HOT 2
- Incomplete Implementation HOT 1
- Bug in `rpy2q` function
- Mistake in Attitude From Tilt documentation
- Gyro data is not reflected
- updateIMU problem with parameters in AQUA
- Two calculation models leadind to different results
- Heading estimation in tilt.py wrong
- Complementary filter incomplete?
- Errors in Madgwick Orientation Filter HOT 1
- Isn't it required to normalize quaternion estimation in EKF? HOT 2
- EKF update Qt HOT 1
- EKF H matrix HOT 6
- Madgwick Reference Frame HOT 2
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 ahrs.