insAccelerometer Documentation h(x)
50 次查看(过去 30 天)
显示 更早的评论
I am currently working on building an Extended Kalman Filter with Accelerometer measurements and looked into the implementation of the h(x) measurement equation.
In the documentation and in the file this equation is, when estimating the acceleration in the state, h(x)=g_sensor+a_sensor+bias which is equal to h(x)=bias+R_sensor->navigation*(g_navigation+a_navigation). However, in the actual implementation of the measurement(sensor, filt) function h(x) appears to be calculated by h(x)=bias-R_sensor->navigation*(a_navigation - g_navigation).
Does anynone know why the actual implementation seems to be different to the documented equation?
Thanks in advance!
4 个评论
William Rose
2025-11-21,6:11
When I click the link you provided, I get redirected to this address. I assume that is because I am in the USA. The web page includes the following (screenshot)

The equation which I have labelled "eq.1" matches what you posted, where you use "bias" and the web page uses "Δ".
You say that eq.1 is equal to
h(x)=bias+R_sensor->navigation*(g_navigation+a_navigation) eq.2
I do not understand eq.2 as you have written it. It looks like C++ code for accessing parts of a structure. Matlab would use
h(x)=bias+R_sensor.navigation*(g_navigation+a_navigation) eq.3
which would equal eq.1, if R_sensor.navigation equals 1. Am I mis-understanding something here?
You say:
the actual implementation of the measurement(sensor, filt) function h(x) appears to be calculated by
h(x)=bias-R_sensor->navigation*(a_navigation - g_navigation) eq.4
and you say
I read the implementation in function z = measurement(sensor, filt)
Please help me find the code that has eq.4. The only code I can find which contains "z=measurement(sensor,filt)" is the example file ...MATLAB\Examples\R2024a\shared_positioning\CustomizeSensorModelUsedWithInsEKFExample\BiasSensor.m. This file includes the following, which does not have an equation similar to eq.4:
classdef BiasSensor < positioning.INSSensorModel
%BIASSENSOR Sensor measuring velocity with bias
% Copyright 2021 The MathWorks, Inc.
methods
% some lines deleted
function z = measurement(sensor,filter)
% Measurement is the summation of the velocity measurement and
% the bias.
velocity = stateparts(filter,'Velocity');
bias = stateparts(filter,sensor,'Bias');
z = velocity + bias;
end
% some lines deleted
end
end
If you help others locate the code you are talking about, maybe someone on this site will be able to assist.
回答(1 个)
Paul
2025-11-21,22:26
My take on this ...
The equations in the code make sense assuming (1) the accelNav vector, which I assume (2) is a filter state estimate, is the inertial acceleration of the object. I assume (3) the accelerometer measurement input to the insEKF should be specific force, so the predicted measurement, z, should subtract the gravity vector from the state estimate, and then resolve the difference into the body-fixed coordinate frame.
One test would be to assume the body is in free fall while aligned with the insEKF reference frame and see what the insEKF estimates for acceleration.
accel = insAccelerometer;
gyro = insGyroscope;
filt = insEKF(accel,gyro,insMotionPose)
filt.stateinfo
filt.AdditiveProcessNoise = blkdiag(zeros(13),10*eye(3),zeros(6));
dt = 0.01; N = 10;
for ii = 1:N
if ii ~= 1
predict(filt,dt);
end
fuse(filt,accel,[0,0,0],1e-4);
accest(ii,:) = stateparts(filt,"Acceleration");
end
figure
plot((0:N-1)*dt,accest,'-o'),yline(9.81)
The insEKF estimates 9.8 m/sec^2 in the +Z direction of the reference frame, which is Down in this case, which is the inertial acceleration of the body in free fall.
This type of approach can be repeated with different orientations of the body to verify that the orientation state defines the orientation of the body frame relative to the reference frame and to verify that the acceleration state estimate is, in fact, resolved in the reference frame (not the body frame, which would make no sense at all IMO).
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
