之前的笔记介绍了传统的最小二乘解法和DOP的概念,这一节介绍卡尔曼滤波的定位解法。需要的先修基础知识: 卡尔曼滤波原理,尤其是拓展卡尔曼滤波(EKF)


卡尔曼滤波回顾与复习

标准线性卡尔曼滤波

一个线性卡尔曼滤波的例子

考虑以下一个系统模型

对照卡尔曼滤波模型,这里A=1, B=0和 C=1。 假定系统状态初始估计值

的均方误差
等于4, 过程噪声
和测量噪声
的方差分别为常数Q与R,那么Q=0.5, R=1时,试求状态均方差值
在各个时刻的卡尔曼递推计算中的变化情况,然后再重复计算当Q=0.1和R=1时候的
值变化情况。

由于只需要计算状态均方误差值,所以在每一个历元(比如第k个)的卡尔曼滤波递推过程中只涉及一下三个公式:

的值一起带入以上各式,就可以得到各个历元的先验均方误差
和后验均方差
。而下图虚线与实线分别描述了均方差在上述两组Q,R值下的变化情况。

GPS定位的卡尔曼滤波算法

这一节运用卡尔曼滤波算法来求解GPS位置,速度和时间(PVT).

卡尔曼滤波和之前介绍的最小二乘法的主要区别在于:前者利用状态方程将不同时刻的状态联系起来,而后者却是孤立的求解每一个不同时刻的系统状态。除此之外,GPS的卡尔曼滤波测量方程与最小二乘法中的GPS定位,定速方程事实上没有区别。

接收机时钟模型

接收机时钟偏差是用于GPS定位的各个卫星伪距测量值的公共误差部分,而接收机时钟频飘移是用GPS定速的各个卫星多普勒频移测量值的公共误差部分。因为接收机的钟差与频飘之间是一个简单的积分关系,所以他们两者经常一起作为卡尔曼滤波的系统状态量。

下图所示为一种相当自然的接收机时钟模型,它的两个状态变量为接收机种差

和频飘
,而
分别代表钟差噪声与频飘噪声。该模型可用如下状态空间微分方程式来描述:

其中,状态向量为

,噪声向量为
。我们通过以下一个例子将上述连续时间的微分方程式转换成卡尔曼滤波模型中的离散时间状态方程。

试将上图中的接收机时钟模型所对应的状态空间微分方程式6.117转换离散的卡尔曼滤波状态方程。随后,假定接收机钟差噪声

和频飘噪声
的功率谱密度分别为
。试求状态方程中的过程噪声向量
的协方差矩阵

套用6.4.1节中的相关公式来求解系统状态方程及其过程噪声协方差

。过程从略,这里直接给出答案:

因为模型中各个相关的矩阵均为常数矩阵,所以过程噪声

的协方差
也不随时间发生变化,其值为

事实上,这个例子说解得的接收机时钟模型状态方程式经常出现于各个参考文献。

用户运动模型

不同特点的用户运动形式可用不同的状态方程模型来描述。对于静态接收机而言,他的运动速度为0,所以由用户位置的三个坐标量

和接收机的两个时钟变量
所组成的一个五维状态向量x足以描述该接收机的运动状态,所以状态向量为:
静止接收机状态向量

常系数状态转移矩阵:

过程噪声向量

的协方差矩阵:

而A中的子矩阵

中的
分别为上小节中关于接收机时钟和状态转移矩阵与过程噪声协方差矩阵,为6.118A和 6.118D.
尽管理论为0,但实际不应该为0,否则卡尔曼滤波器不久将忽略测量值的作用。

对于行人,汽车,舰船等低动态的载体而言,它们的接收机运行情况一般可用八个状态量来描述,既三个位置分量

,三个速度分量
和接收机时钟的两个变量
。其状态向量为

常系数状态转移矩阵为

其速度过程噪声与钟差模型类似为:

实战

给定实时卫星伪距和卫星坐标,用最小二乘和卡尔曼滤波进行位置估计。

这套代码来自于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 (卡尔曼滤波定位算法)相关推荐

  1. 算法导论学习笔记 第2章 算法基础

    本章介绍了一个贯穿本书的框架,后续的算法设计都是在这个框架中进行的. 本章通过插入排序和归并排序两种常见的算法来说明算法的过程及算法分析,在分析插入排序算法时,书中是用了循环不变式证明了算法的正确性, ...

  2. 【算法竞赛学习笔记】莫队算法-超优雅的暴力算法

    title : 莫队算法 tags : ACM,暴力 date : 2021-10-30 author : Linno 普通莫队 常用操作:分块/排序/卡常/离散化等,直接上板子. luoguP270 ...

  3. 算法基础复盘笔记Day12【贪心算法】—— 区间问题、Huffman树、排序不等式、绝对值不等式、推公式

    ❤ 作者主页:欢迎来到我的技术博客

  4. 四川大学874算法大题笔记

    四川大学874算法大题笔记 2015 2016 2015 若一个结点有右子树,则后继结点就是左子树的最左边的结点 若一个结点无右子树,则就往上找,直到往上找的那个结点为他父亲的左儿子,则该父亲为后继结 ...

  5. tdoa/aoa定位的扩展卡尔曼滤波定位算法matlab源码,TDOA/AOA定位的扩展卡尔曼滤波定位跟踪算法Matlab源码...

    TDOA/AOA定位是无线定位领域里使用得最多的一种定位体制,扩展卡尔曼滤波器是最经典的非线性滤波算法,可用于目标的定位和动态轨迹跟踪,GreenSim团队实现了该算法,本源码由GreenSim团队原 ...

  6. 算法_GPS定位基本常识

    原理 GPS是利用几何与物理的一些基本原理,通过空间分布的卫星以及卫星与地面间距离交会出地面点位置的方法,也就是利用了测量学中的测距交会的原理进行定位的.若假定有三颗卫星,且它们的位置是已知的,通过一 ...

  7. 【学习笔记】卡尔曼滤波中的协方差矩阵

    本文转载至: 添加一些自己的理解和标注的重点,算是学习笔记吧: 一. 什么是卡尔曼滤波: 首先定义问题: 对于某一个系统,知道当前状态Xt,存在以上两个问题: 1. 经过时间△t后,下一个状态如何求出 ...

  8. 百度无人驾驶课程——Apollo定位-笔记

    定位 定位是让自动驾驶的汽车找到自身位置的方法. 如何定位? 使用GPS全球定位系统. 问题:GPS精度(1-3米)过低,且受到环境的干扰严重.难运用到自动驾驶汽车中, 方法二. 利用车辆传感器测定的 ...

  9. apollo学习笔记二:定位与感知

    定位 定位是指无人驾驶车准确知道自身确切位置的方法. 对于定位,车辆将其传感器识别的地标,与高精度地图上存在的地标进行对比,为了进行该对比,必须能够在其自身坐标系和地图坐标系之间转换数据,然后系统必须 ...

最新文章

  1. 汪昭然:构建“元宇宙”和理论基础,让深度强化学习从虚拟走进现实
  2. 阻止默认行为是配合passive使用
  3. 系列笔记 | 深度学习连载(6):卷积神经网络基础
  4. 心电图心电轴怎么计算_心电图导联及心电轴
  5. android addView的使用
  6. Nginx限流-速率实现
  7. 在asp.net core中使用的验证框架FluentValidation
  8. python单元测试框架unittest介绍和使用_Python+Selenium框架设计篇之-简单介绍unittest单元测试框架...
  9. 事件驱动的javascript
  10. 安卓学习笔记02:测试安卓开发环境
  11. linux下程序JDBC连接不到mysql数据库
  12. 概览Visual Studio 15.3的第二个预览版
  13. paip.提升用户体验------c++ 拖曳使用总结..
  14. javassist修炼笔记
  15. 程序员的终极幻想(三):做一只小小的蜗牛
  16. HAU寒假训练第一周
  17. 抖音上用计算机算66,抖音年龄计算器
  18. 深度拆解:体验好、满意度高,客户为什么不复购的内在逻辑
  19. js获取传统节假日_vue js moment.js 过滤了双休日和法定节假日
  20. 采集网易云上面的MV保存方法

热门文章

  1. 一堂如何提高代码质量的培训课 之 领域驱动设计
  2. 解决了昨天差点让人崩溃的问题.
  3. Golang sort 包使用
  4. Golang 任意类型切片的增删改查
  5. 14 count(*)
  6. 编写绘图代码的技巧(二)
  7. 转载-IDEA项目左边栏只能看到文件看不到项目结构
  8. VMware下Linux配置局域网和外网访问(CentOS)
  9. 协同过滤介绍和简单推荐系统的实现
  10. CyaSSL 2.4.6 发布,SSL 加密库