怎样免费建立个人网站,wordpress 修改管理员头像,厦门做网站xm37,改图在线处理图片RTKLib详解#xff1a;qzslex.c、rcvraw.c与solution.c 本文是 RTKLlib详解 系列文章的一篇#xff0c;目前该系列文章还在持续总结写作中#xff0c;以发表的如下#xff0c;有兴趣的可以翻阅。
[学习] RTKlib详解#xff1a;功能、工具与源码结构解析 [学习]RTKLib详解…RTKLib详解qzslex.c、rcvraw.c与solution.c 本文是 RTKLlib详解 系列文章的一篇目前该系列文章还在持续总结写作中以发表的如下有兴趣的可以翻阅。
[学习] RTKlib详解功能、工具与源码结构解析 [学习]RTKLib详解pntpos.c与postpos.c [学习]RTKLib详解rtkcmn.c与rtkpos.c [学习]RTKLib详解ppp.c与ppp_ar.c [学习]RTKLib详解ephemeris.c与rinex.c [学习]RTKLib详解sbas.c与rtcm.c [学习]RTKLib详解rtksvr.c与streamsvr.c [学习]RTKLib详解convkml.c、convrnx.c与geoid.c [学习]RTKLib详解datum.c、download.c与lambda.c [学习]RTKLib详解ionex.c、options.c与preceph.c [学习] RTKLib详解qzslex.c、rcvraw.c与solution.c [学习] RTKLib详解rtcm2.c、rtcm3.c、rtcm3e与rtcmn.c 文章目录 RTKLib详解qzslex.c、rcvraw.c与solution.cPart A: qzslex.c 文件解析一、文件整体说明二、执行流程与函数调用关系三、主要函数说明3.1 lex_init3.2 lex_read_frame3.3 lex_check_crc3.4 lex_decode_frame 四、关键算法数学原理与推导LEX 信号电文结构 Part B: rcvraw.c 文件解析一、文件整体说明二、执行流程与函数调用关系三、主要函数说明3.1 raw_init3.2 raw_read3.3 raw_parse3.4 raw_output 四、关键算法数学原理与推导观测值时间戳同步 Part C: solution.c 文件解析一、文件整体说明二、执行流程与函数调用关系三、主要函数说明3.1 sol_init3.2 sol_load_obs3.3 sol_update3.4 sol_output 四、关键算法数学原理与推导卡尔曼滤波观测方程 Part A: qzslex.c 文件解析
一、文件整体说明
qzslex.c 是 RTKLIB 中用于解析 QZSSQuasi-Zenith Satellite SystemLEXL-band EXperimental信号的模块。该文件实现了从原始信号数据中提取导航电文、星历信息和时钟校正参数的功能支持日本准天顶卫星系统QZSS的高精度定位。
主要功能
解析 QZSS LEX 信号电文。提取星历参数、时钟偏差和电离层校正信息。支持 LEX 数据 CRC 校验与帧同步。
主要特色
支持 QZSS 多频段信号L1/L2/L5/LEX。高效的位操作与电文解码算法。可扩展至未来新型 GNSS 信号。 二、执行流程与函数调用关系
程序执行流程如下
初始化 LEX 信号解析器。逐帧读取原始信号数据。执行 CRC 校验与帧同步。解码电文内容并提取参数。
函数调用关系如下 #mermaid-svg-12EKAy9lVEl88sHL {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-12EKAy9lVEl88sHL .error-icon{fill:#552222;}#mermaid-svg-12EKAy9lVEl88sHL .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-12EKAy9lVEl88sHL .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-12EKAy9lVEl88sHL .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-12EKAy9lVEl88sHL .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-12EKAy9lVEl88sHL .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-12EKAy9lVEl88sHL .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-12EKAy9lVEl88sHL .marker{fill:#333333;stroke:#333333;}#mermaid-svg-12EKAy9lVEl88sHL .marker.cross{stroke:#333333;}#mermaid-svg-12EKAy9lVEl88sHL svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-12EKAy9lVEl88sHL .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-12EKAy9lVEl88sHL .cluster-label text{fill:#333;}#mermaid-svg-12EKAy9lVEl88sHL .cluster-label span{color:#333;}#mermaid-svg-12EKAy9lVEl88sHL .label text,#mermaid-svg-12EKAy9lVEl88sHL span{fill:#333;color:#333;}#mermaid-svg-12EKAy9lVEl88sHL .node rect,#mermaid-svg-12EKAy9lVEl88sHL .node circle,#mermaid-svg-12EKAy9lVEl88sHL .node ellipse,#mermaid-svg-12EKAy9lVEl88sHL .node polygon,#mermaid-svg-12EKAy9lVEl88sHL .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-12EKAy9lVEl88sHL .node .label{text-align:center;}#mermaid-svg-12EKAy9lVEl88sHL .node.clickable{cursor:pointer;}#mermaid-svg-12EKAy9lVEl88sHL .arrowheadPath{fill:#333333;}#mermaid-svg-12EKAy9lVEl88sHL .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-12EKAy9lVEl88sHL .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-12EKAy9lVEl88sHL .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-12EKAy9lVEl88sHL .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-12EKAy9lVEl88sHL .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-12EKAy9lVEl88sHL .cluster text{fill:#333;}#mermaid-svg-12EKAy9lVEl88sHL .cluster span{color:#333;}#mermaid-svg-12EKAy9lVEl88sHL div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-12EKAy9lVEl88sHL :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} main lex_init lex_read_frame lex_check_crc lex_decode_frame lex_output_data 三、主要函数说明
3.1 lex_init
int lex_init(lex_t *lex)功能 初始化 LEX 信号解析器设置默认参数。
输入参数
lex: LEX 数据结构体指针。
返回值
成功返回 1失败返回 0。 3.2 lex_read_frame
int lex_read_frame(FILE *fp, unsigned char *buff, int *len)功能 从文件或流中读取 LEX 信号帧数据。
输入参数
fp: 文件指针。buff: 缓冲区。len: 输出读取长度。
返回值
成功返回字节数失败返回负值。 3.3 lex_check_crc
int lex_check_crc(const unsigned char *buff, int len)功能 验证 LEX 帧的 CRC 校验码。
输入参数
buff: 数据缓冲区。len: 数据长度。
返回值
校验成功返回 1失败返回 0。 3.4 lex_decode_frame
int lex_decode_frame(const unsigned char *buff, lex_data_t *data)功能 解码 LEX 帧电文提取星历、时钟等参数。
输入参数
buff: 解析后的帧数据。data: 输出参数存储结构体。
返回值
成功返回 1失败返回 0。 四、关键算法数学原理与推导
LEX 信号电文结构
LEX 信号采用前向纠错编码FEC和交织技术电文结构包含
帧头8 bit: 标识帧起始。数据域N bit: 星历参数、时钟校正等。CRC 校验24 bit: 使用多项式 x 24 x 23 x 18 x 17 x 14 x 11 x 10 x 6 x 5 x 4 x 3 x 1 x^{24} x^{23} x^{18} x^{17} x^{14} x^{11} x^{10} x^6 x^5 x^4 x^3 x 1 x24x23x18x17x14x11x10x6x5x4x3x1。
CRC 校验公式为 CRC ( D ) ( D ⋅ x 24 ) m o d G ( x ) \text{CRC}(D) \left(D \cdot x^{24}\right) \mod G(x) CRC(D)(D⋅x24)modG(x)
其中 G ( x ) G(x) G(x) 为上述多项式。 Part B: rcvraw.c 文件解析
一、文件整体说明
rcvraw.c 是 RTKLIB 中用于解析接收机原始观测数据的核心模块。它支持多种接收机格式如 UBX、RTCM、BINEX将原始二进制数据转换为内部观测结构为后续处理提供基础。
主要功能
解析接收机原始数据流。支持多频段、多系统观测值提取。提供时间戳同步与数据校验。
主要特色
自动探测输入数据格式。支持实时流与文件模式。高效的数据缓存与解析机制。 二、执行流程与函数调用关系
程序执行流程如下
读取原始数据流并识别格式。解析观测值、星历和校正信息。将数据转换为 RTKLIB 内部结构。输出观测数据与状态信息。
函数调用关系如下 #mermaid-svg-b30kzCzRl0EBpVe5 {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-b30kzCzRl0EBpVe5 .error-icon{fill:#552222;}#mermaid-svg-b30kzCzRl0EBpVe5 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-b30kzCzRl0EBpVe5 .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-b30kzCzRl0EBpVe5 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-b30kzCzRl0EBpVe5 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-b30kzCzRl0EBpVe5 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-b30kzCzRl0EBpVe5 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-b30kzCzRl0EBpVe5 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-b30kzCzRl0EBpVe5 .marker.cross{stroke:#333333;}#mermaid-svg-b30kzCzRl0EBpVe5 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-b30kzCzRl0EBpVe5 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-b30kzCzRl0EBpVe5 .cluster-label text{fill:#333;}#mermaid-svg-b30kzCzRl0EBpVe5 .cluster-label span{color:#333;}#mermaid-svg-b30kzCzRl0EBpVe5 .label text,#mermaid-svg-b30kzCzRl0EBpVe5 span{fill:#333;color:#333;}#mermaid-svg-b30kzCzRl0EBpVe5 .node rect,#mermaid-svg-b30kzCzRl0EBpVe5 .node circle,#mermaid-svg-b30kzCzRl0EBpVe5 .node ellipse,#mermaid-svg-b30kzCzRl0EBpVe5 .node polygon,#mermaid-svg-b30kzCzRl0EBpVe5 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-b30kzCzRl0EBpVe5 .node .label{text-align:center;}#mermaid-svg-b30kzCzRl0EBpVe5 .node.clickable{cursor:pointer;}#mermaid-svg-b30kzCzRl0EBpVe5 .arrowheadPath{fill:#333333;}#mermaid-svg-b30kzCzRl0EBpVe5 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-b30kzCzRl0EBpVe5 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-b30kzCzRl0EBpVe5 .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-b30kzCzRl0EBpVe5 .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-b30kzCzRl0EBpVe5 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-b30kzCzRl0EBpVe5 .cluster text{fill:#333;}#mermaid-svg-b30kzCzRl0EBpVe5 .cluster span{color:#333;}#mermaid-svg-b30kzCzRl0EBpVe5 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-b30kzCzRl0EBpVe5 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} main raw_init raw_read raw_parse raw_output 三、主要函数说明
3.1 raw_init
int raw_init(raw_t *raw, int format)功能 初始化接收机原始数据解析器指定数据格式。
输入参数
raw: 原始数据结构体。format: 数据格式如 FORMAT_UBX。
返回值
成功返回 1失败返回 0。 3.2 raw_read
int raw_read(FILE *fp, unsigned char *buff, int nmax)功能 从文件或流中读取原始数据。
输入参数
fp: 文件指针。buff: 缓冲区。nmax: 最大读取长度。
返回值
成功返回字节数失败返回负值。 3.3 raw_parse
int raw_parse(raw_t *raw, int type, const unsigned char *buff, int len)功能 解析原始数据识别消息类型并填充结构体。
输入参数
raw: 解析器结构体。type: 消息类型如 MSG_NAV_PVT。buff: 数据缓冲区。len: 数据长度。
返回值
成功返回 1失败返回 0。 3.4 raw_output
int raw_output(raw_t *raw, FILE *fp)功能 将解析后的观测数据写入输出文件或流。
输入参数
raw: 解析器结构体。fp: 输出文件指针。
返回值
成功返回 1失败返回 0。 四、关键算法数学原理与推导
观测值时间戳同步
接收机时间戳 t r e c v t_{recv} trecv 与 GPS 时间 t G P S t_{GPS} tGPS 的关系为 t G P S t r e c v Δ t u t c t_{GPS} t_{recv} \Delta t_{utc} tGPStrecvΔtutc
其中 Δ t u t c \Delta t_{utc} Δtutc 是 UTC 与 GPS 时间的闰秒修正值需通过星历或头文件获取。 Part C: solution.c 文件解析
一、文件整体说明
solution.c 是 RTKLIB 中用于 GNSS 定位解算的核心模块。它实现了从观测数据到最终位置、速度、时间PVT的求解过程支持单点定位SPP、差分定位DGPS和实时动态定位RTK等多种模式。
主要功能
计算卫星位置与钟差。实现观测方程与参数估计。支持多种解算模式SPP/DGPS/RTK。
主要特色
支持多频段、多系统联合解算。高精度卡尔曼滤波器实现。可视化解算状态与质量指标。 二、执行流程与函数调用关系
程序执行流程如下
初始化解算器与状态向量。加载观测数据与星历信息。构建观测方程并更新卡尔曼滤波器。输出解算结果与协方差矩阵。
函数调用关系如下 #mermaid-svg-Mma8wo3BOcEDr3Dw {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-Mma8wo3BOcEDr3Dw .error-icon{fill:#552222;}#mermaid-svg-Mma8wo3BOcEDr3Dw .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Mma8wo3BOcEDr3Dw .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-Mma8wo3BOcEDr3Dw .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Mma8wo3BOcEDr3Dw .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Mma8wo3BOcEDr3Dw .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Mma8wo3BOcEDr3Dw .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Mma8wo3BOcEDr3Dw .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Mma8wo3BOcEDr3Dw .marker.cross{stroke:#333333;}#mermaid-svg-Mma8wo3BOcEDr3Dw svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Mma8wo3BOcEDr3Dw .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-Mma8wo3BOcEDr3Dw .cluster-label text{fill:#333;}#mermaid-svg-Mma8wo3BOcEDr3Dw .cluster-label span{color:#333;}#mermaid-svg-Mma8wo3BOcEDr3Dw .label text,#mermaid-svg-Mma8wo3BOcEDr3Dw span{fill:#333;color:#333;}#mermaid-svg-Mma8wo3BOcEDr3Dw .node rect,#mermaid-svg-Mma8wo3BOcEDr3Dw .node circle,#mermaid-svg-Mma8wo3BOcEDr3Dw .node ellipse,#mermaid-svg-Mma8wo3BOcEDr3Dw .node polygon,#mermaid-svg-Mma8wo3BOcEDr3Dw .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Mma8wo3BOcEDr3Dw .node .label{text-align:center;}#mermaid-svg-Mma8wo3BOcEDr3Dw .node.clickable{cursor:pointer;}#mermaid-svg-Mma8wo3BOcEDr3Dw .arrowheadPath{fill:#333333;}#mermaid-svg-Mma8wo3BOcEDr3Dw .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Mma8wo3BOcEDr3Dw .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Mma8wo3BOcEDr3Dw .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-Mma8wo3BOcEDr3Dw .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-Mma8wo3BOcEDr3Dw .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Mma8wo3BOcEDr3Dw .cluster text{fill:#333;}#mermaid-svg-Mma8wo3BOcEDr3Dw .cluster span{color:#333;}#mermaid-svg-Mma8wo3BOcEDr3Dw div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Mma8wo3BOcEDr3Dw :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} main sol_init sol_load_obs sol_update sol_output 三、主要函数说明
3.1 sol_init
int sol_init(sol_t *sol, int mode)功能 初始化解算器设置解算模式SPP/RTK。
输入参数
sol: 解算器结构体。mode: 解算模式如 SOL_MODE_RTK。
返回值
成功返回 1失败返回 0。 3.2 sol_load_obs
int sol_load_obs(const obs_t *obs, const nav_t *nav, sol_t *sol)功能 加载观测数据与导航数据到解算器。
输入参数
obs, nav: 观测与导航数据。sol: 解算器结构体。
返回值
成功返回 1失败返回 0。 3.3 sol_update
int sol_update(sol_t *sol)功能 执行一次解算迭代更新状态向量与协方差矩阵。
输入参数
sol: 解算器结构体。
返回值
成功返回 1失败返回 0。 3.4 sol_output
int sol_output(const sol_t *sol, FILE *fp)功能 将解算结果位置、速度、状态写入文件。
输入参数
sol: 解算器结构体。fp: 输出文件指针。
返回值
成功返回 1失败返回 0。 四、关键算法数学原理与推导
卡尔曼滤波观测方程
观测方程为 y H x v \mathbf{y} \mathbf{H} \mathbf{x} \mathbf{v} yHxv
其中 y \mathbf{y} y: 观测向量伪距、载波相位等。 H \mathbf{H} H: 设计矩阵几何距离对状态变量的偏导数。 x \mathbf{x} x: 状态向量位置、速度、模糊度等。 v \mathbf{v} v: 观测噪声。
卡尔曼增益更新公式为 K P H T ( H P H T R ) − 1 \mathbf{K} \mathbf{P} \mathbf{H}^T \left( \mathbf{H} \mathbf{P} \mathbf{H}^T \mathbf{R} \right)^{-1} KPHT(HPHTR)−1
其中 P \mathbf{P} P 为状态协方差矩阵 R \mathbf{R} R 为观测噪声协方差矩阵。 研究学习不易点赞易。 工作生活不易收藏易点收藏不迷茫