How to use MATLAB's inertial navigation extended Kalman filter (insEKF) for pose estimation with accel and gyro data as inputs?

22 views (last 30 days)
Hello,
I want to estimate pose (position and orientation) from accel and gyro data. For this, I have used the insfilterMARG and called, in a loop, for each new accel and gyro sample pair the predict function: predict(insFilter,accelReadings,gyroReadings). This works reasonably well, but the insfilterMARG state vector contains a number of states I don't need (essentially all magnetometer related states). More importantly, as far as I can see, the insfilterMARG provides only a correct function that allows state correction with direct state measurements: correct(FUSE,idx,measurement,measurementCovariance). The insEKF by contrast, provides a fuse() function that would allow me to fuse signals that are not direct state measurements. However, I have a hard time understanding how to use insEKF. So far, I initialized the insEKF as shown in the code snippet below and in a loop I call the predict and fuse methods
accelSensor = insAccelerometer;
gyroSensor = insGyroscope;
motionModel = insMotionPose;
insFilter = insEKF(accelSensor, gyroSensor, motionModel);
for i=1:N
predict(insFilter,Ts); % Ts sample time
fuse(insFilter, accelSensor, accelReadings, someMeasurementNoiseAccel);
fuse(insFilter, gyroSensor, gyroReadings, someMeasurementNoiseGyro);
end
Finally, with stateparts I read out the state components I am interested in. However, the estimated position trajectory (and orientation) do not match at all the insfilterMARG (nor the ground truth shape).
What is the function call sequence to obtain comparable results with the insEKF as with the insfilterMARG?
Thanks!
  1 Comment
Marek Coufal
Marek Coufal on 19 Mar 2024
Hello,
did you manage to get any acceptable outcome using the insEKF function? I am having pretty simillar problem using insEKF for fusing gyro, accel and magnetometer data from ADIS16505 (midrange 6DoF IMU) and LSM303 magnetometer. The trajectory estimates do not match the ground truth at all, and are two orders of magnitude bigger (altough I checked, that I am using correctly scaled data, i.e acceleration of not moving object in z direction is 9.81ms-2.
Thanks.

Sign in to comment.

Answers (1)

Brian Fanous
Brian Fanous on 14 Sep 2022
Edited: Brian Fanous on 14 Sep 2022
Generally speaking, if you have only typical MEMs gyroscope and accelerometer you will not be able to get a high quality position estimate. The bias in these sensors, even after calibration, will adversely affect your position estimate. For a high quality position estimate you'll need to add another sensor - like a GPS.
If you only want orientation and have a gyroscope and accelerometer, the imufilter is a lot easier to start off with. Alternatively, you can estimate just orientation and angular velocity accurately with an insEKF by using the insMotionOrientation motion model instead of the insMotionPose motion model.
  3 Comments
Effesian
Effesian on 17 Sep 2022
By the way, in the MathWorks documentation for the insMotionPose, the alogirthm section states: "The insMotionPose object models the orientation-only motion of platforms." --> That does not seem correct, since pose is both position and orientation.
Brian Fanous
Brian Fanous on 19 Sep 2022
I will try to get the documentation for insMotionPose updated but in short....
insMotionPose is for orientation and position
insMotionOrientation is for orientation only.
Yes, the insEKF is intended to be a configurable inertial navigation filter. It is a continuous-discrete EKF. The insfilterMARG is a discrete-discrete EKF so they underlying filter is slightly different.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!