|
MRTKLIB 0.7.14
Modernized GNSS Positioning Library
|
MRTKLIB Coordinates Module — Coordinate transformations and geometry. More...
#include "mrtklib/mrtk_coords.h"#include <math.h>#include <string.h>#include "mrtklib/mrtk_trace.h"Go to the source code of this file.
Macros | |
| #define | PI 3.1415926535897932 /* pi */ |
| #define | D2R (PI / 180.0) /* deg to rad */ |
| #define | AS2R (D2R / 3600.0) /* arc sec to radian */ |
| #define | RE_WGS84 6378137.0 /* earth semimajor axis (WGS84) (m) */ |
| #define | FE_WGS84 (1.0 / 298.257223563) /* earth flattening (WGS84) */ |
| #define | OMGE 7.2921151467E-5 /* earth angular velocity (IS-GPS) (rad/s) */ |
| #define | CLIGHT 299792458.0 /* speed of light (m/s) */ |
| #define | MAXSAT 256 |
| #define | Rx(t, X) |
| #define | Ry(t, X) |
| #define | Rz(t, X) |
| #define | SQRT(x) |
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. | |
| static void | ast_args (double t, double *f) |
| static void | nut_iau1980 (double t, const double *f, double *dpsi, double *deps) |
| 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). | |
MRTKLIB Coordinates Module — Coordinate transformations and geometry.
This file contains all coordinate transformation and positioning geometry functions extracted from rtkcmn.c with zero algorithmic changes (pure cut-and-paste).
Definition in file mrtk_coords.c.
| #define AS2R (D2R / 3600.0) /* arc sec to radian */ |
Definition at line 37 of file mrtk_coords.c.
Referenced by ast_args(), ast_args(), eci2ecef(), nut_iau1980(), readerp(), and tide_pole().
| #define CLIGHT 299792458.0 /* speed of light (m/s) */ |
Definition at line 41 of file mrtk_coords.c.
Referenced by clas_osr_adjust_r_dts(), clas_osr_zdres(), corr_meas(), ddres(), ddres(), decode_bnx_7f_05_obs(), decode_cresgloraw(), decode_cresraw(), decode_cresraw2(), decode_measepoch(), decode_rangeb(), decode_rangecmpb(), decode_Rx(), decode_rx(), decode_rxmraw(), decode_rxmrawx(), decode_ss2meas(), decode_trkd5(), decode_trkmeas(), decode_type1002(), decode_type1004(), decode_type1010(), decode_type1012(), decode_xf5raw(), decode_xP(), decode_xp(), decode_xR(), decode_xr(), DecodeType17(), eph2pos(), estpos(), gen_msm_sat(), gen_msm_sig(), gen_obs_glo(), gen_obs_gps(), geodist(), get_wavelength(), gettgd(), gfmeas(), gfobs(), gloicbcorr(), has_code2lam(), ionmodel(), mwmeas(), peph2pos(), pephclk(), pephpos(), ppp_res(), pppoutstat(), readdcbf(), readfcbf(), readisbf(), readtec(), rescode(), resdop(), sat_lambda(), sat_lambda(), sat_wavelengths(), satpos_ssr(), satposs(), save_msm_obs(), sbslongcorr(), sbssatcorr(), shapiro(), udbias(), udbias_ppp(), udclk_ppp(), update_stat(), varerr(), varerr(), zdres(), zdres(), and zdres_sat().
| #define D2R (PI / 180.0) /* deg to rad */ |
Definition at line 36 of file mrtk_coords.c.
Referenced by buff2sysopts(), corr_trop_plane(), decode_bnx_00(), decode_cssr_atmos(), decode_cssr_grid(), decode_lcliono(), decode_lcltrop(), decode_nmeagga(), decode_nmearmc(), decode_pvtgeodetic(), decode_refpos(), decode_solllh(), decode_solstat(), decode_stat(), find_grid_surround_pos(), getstapos(), initblkinf(), ionppp(), miono_sel_area(), output_selected_grid(), pickup_candidates_of_grid(), readpos(), sta_sel_iono(), sta_sel_trop(), sunmoonpos_eci(), tide_oload(), trop_data(), udiono_ppp(), zdres(), and zdres().
| #define FE_WGS84 (1.0 / 298.257223563) /* earth flattening (WGS84) */ |
Definition at line 39 of file mrtk_coords.c.
Referenced by ecef2pos(), and pos2ecef().
| #define MAXSAT 256 |
Definition at line 45 of file mrtk_coords.c.
Referenced by add_base_value_to_cbias(), add_base_value_to_pbias(), buff2sysopts(), check_same_fac(), clas_bank_get_close(), clas_osr_compensatedisp(), clas_osr_ctx_init(), clas_osr_zdres(), clas_restore_backup(), clas_ssr2osr(), clas_update_global(), combpclk(), combpeph(), convnav(), corr_iono_distwgt(), corr_iono_plane(), ddidx(), ddmat(), ddmat(), ddres(), ddres(), ddres(), decode_bnx_01_04(), decode_bnx_01_14(), decode_cssr_bias(), decode_cssr_cb(), decode_cssr_cc(), decode_cssr_combo(), decode_cssr_oc(), decode_cssr_pb(), decode_eph(), decode_galephemerisb(), decode_galinavephemerisb(), decode_galrawfnav(), decode_has_mask(), decode_lcliono(), decode_longcorr0(), decode_longcorr1(), decode_mcssr_mask(), decode_sbstype1(), decode_sbstype6(), decode_sbstype7(), decode_trkd5(), decode_trkmeas(), decode_type1045(), decoderaw(), detslp_dop(), dops(), dump_halfc(), encode_ssr1(), encode_ssr2(), encode_ssr3(), encode_ssr4(), encode_ssr5(), encode_ssr6(), encode_ssr7(), encode_type1045(), estpos(), exclsat(), flushobuf(), free_strfile(), freebiass(), gen_strfile(), get_iono_sta(), grid_intp_iono(), holdamb(), holdamb(), holdamb(), init_grid_index(), init_mdcl6d(), init_raw(), init_rnxctr(), init_rtcm(), input_rnxctr(), load_ppp_osr_cpc(), miono_get_corr(), nextsat(), outbsnxsol(), outnmea_gsa(), outnmea_gsv(), outsolstat(), peph2pos(), pntpos(), ppp_amb_ILS(), ppp_res(), ppp_rtk_pos(), pppos(), pppoutstat(), ppprtk_outstat(), raw2rtcm(), readbnxfp(), readdcb(), readionexdcb(), readrnxclk(), readrnxobs(), readsap(), readsp3(), readsp3b(), readsp3h(), readtec(), relpos(), relposvrs(), rescode(), residual_test(), residual_test(), restamb(), restamb(), restamb(), rtcm2rtcm(), rtkinit(), rtkoutstat(), rtksvrinit(), rtksvrstart(), satsys(), save_ppp_osr_cpc(), savenav(), search_amb_lambda(), seleph(), selsat(), set_cssr_bank_cbias(), set_cssr_bank_clock(), set_cssr_bank_orbit(), set_cssr_bank_pbias(), setpcv(), sta_sel_iono(), sysopts2buff(), test_hold_amb(), tracepclk(), tracepeph(), udbias(), udbias_ppp(), udbias_ppp(), udbias_ppp(), udfcb_sat(), udion(), udion(), udion(), udiono_ppp(), udosb_sat(), udosb_station(), udpos(), udsatcb(), udsatpb(), udstacb(), update_eph(), update_gal_has(), update_qzssl6d(), update_qzssl6e(), update_rtcm(), update_ssr(), update_stat(), update_stat(), update_stat(), and valid_zd_sig().
| #define OMGE 7.2921151467E-5 /* earth angular velocity (IS-GPS) (rad/s) */ |
Definition at line 40 of file mrtk_coords.c.
Referenced by alm2pos(), eph2pos(), geodist(), pephpos(), resdop(), sat_yaw(), and windupcorr().
| #define PI 3.1415926535897932 /* pi */ |
Definition at line 35 of file mrtk_coords.c.
Referenced by ast_args(), ast_args(), corr_trop_distwgt(), decode_bdsnav(), decode_galnav(), decode_gpsnav(), decode_lcltrop(), decode_qzssnav(), ecef2pos(), encode_lcltrop(), exc_sat_par(), get_mops(), iondelay(), ionmapf(), ionmodel(), ionppp(), model_phw(), nmf(), sat_yaw(), satazel(), sbstropcorr(), testeclipse(), tide_oload(), trop_model_prec(), tropmapf(), tropmodel(), udtrop_ppp(), utc2gmst(), windupcorr(), and yaw_nominal().
| #define RE_WGS84 6378137.0 /* earth semimajor axis (WGS84) (m) */ |
Definition at line 38 of file mrtk_coords.c.
Referenced by ecef2pos(), geodist(), ionmapf(), pickup_candidates_of_grid(), pos2ecef(), satazel(), sunmoonpos_eci(), testeclipse(), and tide_pl().
| #define Rx | ( | t, | |
| X ) |
Definition at line 215 of file mrtk_coords.c.
Referenced by eci2ecef().
| #define Ry | ( | t, | |
| X ) |
Definition at line 224 of file mrtk_coords.c.
Referenced by eci2ecef().
| #define Rz | ( | t, | |
| X ) |
Definition at line 233 of file mrtk_coords.c.
Referenced by eci2ecef().
| #define SQRT | ( | x | ) |
Definition at line 543 of file mrtk_coords.c.
Referenced by dops(), outecef(), outenu(), outpos(), and ppprtk_outstat().
|
static |
Definition at line 243 of file mrtk_coords.c.
Referenced by eci2ecef().
|
extern |
Transform local ENU covariance to ECEF coordinate.
| [in] | pos | Geodetic position {lat, lon} (rad) |
| [in] | Q | Covariance in local ENU coordinate |
| [out] | P | Covariance in ECEF coordinate |
Definition at line 202 of file mrtk_coords.c.
References matmul(), and xyz2enu().
Referenced by decode_solllh(), udpos(), udpos(), udpos_ppp(), and udpos_ppp().
|
extern |
Transform ECEF covariance to local tangential coordinate.
| [in] | pos | Geodetic position {lat, lon} (rad) |
| [in] | P | Covariance in ECEF coordinate |
| [out] | Q | Covariance in local tangential coordinate |
Definition at line 188 of file mrtk_coords.c.
References matmul(), and xyz2enu().
Referenced by const_iono_corr(), outenu(), and outpos().
|
extern |
Convert degree to degree-minute-second.
| [in] | deg | Degree |
| [out] | dms | Degree-minute-second {deg, min, sec} |
| [in] | ndec | Number of decimals of second |
Definition at line 63 of file mrtk_coords.c.
Referenced by outnmea_gga(), outnmea_rmc(), outpos(), and outrpos().
|
extern |
Convert degree-minute-second to degree.
| [in] | dms | Degree-minute-second {deg, min, sec} |
Definition at line 86 of file mrtk_coords.c.
Referenced by decode_refpos(), and decode_solllh().
|
extern |
Compute DOP (dilution of precision).
| [in] | ns | Number of satellites |
| [in] | azel | Satellite azimuth/elevation angle (rad) |
| [in] | elmin | Elevation cutoff angle (rad) |
| [out] | dop | DOPs {GDOP, PDOP, HDOP, VDOP} |
Definition at line 545 of file mrtk_coords.c.
References matinv(), matmul(), MAXSAT, and SQRT.
Referenced by outnmea_gsa(), valsol(), zddop(), and zddop().
|
extern |
Transform ECEF vector to local tangential coordinate.
| [in] | pos | Geodetic position {lat, lon} (rad) |
| [in] | r | Vector in ECEF coordinate {x, y, z} |
| [out] | e | Vector 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(), pppoutstat(), ppprtk_outstat(), rtkoutstat(), satazel(), setopt_sta(), and setpcv().
|
extern |
Transform ECEF position to geodetic position.
| [in] | r | ECEF position {x, y, z} (m) |
| [out] | pos | Geodetic position {lat, lon, h} (rad, m) |
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(), const_iono_corr(), corr_iono_plane(), corr_trop_plane(), ddres(), ddres(), ddres(), decode_type1005(), decode_type1006(), dump_stas(), get_site(), gettriangledd(), miono_get_corr(), model_phw(), outenu(), outnmea_gga(), outnmea_rmc(), outpos(), outrnxevent(), outrpos(), ppp_res(), ppp_rtk_pos(), pppoutstat(), ppprtk_outstat(), rescode(), resdop(), rtkoutstat(), rtksvrmark(), selpersta(), setopt_sta(), setpcv(), sta_sel_iono(), sta_sel_trop(), sysopts2buff(), udbias_ppp(), udiono_ppp(), udpos(), udpos(), udpos_ppp(), udpos_ppp(), udtrop_ppp(), update_antpos(), windupcorr(), zdres(), and zdres().
|
extern |
Compute ECI to ECEF transformation matrix.
| [in] | tutc | Time in UTC |
| [in] | erpv | ERP values {xp, yp, ut1_utc, lod} (rad, rad, s, s/d) |
| [out] | U | ECI to ECEF transformation matrix (3x3) |
| [in,out] | gmst | Greenwich mean sidereal time (rad) (NULL: no output) |
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().
|
extern |
Transform local tangential coordinate vector to ECEF.
| [in] | pos | Geodetic position {lat, lon} (rad) |
| [in] | e | Vector in local tangential coordinate {e, n, u} |
| [out] | r | Vector in ECEF coordinate {x, y, z} |
Definition at line 175 of file mrtk_coords.c.
References matmul(), and xyz2enu().
Referenced by antpos(), decode_solllh(), and update_antpos().
|
extern |
Compute geometric distance and receiver-to-satellite unit vector.
| [in] | rs | Satellite position (ECEF at transmission) (m) |
| [in] | rr | Receiver position (ECEF at reception) (m) |
| [out] | e | Line-of-sight vector (ECEF) |
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(), ppp_res(), rescode(), zdres(), and zdres().
|
static |
Definition at line 265 of file mrtk_coords.c.
References AS2R.
Referenced by eci2ecef().
|
extern |
Transform geodetic position to ECEF position.
| [in] | pos | Geodetic position {lat, lon, h} (rad, m) |
| [out] | r | ECEF position {x, y, z} (m) |
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().
|
extern |
Compute satellite azimuth/elevation angle.
| [in] | pos | Geodetic position {lat, lon, h} (rad, m) |
| [in] | e | Receiver-to-satellite unit vector (ECEF) |
| [in,out] | azel | Azimuth/elevation {az, el} (rad) (NULL: no output) (0.0<=azel[0]<2*pi, -pi/2<=azel[1]<=pi/2) |
Definition at line 517 of file mrtk_coords.c.
References dot(), ecef2enu(), PI, and RE_WGS84.
Referenced by clas_osr_zdres(), ppp_res(), rescode(), zdres(), and zdres().
|
extern |
Compute ECEF to local coordinate transformation matrix.
| [in] | pos | Geodetic position {lat, lon} (rad) |
| [out] | E | ECEF to local coord transformation matrix (3x3) |
Definition at line 142 of file mrtk_coords.c.
Referenced by clas_osr_zdres(), covecef(), covenu(), ecef2enu(), enu2ecef(), model_phw(), resdop(), tidedisp(), and windupcorr().