No usable results when using insEKF() instead of imufilter()

1 view (last 30 days)
Part of what I want to do is fuse gyroscope and accelerometer data to get an orientation estimate. When I fuse the data using the imufilter() I get results looking very similar to what I am expecting, without majorly tweaking the noise settings and so on.
I then proceeded to try to fuse it using the insEKF() because I eventually also need to fuse GPS measurements. For the first part I only added the gyroscope and the accelerometer to see the orientation estimate. I coded it very similar to the example in the documentation but for some reason the estimated orientation just start spinning and jumping around "uncontrollably".
Heres part of how Ive implemented it:
I also tried tuning it using the data I got from the other filter but that not seems like the issue. Also fusing the data sequentially using fuse() didnt change anything.
...
gyrofix=[gyro(:,2) gyro(:,3) gyro(:,1)]; %data already in workspace
acclfix=[-accl(:,2) -accl(:,3) -accl(:,1)];
option = insOptions(ReferenceFrame="ENU");
insAccel=insAccelerometer;
insGyro=insGyroscope;
tt_meas=timetable(acclfix,gyrofix,'RowTimes', seconds(0:0.01:(size(acclfix,1)/100)-0.01))
tt_meas.Properties.VariableNames={'Accelerometer' 'Gyroscope'}
tt_meas.Accelerometer(:,:)=0;
filt = insEKF(insAccel, insGyro, option);
initOrient=quaternion(1, 0, 0, 0);
stateparts(filt,"Orientation",compact(initOrient));
statecovparts(filt,"Orientation",0.01);
mnoise=tunernoise(filt);
mnoise.AccelerometerNoise=0.0002;
mnoise.GyroscopeNoise=9e-5;
untunedEst = estimateStates(filt,tt_meas,mnoise);
  8 Comments
Paul
Paul on 24 Jul 2024
Hi Christian,
Have you made any progress on this problem, with either imufilter or insEKF, with the data posted in sensor_measurments.mat?
Christian
Christian on 25 Jul 2024
Hello,
sorry for the late anwer.
tunernoise() of the insEKF object actually doenst have any ProcessNoise or MeasurementNoise property, so that didnt fix the problem.
I ended up using the insfilterAsync which worked without major changes made to the example stated in the documentation (not feeding in any magnetometer readings). The results from this are like I expected them. Im still unsure why its not working with the insEKF though.

Sign in to comment.

Answers (1)

Brian Fanous
Brian Fanous on 16 Jul 2024
Christian, do you have a ground truth recorded? Meaning, do you have logged data of what you want the filter output to look like? If so, you can try the tune() method on the insEKF to optimize the noise parameters. (You'll still have to handle initializing the filter states correctly).
If you are happy with the results from the imufilter, you could use that as your ground truth orientation. Be aware though that you'll be tuning the insEKF to also match the noise in the output of the imufilter in that case.
  2 Comments
Paul
Paul on 16 Jul 2024
Do you know why the properties of imufilter indicates that the units are rad, rad/sec, and m/sec^2, but the Algorithms section states the units are deg, deg/sec, and g?
Christian
Christian on 25 Jul 2024
I did try using the orientation from the imufilter to tune the insEKF which only tracks the orientation but couldnt get it to work.
Like stated in another comment I ended up using the insfilterAsync which worked without major changes made to the example stated in the documentation (not feeding in any magnetometer readings).
Thanks for your help though.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!