Closed mjs513 closed 1 year ago
I expect your magnetometer needs calibrating. I suggest you use FusionAhrsUpdateNoMagnetometer
instead of FusionAhrsUpdate
to see the behaviour without the magnetometer. You may also wish to plot the output of FusionCompassCalculateHeading
for known rotations to see exactly what heading (yaw) measurement your magnetometer is providing.
Thanks for the fast response and will give those suggestions a try and see how it goes. Have to set up a rotation rose on the desk :) Project for tomorrow. Getting late here now. Will let you know how it goes
I expect your magnetometer needs calibrating. I suggest you use
FusionAhrsUpdateNoMagnetometer
instead ofFusionAhrsUpdate
to see the behaviour without the magnetometer. You may also wish to plot the output ofFusionCompassCalculateHeading
for known rotations to see exactly what heading (yaw) measurement your magnetometer is providing.
Took your advice and went back to looking at calibration methods. Found I had one issue with the way I was doing the calibration which I fixed and also switched to using NED coordinates to match what the how the library I am using has the axes aligned.
That seemed to fix a couple of issues I was having (yes I am using a compass rose as well to check yaw and heading). However with that said I am still seing a lag in yaw as shown in the next too figures using the default settings:
const FusionAhrsSettings settings = {
.convention = FusionConventionEnu,
.gain = 0.5f,
.accelerationRejection = 10.0f,
.magneticRejection = 20.0f,
.rejectionTimeout = 5.0f * SAMPLE_RATE, /* 5 seconds */
};
from the figures you can see it took about 12 seconds for yaw to converge.
Now if I change the settings to:
const FusionAhrsSettings settings = {
.convention = FusionConventionNed,
.gain = 1.5f,
.accelerationRejection = 10.0f,
.magneticRejection = 5.0f,
.rejectionTimeout = 5.0f * SAMPLE_RATE, /* 5 seconds */
};
its much improved:
Am I on the right track here. And is there any other guidance on adjusting the settings that you can provide other than what is in the READ.ME?
Your plots are of little use because you have not provided any indication what the actual rotation is. You need to compare your measured rotation with the actual rotation. For example, rotate the device 90° and compare this with the measured rotation.
Your plots are of little use because you have not provided any indication what the actual rotation is. You need to compare your measured rotation with the actual rotation. For example, rotate the device 90° and compare this with the measured rotation.
Note: working on my desk and now looking at it like this still looks off a bit I think. Well back to calibration.
Sorry thought I mentioned that, hope this is what you are talking about
Good luck with calibration. I will now close this issue.
I have been using the Madgwick and Mahoney filters for years and recently have went back to my old stuff to do some more work and found that you updated the filter. So far have done some preliminary testing using the Teensy Propshield from PJRC and a MPU9250 (amazon variety). So far its been working rather well. But with that said I ran into something interesting with the MPU9250 with yaw behavior with the MPU9250: (1) I am seeing yaw going in the opposite direction of movement for a short period of time before coming catching up to the direction of movement and (2) takes a really long time to reach final position after movement.
This is best shown in the following series of charts:
Steady State before rotating sensor:
Rotation started around 7.5 seconds as can be seen in both the gyro chart and the Euler angles (note the chart in the lower left are a plot of all the flags which remain at 0). In the figure you can see the yaw movement delayed and moving up and then down.
Steady state reached in its new position: Seems to take over 20 seconds to get to where its going.
Not sure what is happening.
I am feeding the algorithm precalibrated values accel and mag. Gyro;s are zeroed out before starting the algorithm so again precalibrated. Calibration takes into account only biases and scale factors. I am running at 100hz.
Also I am using the default settings:
Any suggestions would be appreciated.
Here is the whole sketch if you want to see whats going on: