MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_rtkpos.h
Go to the documentation of this file.
1/*------------------------------------------------------------------------------
2 * mrtk_rtkpos.h : RTK positioning type definitions and functions
3 *
4 * Copyright (C) 2026 H.SHIONO (MRTKLIB Project)
5 * Copyright (C) 2023-2025 Cabinet Office, Japan
6 * Copyright (C) 2024-2025 Lighthouse Technology & Consulting Co. Ltd.
7 * Copyright (C) 2023-2025 Japan Aerospace Exploration Agency
8 * Copyright (C) 2023-2025 TOSHIBA ELECTRONIC TECHNOLOGIES CORPORATION
9 * Copyright (C) 2015- Mitsubishi Electric Corp.
10 * Copyright (C) 2014 Geospatial Information Authority of Japan
11 * Copyright (C) 2014 T.SUZUKI
12 * Copyright (C) 2007-2023 T.TAKASU
13 *
14 * SPDX-License-Identifier: BSD-2-Clause
15 *----------------------------------------------------------------------------*/
16/**
17 * @file mrtk_rtkpos.h
18 * @brief MRTKLIB RTK Positioning Module — relative and precise positioning.
19 *
20 * This header provides the RTK control structure (rtk_t) and functions for
21 * relative positioning (DGPS/RTK) and precise point positioning (PPP).
22 *
23 * @note Functions declared here are implemented in mrtk_rtkpos.c.
24 */
25#ifndef MRTK_RTKPOS_H
26#define MRTK_RTKPOS_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
34#include "mrtklib/mrtk_nav.h"
35#include "mrtklib/mrtk_obs.h"
36#include "mrtklib/mrtk_opt.h"
37#include "mrtklib/mrtk_sol.h"
38#include "mrtklib/mrtk_time.h"
39
40typedef struct { /* ambiguity control type */
41 gtime_t epoch[4]; /* last epoch */
42 int n[4]; /* number of epochs */
43 double LC[4]; /* linear combination average */
44 double LCv[4]; /* linear combination variance */
45 int fixcnt; /* fix count */
46 char flags[MAXSAT]; /* fix flags */
47} ambc_t;
48
49typedef struct { /* RTK control/result type */
50 sol_t sol; /* RTK solution */
51 double rb[6]; /* base position/velocity (ecef) (m|m/s) */
52 int nx, na; /* number of float states/fixed states */
53 double tt; /* time difference between current and previous (s) */
54 double *x, *P; /* float states and their covariance */
55 double* Q; /* process noise covariance (adaptive filter) */
56 double *xa, *Pa; /* fixed states and their covariance */
57 int nfix; /* number of continuous fixes of ambiguity */
58 double com_bias; /* common bias offset for phase-bias initialization */
59 ambc_t ambc[MAXSAT]; /* ambibuity control */
60 ssat_t ssat[MAXSAT]; /* satellite status */
61 int neb; /* bytes in error message buffer */
62 char errbuf[MAXERRMSG]; /* error message buffer */
63 prcopt_t opt; /* processing options */
64 int miono_info[2]; /* MADOCA-PPP iono info (0:region id, 1:area No.) */
65 double prev_qr[6]; /* previous position variance/covariance (m^2) */
66 int excsat; /* index of next satellite to exclude for partial AR */
67 int nb_ar; /* number of DD ambiguities used for AR last epoch */
68 char holdamb; /* fix-and-hold has occurred at least once */
69} rtk_t;
70
71/**
72 * @brief Initialize RTK control struct.
73 * @param[in,out] rtk RTK control/result struct
74 * @param[in] opt Positioning options
75 */
76void rtkinit(rtk_t* rtk, const prcopt_t* opt);
77
78/**
79 * @brief Free memory for RTK control struct.
80 * @param[in,out] rtk RTK control/result struct
81 */
82void rtkfree(rtk_t* rtk);
83
84/**
85 * @brief Compute rover position by precise positioning.
86 * @param[in,out] rtk RTK control/result struct
87 * @param[in] obs Observation data for an epoch
88 * @param[in] nobs Number of observation data
89 * @param[in,out] nav Navigation messages
90 * @return Status (0: no solution, 1: valid solution)
91 */
92int rtkpos(mrtk_ctx_t* ctx, rtk_t* rtk, const obsd_t* obs, int nobs, nav_t* nav);
93
94/**
95 * @brief Open solution status file and set output level.
96 * @param[in] file RTK status file path
97 * @param[in] level RTK status level (0: off)
98 * @return Status (1: ok, 0: error)
99 */
100int rtkopenstat(const char* file, int level);
101
102/**
103 * @brief Close solution status file.
104 */
105void rtkclosestat(void);
106
107/**
108 * @brief Write solution status to buffer.
109 * @param[in,out] rtk RTK control/result struct
110 * @param[out] buff Output buffer
111 * @return Number of bytes written
112 */
113int rtkoutstat(rtk_t* rtk, char* buff);
114
115#ifdef __cplusplus
116}
117#endif
118
119#endif /* MRTK_RTKPOS_H */
MRTKLIB Context — runtime context for processing, trace, and error handling.
#define MAXSAT
Definition mrtk_coords.c:45
struct nav_s nav_t
Definition mrtk_eph.h:40
MRTKLIB Foundation — Common types, standard includes, and system constants (MAXSAT,...
#define MAXERRMSG
MRTKLIB Navigation Module — Navigation data types and satellite/nav utility functions.
MRTKLIB Observation Module — Observation data types and utility functions.
MRTKLIB Options Module — Processing and solution option types.
int rtkoutstat(rtk_t *rtk, char *buff)
Write solution status to buffer.
void rtkfree(rtk_t *rtk)
Free memory for RTK control struct.
int rtkopenstat(const char *file, int level)
Open solution status file and set output level.
int rtkpos(mrtk_ctx_t *ctx, rtk_t *rtk, const obsd_t *obs, int nobs, nav_t *nav)
Compute rover position by precise positioning.
void rtkclosestat(void)
Close solution status file.
void rtkinit(rtk_t *rtk, const prcopt_t *opt)
Initialize RTK control struct.
MRTKLIB Solution Module — Solution data types and I/O functions.
MRTKLIB Time Module — GNSS time types and conversion functions.
char flags[MAXSAT]
Definition mrtk_rtkpos.h:46
gtime_t epoch[4]
Definition mrtk_rtkpos.h:41
int n[4]
Definition mrtk_rtkpos.h:42
double LC[4]
Definition mrtk_rtkpos.h:43
double LCv[4]
Definition mrtk_rtkpos.h:44
int fixcnt
Definition mrtk_rtkpos.h:45
GNSS time representation.
Definition mrtk_time.h:49
Runtime context for MRTKLIB processing.
Observation data record.
Definition mrtk_obs.h:44
double * Pa
Definition mrtk_rtkpos.h:56
double tt
Definition mrtk_rtkpos.h:53
int nx
Definition mrtk_rtkpos.h:52
double prev_qr[6]
Definition mrtk_rtkpos.h:65
int nb_ar
Definition mrtk_rtkpos.h:67
double * x
Definition mrtk_rtkpos.h:54
prcopt_t opt
Definition mrtk_rtkpos.h:63
ambc_t ambc[MAXSAT]
Definition mrtk_rtkpos.h:59
double com_bias
Definition mrtk_rtkpos.h:58
int excsat
Definition mrtk_rtkpos.h:66
int miono_info[2]
Definition mrtk_rtkpos.h:64
int na
Definition mrtk_rtkpos.h:52
double * P
Definition mrtk_rtkpos.h:54
int neb
Definition mrtk_rtkpos.h:61
char errbuf[MAXERRMSG]
Definition mrtk_rtkpos.h:62
double * xa
Definition mrtk_rtkpos.h:56
int nfix
Definition mrtk_rtkpos.h:57
double rb[6]
Definition mrtk_rtkpos.h:51
char holdamb
Definition mrtk_rtkpos.h:68
ssat_t ssat[MAXSAT]
Definition mrtk_rtkpos.h:60
sol_t sol
Definition mrtk_rtkpos.h:50
double * Q
Definition mrtk_rtkpos.h:55