GNSS-INS组合导航:KF-GINS(二)

news/2024/10/21 12:01:46/

Earth.h文件

基于Eigen库矩阵计算。

1、WGS84确定椭球模型参数

const double WGS84_WIE = 7.2921151467E-5;       /* 地球自转角速度*/
const double WGS84_F   = 0.0033528106647474805; /* 扁率 */
const double WGS84_RA  = 6378137.0000000000;    /* 长半轴a */
const double WGS84_RB  = 6356752.3142451793;    /* 短半轴b */
const double WGS84_GM0 = 398600441800000.00;    /* 地球引力常数 */
const double WGS84_E1  = 0.0066943799901413156; /* 第一偏心率平方 */
const double WGS84_E2  = 0.0067394967422764341; /* 第二偏心率平方 */

2、计算重力

class Earth {public:/* 正常重力计算 */static double gravity(const Vector3d &blh) {double sin2 = sin(blh[0]);sin2 *= sin2;return 9.7803267715 * (1 + 0.0052790414 * sin2 + 0.0000232718 * sin2 * sin2) +blh[2] * (0.0000000043977311 * sin2 - 0.0000030876910891) + 0.0000000000007211 * blh[2] * blh[2];}

与严老师PSINS中的代码相近

eth.g = eth.g0*(1+5.27094e-3*eth.sl2+2.32718e-5*sl4)-3.086e-6*pos(3); % grs80

 3、计算子午圈半径

 /* 计算子午圈半径和卯酉圈半径 */static Eigen::Vector2d meridianPrimeVerticalRadius(double lat) {double tmp, sqrttmp;tmp = sin(lat);tmp *= tmp;tmp     = 1 - WGS84_E1 * tmp;sqrttmp = sqrt(tmp);return {WGS84_RA * (1 - WGS84_E1) / (sqrttmp * tmp), WGS84_RA / sqrttmp};}

4、计算卯酉圈半径

 static double RN(double lat) {double sinlat = sin(lat);return WGS84_RA / sqrt(1.0 - WGS84_E1 * sinlat * sinlat);}

 

5、n系到e系转换矩阵

static Matrix3d cne(const Vector3d &blh) {double coslon, sinlon, coslat, sinlat;sinlat = sin(blh[0]);sinlon = sin(blh[1]);coslat = cos(blh[0]);coslon = cos(blh[1]);Matrix3d dcm;dcm(0, 0) = -sinlat * coslon;dcm(0, 1) = -sinlon;dcm(0, 2) = -coslat * coslon;dcm(1, 0) = -sinlat * sinlon;dcm(1, 1) = coslon;dcm(1, 2) = -coslat * sinlon;dcm(2, 0) = coslat;dcm(2, 1) = 0;dcm(2, 2) = -sinlat;return dcm;}

 6、n系到e系转换四元数

static Quaterniond qne(const Vector3d &blh) {Quaterniond quat;double coslon, sinlon, coslat, sinlat;coslon = cos(blh[1] * 0.5);sinlon = sin(blh[1] * 0.5);coslat = cos(-M_PI * 0.25 - blh[0] * 0.5);sinlat = sin(-M_PI * 0.25 - blh[0] * 0.5);quat.w() = coslat * coslon;quat.x() = -sinlat * sinlon;quat.y() = sinlat * coslon;quat.z() = coslat * sinlon;return quat;}

 7、从n系到e系转换四元数得到经纬度

static Vector3d blh(const Quaterniond &qne, double height) {return {-2 * atan(qne.y() / qne.w()) - M_PI * 0.5, 2 * atan2(qne.z(), qne.w()), height};}

8、地理坐标转地心地固坐标

 /* 大地坐标(纬度、经度和高程)转地心地固坐标 */static Vector3d blh2ecef(const Vector3d &blh) {double coslat, sinlat, coslon, sinlon;double rnh, rn;coslat = cos(blh[0]);sinlat = sin(blh[0]);coslon = cos(blh[1]);sinlon = sin(blh[1]);rn  = RN(blh[0]);rnh = rn + blh[2];return {rnh * coslat * coslon, rnh * coslat * sinlon, (rnh - rn * WGS84_E1) * sinlat};}

 9、地心地固坐标系转地理坐标

tatic Vector3d ecef2blh(const Vector3d &ecef) {double p = sqrt(ecef[0] * ecef[0] + ecef[1] * ecef[1]);double rn;double lat, lon;double h = 0, h2;// 初始状态lat = atan(ecef[2] / (p * (1.0 - WGS84_E1)));lon = 2.0 * atan2(ecef[1], ecef[0] + p);do {h2  = h;rn  = RN(lat);h   = p / cos(lat) - rn;lat = atan(ecef[2] / (p * (1.0 - WGS84_E1 * rn / (rn + h))));} while (fabs(h - h2) > 1.0e-4);return {lat, lon, h};}

 这里有许多公式,知乎上有一位北大遥感的大佬对此部分做过详细的总结。

10、n系相对位置转地理坐标相对位置、地理坐标相对位置转n系相对位置

/* n系相对位置转大地坐标相对位置 */static Matrix3d DRi(const Vector3d &blh) {Matrix3d dri = Matrix3d::Zero();Eigen::Vector2d rmn = meridianPrimeVerticalRadius(blh[0]);dri(0, 0) = 1.0 / (rmn[0] + blh[2]);dri(1, 1) = 1.0 / ((rmn[1] + blh[2]) * cos(blh[0]));dri(2, 2) = -1;return dri;}/* 大地坐标相对位置转n系相对位置 */static Matrix3d DR(const Vector3d &blh) {Matrix3d dr = Matrix3d::Zero();Eigen::Vector2d rmn = meridianPrimeVerticalRadius(blh[0]);dr(0, 0) = rmn[0] + blh[2];dr(1, 1) = (rmn[1] + blh[2]) * cos(blh[0]);dr(2, 2) = -1;return dr;}

 11、地球自转角速度投影到e系

/* 地球自转角速度投影到e系 */static Vector3d iewe() {return {0, 0, WGS84_WIE};}

 12、地球自转角速度投影到n系

/* 地球自转角速度投影到n系 */static Vector3d iewn(double lat) {return {WGS84_WIE * cos(lat), 0, -WGS84_WIE * sin(lat)};}static Vector3d iewn(const Vector3d &origin, const Vector3d &local) {Vector3d global = local2global(origin, local);return iewn(global[0]);}

 13、n系相对于e系转动角速度投影到n系

 /* n系相对于e系转动角速度投影到n系 */static Vector3d enwn(const Eigen::Vector2d &rmn, const Vector3d &blh, const Vector3d &vel) {return {vel[1] / (rmn[1] + blh[2]), -vel[0] / (rmn[0] + blh[2]), -vel[1] * tan(blh[0]) / (rmn[1] + blh[2])};}static Vector3d enwn(const Vector3d &origin, const Vector3d &local, const Vector3d &vel) {Vector3d global     = local2global(origin, local);Eigen::Vector2d rmn = meridianPrimeVerticalRadius(global[0]);return enwn(rmn, global, vel);}

感谢武汉大学卫星导航定位技术研究中心多源智能导航实验室(i2Nav)牛小骥教授团队开源的KF-GINS软件平台。


http://www.ppmy.cn/news/458273.html

相关文章

gn3

今天我们来讲解下gns3的详细使用方法,gns3是思科的一款模拟器软件,他是基于真实的思科ios来模拟的,所以从这个角度来讲他就是一台真实的思科设备,另一款和他相似的软件就是小凡了,他们的工作原理大同小异,不…

嵌入式GPS模块,天线一体化GPS模块,GNSS G-Mouse测试指导

我们常说的GPS定位模块称为用户部分,它像“收音机”一样接收、解调卫星的广播C/A码信号,中以频率为1575.42MHz。GPS模块/北斗模块/GNSS模块并不播发信号,属于被动定位。通过运算与每个卫星的伪距离,采用距离交会法求出接收机的得出…

GNS3最新版安装教程

GNS3最新版安装教程 最新版2.2.18 一、GNS3最新版下载 进入GNS3官网下载最新版软件安装包程序。下载之前要先注册账号登录。 如下,点击windows下载,同时点击网页下端 download the GNS3 VM 下载好俩个安装文件 二、GNS3 VMware虚拟机安装 将下载的…

GNSS-INS组合导航:KF-GINS(一)

因为毕业设计需求,最近一个月学习了开源程序KF-ginss。 这几篇文章介绍松组合导航是如何实现的,总体大概分为三部分、第一部分介绍常用的坐标系转换、大地测量学基础、角度转化,第二部分介绍组合导航、状态转移矩阵如何实现、怎样进行卡尔曼…

GNS3安装教程

最近在学习CCNA,自己也试着搭建一个开发环境。这里简单记录一下安装过程。 官网,注册登录一下 先下载虚拟机的ova文件,没有虚拟机的下一个VMware Workstation,接着按蓝色的Download,选择下载windows版本 安装GN…

【网络通信】【GNS3】Window10 下 GNS3 安装与配置

本文记录 GNS3 2.2.12 在 Window10 下的安装与配置过程. 文章目录 1. 安装 GNS31.1 下载安装文件1.2 安装过程 2. 配置 GNS32.1 基本配置2.2 添加 IOS2.3 计算 Idle-PC 值 1. 安装 GNS3 1.1 下载安装文件 官网https://www.gns3.com/GitHub 官方主页https://github.com/GNS3So…

【工具】GNS3

参考 CCIE 工程师社区 - https://ccie.lol/blog/2016/07/01/gns3-iou-installation-guide/皮皮的小car GNS3介绍及基础环境搭建 - https://www.bilibili.com/video/BV1Vq4y1v7kL/ _sev_June GNS3完整安装系列① 相关软件准备 - https://www.bilibili.com/video/BV1H7411m7R9/GN…

GNS3安装及实验中应用

GNS3安装及实验中应用 一、简介: GNS在网络实验中会经常用到,例如两个虚拟机,一个在VMnet1,一个在VMnet2,正常来说这两个主机是ping不通的,但是你在GNS中给两个主机间连接一个路由器,并对路由器…