gps_pvt 0.6.3 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/Rakefile +1 -0
- data/exe/gps_pvt +3 -1
- data/exe/to_ubx +1 -0
- data/ext/gps_pvt/GPS/GPS_wrap.cxx +986 -295
- data/ext/gps_pvt/SylphideMath/SylphideMath_wrap.cxx +2 -3
- data/ext/ninja-scan-light/tool/navigation/ANTEX.h +1 -1
- data/ext/ninja-scan-light/tool/navigation/GLONASS_Solver.h +1 -1
- data/ext/ninja-scan-light/tool/navigation/GPS_Solver.h +1 -1
- data/ext/ninja-scan-light/tool/navigation/GPS_Solver_Base.h +8 -13
- data/ext/ninja-scan-light/tool/navigation/GPS_Solver_RAIM.h +29 -1
- data/ext/ninja-scan-light/tool/navigation/MagneticField.h +4 -3
- data/ext/ninja-scan-light/tool/navigation/NTCM.h +1 -1
- data/ext/ninja-scan-light/tool/navigation/RINEX.h +29 -14
- data/ext/ninja-scan-light/tool/navigation/RINEX_Clock.h +458 -0
- data/ext/ninja-scan-light/tool/navigation/SBAS.h +3 -3
- data/ext/ninja-scan-light/tool/navigation/SBAS_Solver.h +1 -1
- data/ext/ninja-scan-light/tool/navigation/SP3.h +49 -42
- data/ext/ninja-scan-light/tool/param/bit_array.h +2 -2
- data/ext/ninja-scan-light/tool/param/quaternion.h +2 -2
- data/ext/ninja-scan-light/tool/param/vector3.h +2 -2
- data/ext/ninja-scan-light/tool/swig/GPS.i +117 -51
- data/ext/ninja-scan-light/tool/swig/SylphideMath.i +1 -2
- data/ext/ninja-scan-light/tool/swig/spec/GPS_spec.rb +121 -0
- data/lib/gps_pvt/receiver.rb +27 -2
- data/lib/gps_pvt/version.rb +1 -1
- metadata +3 -2
@@ -3002,7 +3002,6 @@ struct MatrixUtil {
|
|
3002
3002
|
}
|
3003
3003
|
static VALUE read(
|
3004
3004
|
const VALUE &v, const unsigned int &row = 0, const unsigned int &column = 0) {
|
3005
|
-
int state;
|
3006
3005
|
VALUE values[3] = {v, UINT2NUM(row), UINT2NUM(column)};
|
3007
3006
|
return funcall_throw_if_error(run, reinterpret_cast<VALUE>(values));
|
3008
3007
|
}
|
@@ -3355,7 +3354,7 @@ SWIGINTERN std::string Matrix_Frozen_Sl_double_Sc_Array2D_Dense_Sl_double_Sg__Sc
|
|
3355
3354
|
static const ID with_index[] = {
|
3356
3355
|
rb_intern("map_with_index"), rb_intern("map_with_index!"),
|
3357
3356
|
rb_intern("collect_with_index"), rb_intern("collect_with_index!")};
|
3358
|
-
for(
|
3357
|
+
for(std::size_t i(0); i < sizeof(with_index) / sizeof(with_index[0]); ++i){
|
3359
3358
|
if(id_callee == with_index[i]){
|
3360
3359
|
return matrix_yield_get_with_index;
|
3361
3360
|
}
|
@@ -3829,7 +3828,7 @@ SWIGINTERN std::string Matrix_Frozen_Sl_Complex_Sl_double_Sg__Sc_Array2D_Dense_S
|
|
3829
3828
|
static const ID with_index[] = {
|
3830
3829
|
rb_intern("map_with_index"), rb_intern("map_with_index!"),
|
3831
3830
|
rb_intern("collect_with_index"), rb_intern("collect_with_index!")};
|
3832
|
-
for(
|
3831
|
+
for(std::size_t i(0); i < sizeof(with_index) / sizeof(with_index[0]); ++i){
|
3833
3832
|
if(id_callee == with_index[i]){
|
3834
3833
|
return matrix_yield_get_with_index;
|
3835
3834
|
}
|
@@ -604,7 +604,7 @@ class ANTEX_Reader {
|
|
604
604
|
typedef typename ANTEX_Product<FloatT>::antenna_t antenna_t;
|
605
605
|
antenna_t *antenna;
|
606
606
|
typedef typename ANTEX_Product<FloatT>::per_freq_t per_freq_t;
|
607
|
-
per_freq_t *per_freq;
|
607
|
+
per_freq_t *per_freq(NULL); // NULL fot suppression of GCC uninitialized variable warning
|
608
608
|
|
609
609
|
while(src.has_next()){
|
610
610
|
parsed_t parsed(src.parse_line());
|
@@ -133,7 +133,7 @@ class GLONASS_SinglePositioning : public SolverBaseT {
|
|
133
133
|
}
|
134
134
|
};
|
135
135
|
satellite_t res = {
|
136
|
-
&(it_sat->second),
|
136
|
+
&(it_sat->second), &(it_sat->second),
|
137
137
|
impl_t::position, impl_t::velocity,
|
138
138
|
impl_t::clock_error, impl_t::clock_error_dot};
|
139
139
|
return res;
|
@@ -157,7 +157,7 @@ class GPS_SinglePositioning : public SolverBaseT {
|
|
157
157
|
}
|
158
158
|
};
|
159
159
|
satellite_t res = {
|
160
|
-
&(it_sat->second),
|
160
|
+
&(it_sat->second), &(it_sat->second),
|
161
161
|
impl_t::position, impl_t::velocity,
|
162
162
|
impl_t::clock_error, impl_t::clock_error_dot};
|
163
163
|
return res;
|
@@ -227,13 +227,13 @@ struct GPS_Solver_Base {
|
|
227
227
|
}
|
228
228
|
|
229
229
|
struct satellite_t {
|
230
|
-
const void *
|
230
|
+
const void *impl_xyz, *impl_t; ///< pointer to actual implementation to return position and clock error
|
231
231
|
xyz_t (*impl_position)(const void *, const gps_time_t &, const float_t &);
|
232
232
|
xyz_t (*impl_velocity)(const void *, const gps_time_t &, const float_t &);
|
233
233
|
float_t (*impl_clock_error)(const void *, const gps_time_t &);
|
234
234
|
float_t (*impl_clock_error_dot)(const void *, const gps_time_t &);
|
235
235
|
inline bool is_available() const {
|
236
|
-
return
|
236
|
+
return (impl_xyz != NULL) && (impl_t != NULL);
|
237
237
|
}
|
238
238
|
/**
|
239
239
|
* Return satellite position at the transmission time in EFEC.
|
@@ -244,28 +244,28 @@ struct GPS_Solver_Base {
|
|
244
244
|
* that is, the transmission time added by the transit time.
|
245
245
|
*/
|
246
246
|
inline xyz_t position(const gps_time_t &t_tx, const float_t &dt_transit = 0) const {
|
247
|
-
return impl_position(
|
247
|
+
return impl_position(impl_xyz, t_tx, dt_transit);
|
248
248
|
}
|
249
249
|
/**
|
250
250
|
* Return satellite velocity at the transmission time in EFEC.
|
251
251
|
* @see position
|
252
252
|
*/
|
253
253
|
inline xyz_t velocity(const gps_time_t &t_tx, const float_t &dt_transit = 0) const {
|
254
|
-
return impl_velocity(
|
254
|
+
return impl_velocity(impl_xyz, t_tx, dt_transit);
|
255
255
|
}
|
256
256
|
/**
|
257
257
|
* Return satellite clock error [s] at the transmission time.
|
258
258
|
* @param t_tx transmission time
|
259
259
|
*/
|
260
260
|
inline float_t clock_error(const gps_time_t &t_tx) const {
|
261
|
-
return impl_clock_error(
|
261
|
+
return impl_clock_error(impl_t, t_tx);
|
262
262
|
}
|
263
263
|
/**
|
264
264
|
* Return satellite clock error derivative [s/s] at the transmission time.
|
265
265
|
* @param t_tx transmission time
|
266
266
|
*/
|
267
267
|
inline float_t clock_error_dot(const gps_time_t &t_tx) const {
|
268
|
-
return impl_clock_error_dot(
|
268
|
+
return impl_clock_error_dot(impl_t, t_tx);
|
269
269
|
}
|
270
270
|
static const satellite_t &unavailable() {
|
271
271
|
struct impl_t {
|
@@ -276,7 +276,7 @@ struct GPS_Solver_Base {
|
|
276
276
|
return float_t(0);
|
277
277
|
}
|
278
278
|
};
|
279
|
-
static const satellite_t res = {NULL, impl_t::v3, impl_t::v3, impl_t::v, impl_t::v};
|
279
|
+
static const satellite_t res = {NULL, NULL, impl_t::v3, impl_t::v3, impl_t::v, impl_t::v};
|
280
280
|
return res;
|
281
281
|
}
|
282
282
|
};
|
@@ -474,12 +474,7 @@ struct GPS_Solver_Base {
|
|
474
474
|
using super_t::reset;
|
475
475
|
void reset(const int &prn) {set(prn, false);}
|
476
476
|
std::vector<int> excluded() const {
|
477
|
-
|
478
|
-
for(std::vector<int>::iterator it(res.begin()), it_end(res.end());
|
479
|
-
it != it_end; ++it){
|
480
|
-
*it += prn_begin;
|
481
|
-
}
|
482
|
-
return res;
|
477
|
+
return super_t::indices_one(prn_begin);
|
483
478
|
}
|
484
479
|
};
|
485
480
|
};
|
@@ -60,6 +60,12 @@ struct GPS_PVT_RAIM_LSR : public PVT_BaseT {
|
|
60
60
|
} FDE_min, FDE_2nd; ///< Fault exclusion
|
61
61
|
};
|
62
62
|
|
63
|
+
template <class FloatT>
|
64
|
+
struct GPS_Solver_RAIM_LSR_Options {
|
65
|
+
bool skip_exclusion;
|
66
|
+
GPS_Solver_RAIM_LSR_Options() : skip_exclusion(false) {}
|
67
|
+
};
|
68
|
+
|
63
69
|
/*
|
64
70
|
* Comment on implementation of protection level (PL) calculation
|
65
71
|
*
|
@@ -96,6 +102,27 @@ struct GPS_Solver_RAIM_LSR : public SolverBaseT {
|
|
96
102
|
inheritate_type(measurement2_t);
|
97
103
|
#undef inheritate_type
|
98
104
|
|
105
|
+
typedef typename GPS_Solver_Base<float_t>::options_t::template merge_t<
|
106
|
+
GPS_Solver_RAIM_LSR_Options<float_t>, super_t> options_t;
|
107
|
+
|
108
|
+
protected:
|
109
|
+
GPS_Solver_RAIM_LSR_Options<float_t> _options;
|
110
|
+
|
111
|
+
public:
|
112
|
+
options_t available_options() const {
|
113
|
+
return options_t(super_t::available_options(), _options);
|
114
|
+
}
|
115
|
+
|
116
|
+
options_t available_options(const options_t &opt_wish) const {
|
117
|
+
GPS_Solver_RAIM_LSR_Options<float_t> opt(opt_wish);
|
118
|
+
return options_t(super_t::available_options(opt_wish), opt);
|
119
|
+
}
|
120
|
+
|
121
|
+
options_t update_options(const options_t &opt_wish){
|
122
|
+
_options = opt_wish;
|
123
|
+
return options_t(super_t::update_options(opt_wish), _options);
|
124
|
+
}
|
125
|
+
|
99
126
|
typedef GPS_PVT_RAIM_LSR<float_t, typename super_t::user_pvt_t> user_pvt_t;
|
100
127
|
|
101
128
|
typename super_t::template solver_interface_t<self_t> solve() const {
|
@@ -155,7 +182,8 @@ protected:
|
|
155
182
|
user_position_init, receiver_error_init,
|
156
183
|
opt);
|
157
184
|
|
158
|
-
if(
|
185
|
+
if(_options.skip_exclusion
|
186
|
+
|| !pvt.position_solved()
|
159
187
|
|| (!pvt.FD.valid)
|
160
188
|
|| (pvt.used_satellites < 6)){return;}
|
161
189
|
|
@@ -143,16 +143,17 @@ class MagneticFieldGeneric {
|
|
143
143
|
field_components_res_t res;
|
144
144
|
|
145
145
|
// @see http://mooring.ucsd.edu/software/matlab/mfiles/toolbox/geo/IGRF/geomag60.c
|
146
|
+
// @see https://web.archive.org/web/20171008182325/http://mooring.ucsd.edu/software/matlab/mfiles/toolbox/geo/IGRF/geomag60.c
|
146
147
|
|
147
|
-
const FloatT slat(sin_geocentric_latitude);
|
148
|
-
const FloatT clat(cos_geocentric_latitude);
|
148
|
+
const FloatT &slat(sin_geocentric_latitude);
|
149
|
+
const FloatT &clat(cos_geocentric_latitude);
|
149
150
|
|
150
151
|
FloatT sl[13] = {sin(longitude_rad)};
|
151
152
|
FloatT cl[13] = {cos(longitude_rad)};
|
152
153
|
|
153
154
|
res.north = res.east = res.down = 0;
|
154
155
|
|
155
|
-
FloatT aa, bb, cc, rr;
|
156
|
+
FloatT aa, bb, cc, rr(0); // rr(0) for suppression of warning of use of uninitialized variable
|
156
157
|
|
157
158
|
aa = sqrt(3.0);
|
158
159
|
FloatT p[118] = {
|
@@ -66,7 +66,7 @@ class NTCM_GL_Generic {
|
|
66
66
|
return cos_Chi_star3
|
67
67
|
+ (C[0] * std::cos(v_D)
|
68
68
|
+ C[1] * std::cos(v_SD) + C[2] * std::sin(v_SD)
|
69
|
-
+ C[3] * std::cos(v_TD) + C[4] * std::sin(v_TD)) *
|
69
|
+
+ C[3] * std::cos(v_TD) + C[4] * std::sin(v_TD)) * cos_Chi_star2;
|
70
70
|
}
|
71
71
|
|
72
72
|
static const float_t doy_A, doy_SA;
|
@@ -76,6 +76,7 @@ class RINEX_Reader {
|
|
76
76
|
FTYPE_OBSERVATION,
|
77
77
|
FTYPE_NAVIGATION,
|
78
78
|
FTYPE_METEOROLOGICAL,
|
79
|
+
FTYPE_CLOCK,
|
79
80
|
} file_type;
|
80
81
|
enum sat_system_t {
|
81
82
|
SYS_UNKNOWN = 0,
|
@@ -89,6 +90,19 @@ class RINEX_Reader {
|
|
89
90
|
SYS_TRANSIT,
|
90
91
|
SYS_MIXED,
|
91
92
|
} sat_system;
|
93
|
+
static sat_system_t char2sys_v3(const char &c){
|
94
|
+
switch(c){
|
95
|
+
case 'G': return SYS_GPS;
|
96
|
+
case 'R': return SYS_GLONASS;
|
97
|
+
case 'E': return SYS_GALILEO;
|
98
|
+
case 'J': return SYS_QZSS;
|
99
|
+
case 'C': return SYS_BDS;
|
100
|
+
case 'I': return SYS_IRNSS;
|
101
|
+
case 'S': return SYS_SBAS;
|
102
|
+
case 'M': return SYS_MIXED;
|
103
|
+
}
|
104
|
+
return SYS_UNKNOWN;
|
105
|
+
}
|
92
106
|
version_type_t(
|
93
107
|
const int &ver = 0, const file_type_t &ftype = FTYPE_UNKNOWN, const sat_system_t &sys = SYS_UNKNOWN)
|
94
108
|
: version(ver), file_type(ftype), sat_system(sys) {}
|
@@ -105,7 +119,7 @@ class RINEX_Reader {
|
|
105
119
|
: src(in), _has_next(false),
|
106
120
|
version_type() {
|
107
121
|
if(src.fail()){return;}
|
108
|
-
|
122
|
+
|
109
123
|
char buf[256];
|
110
124
|
|
111
125
|
// Read header
|
@@ -135,7 +149,13 @@ class RINEX_Reader {
|
|
135
149
|
version_type.parse(it->second.front());
|
136
150
|
break;
|
137
151
|
}
|
138
|
-
|
152
|
+
}
|
153
|
+
RINEX_Reader(
|
154
|
+
std::istream &in,
|
155
|
+
void (RINEX_Reader::*read_header)())
|
156
|
+
: src(in), _has_next(false),
|
157
|
+
version_type() {
|
158
|
+
(this->*read_header)();
|
139
159
|
}
|
140
160
|
virtual ~RINEX_Reader(){_header.clear();}
|
141
161
|
header_t &header() {return _header;}
|
@@ -235,6 +255,7 @@ void RINEX_Reader<U>::version_type_t::parse(const std::string &buf){
|
|
235
255
|
case 'H': file_type = FTYPE_NAVIGATION;
|
236
256
|
sat_system = SYS_SBAS; // TODO: Is geostational as SBAS?
|
237
257
|
break;
|
258
|
+
case 'C': file_type = FTYPE_CLOCK; break;
|
238
259
|
}
|
239
260
|
break;
|
240
261
|
case 3:
|
@@ -242,18 +263,12 @@ void RINEX_Reader<U>::version_type_t::parse(const std::string &buf){
|
|
242
263
|
case 'O': file_type = FTYPE_OBSERVATION; break;
|
243
264
|
case 'N': file_type = FTYPE_NAVIGATION; break;
|
244
265
|
case 'M': file_type = FTYPE_METEOROLOGICAL; break;
|
266
|
+
case 'C': file_type = FTYPE_CLOCK; break;
|
245
267
|
}
|
246
|
-
if((file_type == FTYPE_OBSERVATION)
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
case 'E': sat_system = SYS_GALILEO; break;
|
251
|
-
case 'J': sat_system = SYS_QZSS; break;
|
252
|
-
case 'C': sat_system = SYS_BDS; break;
|
253
|
-
case 'I': sat_system = SYS_IRNSS; break;
|
254
|
-
case 'S': sat_system = SYS_SBAS; break;
|
255
|
-
case 'M': sat_system = SYS_MIXED; break;
|
256
|
-
}
|
268
|
+
if((file_type == FTYPE_OBSERVATION)
|
269
|
+
|| (file_type == FTYPE_NAVIGATION)
|
270
|
+
|| (file_type == FTYPE_CLOCK)){
|
271
|
+
sat_system = char2sys_v3(buf[40]);
|
257
272
|
}
|
258
273
|
break;
|
259
274
|
}
|
@@ -306,7 +321,7 @@ void RINEX_Reader<U>::version_type_t::dump(std::string &buf) const {
|
|
306
321
|
switch(sat_system){
|
307
322
|
case SYS_GPS: sys_str = "G: GPS"; break;
|
308
323
|
case SYS_GLONASS: sys_str = "R: GLONASS"; break;
|
309
|
-
case SYS_GALILEO: sys_str = "
|
324
|
+
case SYS_GALILEO: sys_str = "E: GALILEO"; break;
|
310
325
|
case SYS_QZSS: sys_str = "Q: QZSS"; break;
|
311
326
|
case SYS_BDS: sys_str = "B: BDS"; break;
|
312
327
|
case SYS_IRNSS: sys_str = "I: IRNSS"; break;
|