MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_coords.h File Reference

MRTKLIB Coordinates Module — Coordinate transformations and geometry. More...

Include dependency graph for mrtk_coords.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void deg2dms (double deg, double *dms, int ndec)
 Convert degree to degree-minute-second.
double dms2deg (const double *dms)
 Convert degree-minute-second to degree.
void ecef2pos (const double *r, double *pos)
 Transform ECEF position to geodetic position.
void pos2ecef (const double *pos, double *r)
 Transform geodetic position to ECEF position.
void xyz2enu (const double *pos, double *E)
 Compute ECEF to local coordinate transformation matrix.
void ecef2enu (const double *pos, const double *r, double *e)
 Transform ECEF vector to local tangential coordinate.
void enu2ecef (const double *pos, const double *e, double *r)
 Transform local tangential coordinate vector to ECEF.
void covenu (const double *pos, const double *P, double *Q)
 Transform ECEF covariance to local tangential coordinate.
void covecef (const double *pos, const double *Q, double *P)
 Transform local ENU covariance to ECEF coordinate.
void eci2ecef (gtime_t tutc, const double *erpv, double *U, double *gmst)
 Compute ECI to ECEF transformation matrix.
double geodist (const double *rs, const double *rr, double *e)
 Compute geometric distance and receiver-to-satellite unit vector.
double satazel (const double *pos, const double *e, double *azel)
 Compute satellite azimuth/elevation angle.
void dops (int ns, const double *azel, double elmin, double *dop)
 Compute DOP (dilution of precision).

Detailed Description

MRTKLIB Coordinates Module — Coordinate transformations and geometry.

This header provides coordinate transformation functions (ECEF, geodetic, ENU), rotation matrices, degree/DMS conversions, ECI-to-ECEF transformation, and positioning geometry functions (geometric distance, satellite azimuth/ elevation, DOP computation).

Note
All functions in this module are pure cut-and-paste extractions from rtkcmn.c with zero algorithmic changes.

Definition in file mrtk_coords.h.

Function Documentation

◆ covecef()

void covecef ( const double * pos,
const double * Q,
double * P )

Transform local ENU covariance to ECEF coordinate.

Parameters
[in]posGeodetic position {lat, lon} (rad)
[in]QCovariance in local ENU coordinate
[out]PCovariance in ECEF coordinate

Definition at line 202 of file mrtk_coords.c.

References matmul(), and xyz2enu().

Referenced by udpos(), udpos(), and udpos_ppp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ covenu()

void covenu ( const double * pos,
const double * P,
double * Q )

Transform ECEF covariance to local tangential coordinate.

Parameters
[in]posGeodetic position {lat, lon} (rad)
[in]PCovariance in ECEF coordinate
[out]QCovariance in local tangential coordinate

Definition at line 188 of file mrtk_coords.c.

References matmul(), and xyz2enu().

Referenced by outenu(), and outpos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deg2dms()

void deg2dms ( double deg,
double * dms,
int ndec )

Convert degree to degree-minute-second.

Parameters
[in]degDegree
[out]dmsDegree-minute-second {deg, min, sec}
[in]ndecNumber of decimals of second

Definition at line 63 of file mrtk_coords.c.

Referenced by outrpos().

Here is the caller graph for this function:

◆ dms2deg()

double dms2deg ( const double * dms)

Convert degree-minute-second to degree.

Parameters
[in]dmsDegree-minute-second {deg, min, sec}
Returns
Degree

Definition at line 86 of file mrtk_coords.c.

◆ dops()

void dops ( int ns,
const double * azel,
double elmin,
double * dop )

Compute DOP (dilution of precision).

Parameters
[in]nsNumber of satellites
[in]azelSatellite azimuth/elevation angle (rad)
[in]elminElevation cutoff angle (rad)
[out]dopDOPs {GDOP, PDOP, HDOP, VDOP}
Note
dop[0]-[3] return 0 in case of DOP computation error.

Definition at line 545 of file mrtk_coords.c.

References matinv(), matmul(), MAXSAT, and SQRT.

Referenced by outnmea_gsa(), valsol(), zddop(), and zddop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ecef2enu()

void ecef2enu ( const double * pos,
const double * r,
double * e )

Transform ECEF vector to local tangential coordinate.

Parameters
[in]posGeodetic position {lat, lon} (rad)
[in]rVector in ECEF coordinate {x, y, z}
[out]eVector in local tangential coordinate {e, n, u}

Definition at line 162 of file mrtk_coords.c.

References matmul(), and xyz2enu().

Referenced by outenu(), outnmea_rmc(), outpos(), outrnxevent(), ppprtk_outstat(), rtkoutstat(), satazel(), setopt_sta(), and setpcv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ecef2pos()

void ecef2pos ( const double * r,
double * pos )

Transform ECEF position to geodetic position.

Parameters
[in]rECEF position {x, y, z} (m)
[out]posGeodetic position {lat, lon, h} (rad, m)
Note
WGS84, ellipsoidal height.

Definition at line 102 of file mrtk_coords.c.

References dot(), FE_WGS84, PI, and RE_WGS84.

Referenced by antpos(), clas_osr_zdres(), clas_ssr2osr(), corr_iono_plane(), corr_trop_plane(), ddres(), ddres(), ddres(), decode_type1005(), decode_type1006(), dump_stas(), get_site(), gettriangledd(), outenu(), outnmea_gga(), outnmea_rmc(), outpos(), outrnxevent(), outrpos(), ppp_rtk_pos(), ppprtk_outstat(), rescode(), resdop(), rtkoutstat(), rtksvrmark(), selpersta(), setopt_sta(), setpcv(), sta_sel_iono(), sta_sel_trop(), sysopts2buff(), udpos(), udpos(), udpos_ppp(), update_antpos(), windupcorr(), zdres(), and zdres().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eci2ecef()

void eci2ecef ( gtime_t tutc,
const double * erpv,
double * U,
double * gmst )

Compute ECI to ECEF transformation matrix.

Parameters
[in]tutcTime in UTC
[in]erpvERP values {xp, yp, ut1_utc, lod} (rad, rad, s, s/d)
[out]UECI to ECEF transformation matrix (3x3)
[in,out]gmstGreenwich mean sidereal time (rad) (NULL: no output)
Note
Not thread-safe (uses static cache).

Definition at line 399 of file mrtk_coords.c.

References AS2R, ast_args(), epoch2time(), matmul(), NP, nut_iau1980(), Rx, Ry, Rz, time_str(), timediff(), trace(), tracemat(), utc2gmst(), and utc2gpst().

Referenced by sunmoonpos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enu2ecef()

void enu2ecef ( const double * pos,
const double * e,
double * r )

Transform local tangential coordinate vector to ECEF.

Parameters
[in]posGeodetic position {lat, lon} (rad)
[in]eVector in local tangential coordinate {e, n, u}
[out]rVector in ECEF coordinate {x, y, z}

Definition at line 175 of file mrtk_coords.c.

References matmul(), and xyz2enu().

Referenced by antpos(), and update_antpos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ geodist()

double geodist ( const double * rs,
const double * rr,
double * e )

Compute geometric distance and receiver-to-satellite unit vector.

Parameters
[in]rsSatellite position (ECEF at transmission) (m)
[in]rrReceiver position (ECEF at reception) (m)
[out]eLine-of-sight vector (ECEF)
Returns
Geometric distance (m) (<0: error/no satellite position)
Note
Distance includes Sagnac effect correction.

Definition at line 493 of file mrtk_coords.c.

References CLIGHT, norm(), OMGE, and RE_WGS84.

Referenced by clas_osr_adjust_r_dts(), clas_osr_zdres(), rescode(), zdres(), and zdres().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pos2ecef()

void pos2ecef ( const double * pos,
double * r )

Transform geodetic position to ECEF position.

Parameters
[in]posGeodetic position {lat, lon, h} (rad, m)
[out]rECEF position {x, y, z} (m)
Note
WGS84, ellipsoidal height.

Definition at line 122 of file mrtk_coords.c.

References FE_WGS84, and RE_WGS84.

Referenced by buff2sysopts(), decode_bnx_00(), decode_lcliono(), decode_lcltrop(), decode_nmeagga(), decode_nmearmc(), decode_pvtgeodetic(), decode_refpos(), decode_solllh(), get_site(), getstapos(), miono_sel_area(), and selpersta().

Here is the caller graph for this function:

◆ satazel()

double satazel ( const double * pos,
const double * e,
double * azel )

Compute satellite azimuth/elevation angle.

Parameters
[in]posGeodetic position {lat, lon, h} (rad, m)
[in]eReceiver-to-satellite unit vector (ECEF)
[in,out]azelAzimuth/elevation {az, el} (rad) (NULL: no output) (0.0<=azel[0]<2*pi, -pi/2<=azel[1]<=pi/2)
Returns
Elevation angle (rad)

Definition at line 517 of file mrtk_coords.c.

References dot(), ecef2enu(), PI, and RE_WGS84.

Referenced by clas_osr_zdres(), rescode(), zdres(), and zdres().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xyz2enu()

void xyz2enu ( const double * pos,
double * E )

Compute ECEF to local coordinate transformation matrix.

Parameters
[in]posGeodetic position {lat, lon} (rad)
[out]EECEF to local coord transformation matrix (3x3)
Note
Matrix stored by column-major order (Fortran convention).

Definition at line 142 of file mrtk_coords.c.

Referenced by clas_osr_zdres(), covecef(), covenu(), ecef2enu(), enu2ecef(), resdop(), tidedisp(), and windupcorr().

Here is the caller graph for this function: