滤波跟踪基于matlab不变扩展卡尔曼滤波器对装有惯性导航系统和全球定位系统IMU+GPS进行滤波跟踪含Matlab源码 2232期

Posted 海神之光

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了滤波跟踪基于matlab不变扩展卡尔曼滤波器对装有惯性导航系统和全球定位系统IMU+GPS进行滤波跟踪含Matlab源码 2232期相关的知识,希望对你有一定的参考价值。

⛄一、简介

针对室内定位中的非视距(Non-Line-of-Sight,NLOS)现象,提出一个新型算法进行识别,同时有效缓解其影响.主要通过超宽带(Ultra-Wideband,UWB)定位系统与惯性导航系统(Inertial Navigation System,INS)的信息修正非视距误差,获得较高的定位精度.首先,在离线阶段获得不同障碍物下的NLOS误差概率分布曲线;其次,利用惯性测量单元(Inertial Measurement Unit,IMU)的预测位置及NLOS误差概率曲线修正测量距离;最后,利用卡尔曼滤波(Kalman Filtering,KF)融合步行者航迹推算(Pedestrian Dead Reckoning,PDR)的INS位置和经过改进最小二乘法(Least Square,LS)处理后UWB定位系统的位置,并更新NLOS误差获得更准确的位置估计.通过仿真和实验证实了提出的定位算法可以有效缓解NLOS误差,提升定位性能,实现在NLOS影响下的高精度定位.

⛄二、部分源代码

clear; close all;
addpath(‘filters’);
addpath(‘helper’);
addpath(‘thirdparty/shadedErrorBar’);

% Load / process data
[T_X, omega, accel, accel_b, T_GPS, XYZ_GPS] = loadPoseGPS();
test_N = length(omega); % Sets the number of IMU readings

meas_used = T_GPS <= t_x(end);
t_gps = T_GPS(meas_used,:);
xyz_gps = XYZ_GPS(meas_used,:);

% -------------------------------------------------------------------------
% Initialize filter

skew = @(u) [0 -u(3) u(2);
u(3) 0 -u(1);
-u(2) u(1) 0];

ekf = EKF();
inekf = LIEKF();

% Get first observation that happens after a prediction
obsid = 1;
while(t_gps(obsid) < t_x(1))
obsid = obsid + 1;
end

for i = 2:test_N
if i == 1
dt = t_x;
else
dt = t_x(i) - t_x(i - 1);

    %Assume gyro/IMU are basically synchronous
    ekf.prediction(w(i,:)',a(i,:)',dt);
    inekf.prediction(w(i,:)',a(i,:)',dt);
    
    
    %Measurement update
    if(i < test_N)
        if(t_gps(obsid) > t_x(i) && t_x(i+1) > t_gps(obsid))
            gps = [xyz_gps(obsid,1); xyz_gps(obsid,2); xyz_gps(obsid,3)];
            ekf.correction(gps);
            inekf.correction(gps);
            obsid = min(obsid + 1, length(t_gps));
        end
  
    
    pos_inekf(:,i) = inekf.mu(1:3,5);
    vars = sqrt(diag(inekf.sigma_cart));
    std_inekf(:,i) = vars(7:9);
    
    if(mod(i,1000)==0)
       fprintf('Iteration: %d/%d\\n',i,test_N); 
    end
end

end

meas_used = T_GPS <= t_x(end);

% load gt
[~, ~, ~, ~, ~, x_gt, ~, y_gt, ~, z_gt] = loadGroundTruthAGL();
x_gt = x_gt - x_gt(1); y_gt = y_gt - y_gt(1); z_gt = z_gt - z_gt(1);
t_gt = linspace(0,T_X(end),length(x_gt));

% -------------------------------------------------------------------------
% traj plot
figure(‘DefaultAxesFontSize’,14)
hold on;
plot3(XYZ_GPS(:,1), XYZ_GPS(:,2), XYZ_GPS(:,3),‘b’,‘LineWidth’, 2);
plot3(x_gt, y_gt, z_gt,‘–k’,‘LineWidth’, 4);
plot3(pos_ekf(1,:), pos_ekf(2,:), pos_ekf(3,:),‘g’,‘LineWidth’, 2);
plot3(pos_inekf(1,:), pos_inekf(2,:), pos_inekf(3,:),‘r’,‘LineWidth’, 2);
legend(‘gps’, ‘gt’, ‘EKF’, ‘InEKF’, ‘location’, ‘southeast’)
hold off;
axis equal;

figure(‘DefaultAxesFontSize’,14)
hold on;
plot3(XYZ_GPS(:,1), XYZ_GPS(:,2), XYZ_GPS(:,3),‘b’,‘LineWidth’, 2);
plot3(x_gt, y_gt, z_gt,‘–k’,‘LineWidth’, 4);
plot3(pos_inekf(1,:), pos_inekf(2,:), pos_inekf(3,:),‘r’,‘LineWidth’, 2);
legend(‘gps’, ‘gt’, ‘InEKF’, ‘location’, ‘southeast’)
hold off;
axis equal;

% -------------------------------------------------------------------------
% axis plot
figure;
subplot(3,1,1);
hold on;
plot(t_gps, XYZ_GPS(meas_used,1), ‘b’, ‘LineWidth’, 1);
plot(t_gt, x_gt, ‘k–’, ‘LineWidth’, 2);
shadedErrorBar(T_X(1:test_N), pos_ekf(1,:), 3std_ekf(1,:), ‘lineProps’, ‘g’, ‘LineWidth’, 1)
shadedErrorBar(T_X(1:test_N), pos_inekf(1,:), 3
std_inekf(1,:), ‘lineProps’, ‘r’, ‘LineWidth’, 1)
legend(‘X_GPS’,‘X_GT’,‘X_EKF’, ‘X_InEKF’, ‘Location’, ‘eastoutside’);
axis([0,T_X(test_N),-200,200])
%
subplot(3,1,2);
hold on;
plot(t_gps, XYZ_GPS(meas_used,2), ‘b’, ‘LineWidth’, 1);
plot(t_gt, y_gt, ‘k–’, ‘LineWidth’, 2);
shadedErrorBar(T_X(1:test_N), pos_ekf(2,:), 3std_ekf(2,:), ‘lineProps’, ‘g’, ‘LineWidth’, 1)
shadedErrorBar(T_X(1:test_N), pos_inekf(2,:), 3
std_inekf(2,:), ‘lineProps’, ‘r’, ‘LineWidth’, 1)
legend(‘Y_GPS’,‘Y_GT’,‘Y_EKF’, ‘Y_InEKF’, ‘Location’, ‘eastoutside’);
axis([0,T_X(test_N),-250,350])
%
subplot(3,1,3);
hold on;
plot(t_gps, XYZ_GPS(meas_used,3), ‘b’, ‘LineWidth’, 1);
plot(t_gt, z_gt, ‘k–’, ‘LineWidth’, 2);
shadedErrorBar(T_X(1:test_N), pos_ekf(3,:), 3std_ekf(3,:), ‘lineProps’, ‘g’, ‘LineWidth’, 1)
shadedErrorBar(T_X(1:test_N), pos_inekf(3,:), 3
std_inekf(3,:), ‘lineProps’, ‘r’, ‘LineWidth’, 1)
legend(‘Z_GPS’,‘Z_GT’,‘Z_EKF’, ‘Z_InEKF’, ‘Location’, ‘eastoutside’);
axis([0,T_X(test_N),-30,60])

function u = unskew(ux)
u(1,1) = -ux(2,3);
u(2,1) = ux(1,3);
u(3,1) = -ux(1,2);
end

function w = Log®
w = unskew(logm®);
end

⛄三、运行结果






⛄四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 周军,魏国亮,田昕,王甘楠,融合UWB和IMU数据的新型室内定位算法[J].小型微型计算机系统. 2021,42(08)

3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除

以上是关于滤波跟踪基于matlab不变扩展卡尔曼滤波器对装有惯性导航系统和全球定位系统IMU+GPS进行滤波跟踪含Matlab源码 2232期的主要内容,如果未能解决你的问题,请参考以下文章

滤波跟踪基于matlab扩展卡尔曼滤波器 (EKF) GPS 数据滤波跟踪含Matlab源码 2316期

滤波跟踪基于matlab扩展卡尔曼滤波的无人机路径跟踪含Matlab源码 2236期

目标跟踪基于扩展卡尔曼滤波实现目标群跟踪matlab源码

目标跟踪基于扩展卡尔曼滤波实现目标群跟踪matlab源码

基于扩展卡尔曼滤波的目标跟踪仿真

滤波跟踪基于matlab拓展卡尔曼滤波EKF的四旋翼无人机姿态估计含Matlab源码 2402期