卡尔曼滤波算法_GPS定位笔记3 (卡尔曼滤波定位算法)
之前的笔记介绍了传统的最小二乘解法和DOP的概念,这一节介绍卡尔曼滤波的定位解法。需要的先修基础知识: 卡尔曼滤波原理,尤其是拓展卡尔曼滤波(EKF)
卡尔曼滤波回顾与复习
一个线性卡尔曼滤波的例子
考虑以下一个系统模型
对照卡尔曼滤波模型,这里A=1, B=0和 C=1。 假定系统状态初始估计值
解 由于只需要计算状态均方误差值,所以在每一个历元(比如第k个)的卡尔曼滤波递推过程中只涉及一下三个公式:
将
GPS定位的卡尔曼滤波算法
这一节运用卡尔曼滤波算法来求解GPS位置,速度和时间(PVT).
卡尔曼滤波和之前介绍的最小二乘法的主要区别在于:前者利用状态方程将不同时刻的状态联系起来,而后者却是孤立的求解每一个不同时刻的系统状态。除此之外,GPS的卡尔曼滤波测量方程与最小二乘法中的GPS定位,定速方程事实上没有区别。
接收机时钟模型
接收机时钟偏差是用于GPS定位的各个卫星伪距测量值的公共误差部分,而接收机时钟频飘移是用GPS定速的各个卫星多普勒频移测量值的公共误差部分。因为接收机的钟差与频飘之间是一个简单的积分关系,所以他们两者经常一起作为卡尔曼滤波的系统状态量。
下图所示为一种相当自然的接收机时钟模型,它的两个状态变量为接收机种差
其中,状态向量为
例
试将上图中的接收机时钟模型所对应的状态空间微分方程式6.117转换离散的卡尔曼滤波状态方程。随后,假定接收机钟差噪声
解 套用6.4.1节中的相关公式来求解系统状态方程及其过程噪声协方差
因为模型中各个相关的矩阵均为常数矩阵,所以过程噪声
事实上,这个例子说解得的接收机时钟模型状态方程式经常出现于各个参考文献。
用户运动模型
不同特点的用户运动形式可用不同的状态方程模型来描述。对于静态接收机而言,他的运动速度为0,所以由用户位置的三个坐标量
常系数状态转移矩阵:
过程噪声向量
而A中的子矩阵
对于行人,汽车,舰船等低动态的载体而言,它们的接收机运行情况一般可用八个状态量来描述,既三个位置分量
常系数状态转移矩阵为
其速度过程噪声与钟差模型类似为:
实战
给定实时卫星伪距和卫星坐标,用最小二乘和卡尔曼滤波进行位置估计。
这套代码来自于The Kalman Filter 教程最后一章,提供完成的下载。注意他的状态量排序和之前讲的不一样,他的状态量排序为:
% State vector is as [x Vx y Vy z Vz b d].', i.e. the coordinate (x,y,z),
% the clock bias b, and their derivatives.
贴出完整代码:
% Example:
% Kalman filter for GPS positioning
% This file provide an example of using the Extended_KF function with the
% the application of GPS navigation. The pseudorange and satellite position
% of a GPS receiver at fixed location for a period of 25 seconds is
% provided. Least squares and Extended KF are used for this task.
%
% The following is a brief illustration of the principles of GPS. For more
% information see reference [2].
% The Global Positioning System(GPS) is a satellite-based navigation system
% that provides a user with proper equipment access to positioning
% information. The most commonly used approaches for GPS positioning are
% the Iterative Least Square(ILS) and the Kalman filtering(KF) methods.
% Both of them is based on the pseudorange equation:
% rho = || Xs - X || + b + v
% in which Xs and X represent the position of the satellite and
% receiver, respectively, and || Xs - X || represents the distance between
% them. b represents the clock bias of receiver, and it need to be solved
% along with the position of receiver. rho is a measurement given by
% receiver for each satellites, and v is the pseudorange measurement noise
% modeled as white noise.
% There are 4 unknowns: the coordinate of receiver position X and the clock
% bias b. The ILS can be used to calculate these unknowns and is
% implemented in this extample as a comparison. In the KF solution we use
% the Extended Kalman filter (EKF) to deal with the nonlinearity of the
% pseudorange equation, and a CV model (constant velocity)[1] as the process
% model.% References:
% 1. R G Brown, P Y C Hwang, "Introduction to random signals and applied
% Kalman filtering : with MATLAB exercises and solutions",1996
% 2. Pratap Misra, Per Enge, "Global Positioning System Signals,
% Measurements, and Performance(Second Edition)",2006clear;
close all;
clc;load SV_Pos % position of satellites
load SV_Rho % pseudorange of satellitesT = 1; % positioning interval
N = 25;% total number of steps
% State vector is as [x Vx y Vy z Vz b d].', i.e. the coordinate (x,y,z),
% the clock bias b, and their derivatives.% Set f, see [1]% Set Q, see [1]
Sf = 36;
Sg = 0.01;
sigma = 5; %state transition variance
Qb = [Sf*T+Sg*T*T*T/3 Sg*T*T/2; Sg*T*T/2 Sg*T];Qxyz = sigma^2 * [T^3/3 T^2/2; T^2/2 T];Q = blkdiag(Qxyz, Qxyz, Qxyz, Qb);% Set initial values of X and P
X = zeros(8,1);
X([1 3 5]) = [ -2168816.18127156 4386648.54909167 4077161.59642875]; %Initial position
X([2 4 6]) = [0 0 0]; %Initial velocity
X(7,1) = 3575261.15370644; %Initial clock bias
X(8,1) = 45.4924634584581; %Initial clock drift
P = eye(8)*10;% Set R
Rhoerror = 36; % variance of measurement error(pseudorange error)
R = eye(size(SV_Pos{1}, 1)) * Rhoerror;fprintf('GPS positioning using EKF startedn')
tic% leaest squre solutiion
x_ls= [0,0,0,0]';for i = 1:N% Set ZZ = SV_Rho{i}.'; % measurement valueX = state_equ(X, T);[F, G] = state_propagation(X, T);%Time update of the Kalman filter state covariance.P = F*P*F' + G*Q*G';% measument update[Val, H] = measurement_gps(X, SV_Pos{i});% Calculate the Kalman filter gain.K=(P*H')/(H*P*H'+R);% update stateX = X + K*(Z - Val);% Update the Kalman filter state covariance.P=(eye(length(X))-K*H)*P;%% log data% positioning using Kalman FilterPos_KF(:,i) = X([1 3 5]).';% positioning using Least Square as a contrastPos_LS(:,i) = ch_gpsls(x_ls, SV_Pos{i}', SV_Rho{i});fprintf('KF time point %d in %d ',i, N)time = toc;remaintime = time * N / i - time;fprintf('Time elapsed: %f seconds, Time remaining: %f secondsn',time,remaintime)
end% Plot the results. Relative error is used (i.e. just subtract the mean)
% since we don't have ground truth.
for i = 1:3subplot(3,1,i)plot(1:N, Pos_KF(i,:) - mean(Pos_KF(i,:)),'-r')hold on;grid on;plot(1:N, Pos_LS(i,:) - mean(Pos_KF(i,:)))legend('EKF','ILS')xlabel('Sampling index')ylabel('Error(meters)')
end
ha = axes('Position',[0 0 1 1],'Xlim',[0 1],'Ylim',[0 1],'Box','off','Visible','off','Units','normalized', 'clipping' , 'off');
text(0.5, 1,'bf Relative positioning error in x,y and z directions','HorizontalAlignment','center','VerticalAlignment', 'top');%% state equation
function x = state_equ(x, dt)
Jacob = [1,dt; 0,1];
F = blkdiag(Jacob, Jacob, Jacob, Jacob);
x = F*x;
end%% sate propagation
function [F, G] = state_propagation(x, dt)
Jacob = [1,dt; 0,1];
F = blkdiag(Jacob, Jacob, Jacob, Jacob);
G = eye(length(x));
end%% measurement equation
function [Val, H] = measurement_gps(X, SV)% Each row of SV is the coordinate of a satellite.
dX = bsxfun(@minus, X([1,3,5])', SV);% X - Xs
Val = sum(dX .^2, 2) .^0.5 + X(7);
H = zeros(size(SV, 1), size(X, 1));
H(:, [1,3,5]) = bsxfun(@rdivide, dX, Val);
H(:, 7) = 1;end
最后效果:
参考
- GPS原理与接收机设计 谢钢
- https://simondlevy.academic.wlu.edu/kalman-tutorial/the-extended-kalman-filter-an-interactive-tutorial-for-non-experts-part-20/
卡尔曼滤波算法_GPS定位笔记3 (卡尔曼滤波定位算法)相关推荐
- 算法导论学习笔记 第2章 算法基础
本章介绍了一个贯穿本书的框架,后续的算法设计都是在这个框架中进行的. 本章通过插入排序和归并排序两种常见的算法来说明算法的过程及算法分析,在分析插入排序算法时,书中是用了循环不变式证明了算法的正确性, ...
- 【算法竞赛学习笔记】莫队算法-超优雅的暴力算法
title : 莫队算法 tags : ACM,暴力 date : 2021-10-30 author : Linno 普通莫队 常用操作:分块/排序/卡常/离散化等,直接上板子. luoguP270 ...
- 算法基础复盘笔记Day12【贪心算法】—— 区间问题、Huffman树、排序不等式、绝对值不等式、推公式
❤ 作者主页:欢迎来到我的技术博客
- 四川大学874算法大题笔记
四川大学874算法大题笔记 2015 2016 2015 若一个结点有右子树,则后继结点就是左子树的最左边的结点 若一个结点无右子树,则就往上找,直到往上找的那个结点为他父亲的左儿子,则该父亲为后继结 ...
- tdoa/aoa定位的扩展卡尔曼滤波定位算法matlab源码,TDOA/AOA定位的扩展卡尔曼滤波定位跟踪算法Matlab源码...
TDOA/AOA定位是无线定位领域里使用得最多的一种定位体制,扩展卡尔曼滤波器是最经典的非线性滤波算法,可用于目标的定位和动态轨迹跟踪,GreenSim团队实现了该算法,本源码由GreenSim团队原 ...
- 算法_GPS定位基本常识
原理 GPS是利用几何与物理的一些基本原理,通过空间分布的卫星以及卫星与地面间距离交会出地面点位置的方法,也就是利用了测量学中的测距交会的原理进行定位的.若假定有三颗卫星,且它们的位置是已知的,通过一 ...
- 【学习笔记】卡尔曼滤波中的协方差矩阵
本文转载至: 添加一些自己的理解和标注的重点,算是学习笔记吧: 一. 什么是卡尔曼滤波: 首先定义问题: 对于某一个系统,知道当前状态Xt,存在以上两个问题: 1. 经过时间△t后,下一个状态如何求出 ...
- 百度无人驾驶课程——Apollo定位-笔记
定位 定位是让自动驾驶的汽车找到自身位置的方法. 如何定位? 使用GPS全球定位系统. 问题:GPS精度(1-3米)过低,且受到环境的干扰严重.难运用到自动驾驶汽车中, 方法二. 利用车辆传感器测定的 ...
- apollo学习笔记二:定位与感知
定位 定位是指无人驾驶车准确知道自身确切位置的方法. 对于定位,车辆将其传感器识别的地标,与高精度地图上存在的地标进行对比,为了进行该对比,必须能够在其自身坐标系和地图坐标系之间转换数据,然后系统必须 ...
最新文章
- 汪昭然:构建“元宇宙”和理论基础,让深度强化学习从虚拟走进现实
- 阻止默认行为是配合passive使用
- 系列笔记 | 深度学习连载(6):卷积神经网络基础
- 心电图心电轴怎么计算_心电图导联及心电轴
- android addView的使用
- Nginx限流-速率实现
- 在asp.net core中使用的验证框架FluentValidation
- python单元测试框架unittest介绍和使用_Python+Selenium框架设计篇之-简单介绍unittest单元测试框架...
- 事件驱动的javascript
- 安卓学习笔记02:测试安卓开发环境
- linux下程序JDBC连接不到mysql数据库
- 概览Visual Studio 15.3的第二个预览版
- paip.提升用户体验------c++ 拖曳使用总结..
- javassist修炼笔记
- 程序员的终极幻想(三):做一只小小的蜗牛
- HAU寒假训练第一周
- 抖音上用计算机算66,抖音年龄计算器
- 深度拆解:体验好、满意度高,客户为什么不复购的内在逻辑
- js获取传统节假日_vue js moment.js 过滤了双休日和法定节假日
- 采集网易云上面的MV保存方法