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

19 views (last 30 days)
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);
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?

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.
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!