gps_pvt 0.9.2 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +159 -3
- data/README.md +1 -1
- data/Rakefile +7 -0
- data/ext/gps_pvt/Coordinate/Coordinate_wrap.cxx +84 -38
- data/ext/gps_pvt/GPS/GPS_wrap.cxx +616 -4120
- data/ext/gps_pvt/SylphideMath/SylphideMath_wrap.cxx +5320 -3913
- data/ext/gps_pvt/extconf.rb +6 -5
- data/ext/ninja-scan-light/tool/navigation/GLONASS_Solver.h +1 -1
- data/ext/ninja-scan-light/tool/navigation/GPS.h +6 -2
- data/ext/ninja-scan-light/tool/navigation/GPS_Solver.h +1 -1
- data/ext/ninja-scan-light/tool/navigation/GPS_Solver_Base.h +3 -1
- data/ext/ninja-scan-light/tool/navigation/GPS_Solver_MultiFrequency.h +3 -0
- data/ext/ninja-scan-light/tool/navigation/RINEX.h +9 -9
- data/ext/ninja-scan-light/tool/navigation/SBAS_Solver.h +1 -1
- data/ext/ninja-scan-light/tool/navigation/coordinate.h +13 -6
- data/ext/ninja-scan-light/tool/param/matrix.h +1020 -247
- data/ext/ninja-scan-light/tool/param/matrix_fixed.h +26 -0
- data/ext/ninja-scan-light/tool/swig/Coordinate.i +12 -12
- data/ext/ninja-scan-light/tool/swig/GPS.i +94 -84
- data/ext/ninja-scan-light/tool/swig/SylphideMath.i +187 -64
- data/ext/ninja-scan-light/tool/swig/spec/GPS_spec.rb +1 -1
- data/ext/ninja-scan-light/tool/swig/spec/SylphideMath_spec.rb +123 -13
- data/gps_pvt.gemspec +2 -1
- data/lib/gps_pvt/ntrip.rb +1 -1
- data/lib/gps_pvt/receiver/rtcm3.rb +106 -24
- data/lib/gps_pvt/receiver.rb +19 -8
- data/lib/gps_pvt/rtcm3.rb +53 -4
- data/lib/gps_pvt/version.rb +1 -1
- metadata +17 -3
data/ext/gps_pvt/extconf.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
ninja_tool_dir = File::absolute_path(File::join(
|
2
|
-
File::dirname(__FILE__), '..', 'ninja-scan-light', 'tool'))
|
3
|
-
|
4
1
|
require "mkmf"
|
5
|
-
|
2
|
+
proc{|ninja_tool_dir|
|
3
|
+
dir_config('ninja_tool', ninja_tool_dir, ninja_tool_dir)
|
4
|
+
}.call(File::absolute_path(File::join(
|
5
|
+
File::dirname(__FILE__), '..', 'ninja-scan-light', 'tool')))
|
6
|
+
cflags = " -Wall"
|
6
7
|
$CFLAGS += cflags
|
7
|
-
$CPPFLAGS += cflags
|
8
|
+
$CPPFLAGS += cflags
|
8
9
|
$LOCAL_LIBS += " -lstdc++ "
|
9
10
|
|
10
11
|
IO_TARGETS = [
|
@@ -269,7 +269,7 @@ class GLONASS_SinglePositioning : public SolverBaseT {
|
|
269
269
|
float_t dt_transit(range / c);
|
270
270
|
gps_time_t t_tx(time_arrival - dt_transit);
|
271
271
|
xyz_t sat_pos(sat.position(t_tx, dt_transit));
|
272
|
-
float_t geometric_range(usr_pos.xyz.
|
272
|
+
float_t geometric_range(usr_pos.xyz.distance(sat_pos));
|
273
273
|
|
274
274
|
// Calculate residual
|
275
275
|
res.range_residual = range - geometric_range;
|
@@ -668,9 +668,13 @@ class GPS_SpaceNode {
|
|
668
668
|
static const int padding_bits_MSB_abs(
|
669
669
|
PaddingBits_in_InputT_MSB * (PaddingBits_in_InputT_MSB >= 0 ? 1 : -1));
|
670
670
|
std::div_t aligned(std::div(index, EffectiveBits_in_InputT));
|
671
|
+
static const int padding_bits_LSB(
|
672
|
+
input_bits - (EffectiveBits_in_InputT + PaddingBits_in_InputT_MSB));
|
673
|
+
static const int input_mask(
|
674
|
+
(~(InputT)0) << ((padding_bits_LSB >= 0) ? padding_bits_LSB : 0));
|
671
675
|
if(PaddingBits_in_InputT_MSB >= 0){
|
672
676
|
OutputT res(
|
673
|
-
(buf[aligned.quot] << (aligned.rem + padding_bits_MSB_abs))
|
677
|
+
((buf[aligned.quot] & input_mask) << (aligned.rem + padding_bits_MSB_abs))
|
674
678
|
>> (input_bits - output_bits));
|
675
679
|
if(aligned.rem > (EffectiveBits_in_InputT - output_bits)){
|
676
680
|
// in case of overrun; ex.1 and ex.3
|
@@ -687,7 +691,7 @@ class GPS_SpaceNode {
|
|
687
691
|
// rare case: negative MSB padding
|
688
692
|
int left_shift(aligned.rem + PaddingBits_in_InputT_MSB);
|
689
693
|
OutputT res(
|
690
|
-
(buf[aligned.quot] << (left_shift >= 0 ? left_shift : 0))
|
694
|
+
((buf[aligned.quot] & input_mask) << (left_shift >= 0 ? left_shift : 0))
|
691
695
|
>> (input_bits - output_bits + (left_shift >= 0 ? 0 : -left_shift)));
|
692
696
|
if(aligned.rem > (EffectiveBits_in_InputT - output_bits)){
|
693
697
|
res |= (OutputT)(
|
@@ -289,7 +289,7 @@ class GPS_SinglePositioning : public SolverBaseT {
|
|
289
289
|
float_t dt_transit(range / c);
|
290
290
|
gps_time_t time_depature(time_arrival - dt_transit);
|
291
291
|
xyz_t sat_pos(sat.position(time_depature, dt_transit));
|
292
|
-
float_t geometric_range(usr_pos.xyz.
|
292
|
+
float_t geometric_range(usr_pos.xyz.distance(sat_pos));
|
293
293
|
|
294
294
|
// Calculate residual
|
295
295
|
residual.residual = range - geometric_range;
|
@@ -103,6 +103,7 @@ struct GPS_Solver_Base {
|
|
103
103
|
L1_RANGE_RATE_SIGMA,
|
104
104
|
L1_SIGNAL_STRENGTH_dBHz,
|
105
105
|
L1_LOCK_SEC,
|
106
|
+
L1_CARRIER_PHASE_AMBIGUITY_SCALE,
|
106
107
|
L1_FREQUENCY,
|
107
108
|
MEASUREMENT_ITEMS_PREDEFINED,
|
108
109
|
};
|
@@ -113,7 +114,7 @@ struct GPS_Solver_Base {
|
|
113
114
|
struct {
|
114
115
|
int i, i_sigma;
|
115
116
|
} pseudorange, doppler, carrier_phase, range_rate;
|
116
|
-
int signal_strength, lock_sec;
|
117
|
+
int signal_strength, lock_sec, cp_ambiguity_scale;
|
117
118
|
};
|
118
119
|
static const measurement_item_set_t L1CA;
|
119
120
|
|
@@ -1164,6 +1165,7 @@ const typename GPS_Solver_Base<FloatT>::measurement_item_set_t
|
|
1164
1165
|
make_entry2(RANGE_RATE),
|
1165
1166
|
make_entry(SIGNAL_STRENGTH_dBHz),
|
1166
1167
|
make_entry(LOCK_SEC),
|
1168
|
+
make_entry(CARRIER_PHASE_AMBIGUITY_SCALE),
|
1167
1169
|
#undef make_entry2
|
1168
1170
|
#undef make_entry
|
1169
1171
|
};
|
@@ -105,6 +105,7 @@ class GPS_Solver_MultiFrequency : public BaseSolver {
|
|
105
105
|
make_entry2(RANGE_RATE),
|
106
106
|
make_entry(SIGNAL_STRENGTH_dBHz),
|
107
107
|
make_entry(LOCK_SEC),
|
108
|
+
make_entry(CARRIER_PHASE_AMBIGUITY_SCALE),
|
108
109
|
#undef make_entry2
|
109
110
|
#undef make_entry
|
110
111
|
MEASUREMENT_ITEMS_PREDEFINED,
|
@@ -175,6 +176,7 @@ const typename GPS_Solver_MultiFrequency<BaseSolver>::measurement_item_set_t
|
|
175
176
|
make_entry2(RANGE_RATE),
|
176
177
|
make_entry(SIGNAL_STRENGTH_dBHz),
|
177
178
|
make_entry(LOCK_SEC),
|
179
|
+
make_entry(CARRIER_PHASE_AMBIGUITY_SCALE),
|
178
180
|
#undef make_entry2
|
179
181
|
#undef make_entry
|
180
182
|
};
|
@@ -193,6 +195,7 @@ const typename GPS_Solver_MultiFrequency<BaseSolver>::measurement_item_set_t
|
|
193
195
|
make_entry2(RANGE_RATE),
|
194
196
|
make_entry(SIGNAL_STRENGTH_dBHz),
|
195
197
|
make_entry(LOCK_SEC),
|
198
|
+
make_entry(CARRIER_PHASE_AMBIGUITY_SCALE),
|
196
199
|
#undef make_entry2
|
197
200
|
#undef make_entry
|
198
201
|
};
|
@@ -1822,7 +1822,7 @@ class RINEX_Writer {
|
|
1822
1822
|
protected:
|
1823
1823
|
version_type_t _version_type;
|
1824
1824
|
header_t _header;
|
1825
|
-
std::ostream &
|
1825
|
+
std::ostream &dest;
|
1826
1826
|
|
1827
1827
|
void set_version_type(const version_type_t &version_type){
|
1828
1828
|
_version_type = version_type;
|
@@ -1837,7 +1837,7 @@ class RINEX_Writer {
|
|
1837
1837
|
std::ostream &out,
|
1838
1838
|
const header_item_t *header_mask = NULL,
|
1839
1839
|
const int header_mask_size = 0)
|
1840
|
-
: _version_type(), _header(header_mask, header_mask_size),
|
1840
|
+
: _version_type(), _header(header_mask, header_mask_size), dest(out) {
|
1841
1841
|
}
|
1842
1842
|
virtual ~RINEX_Writer() {_header.clear();}
|
1843
1843
|
|
@@ -1900,7 +1900,7 @@ class RINEX_NAV_Writer : public RINEX_Writer<> {
|
|
1900
1900
|
typedef RINEX_Writer<> super_t;
|
1901
1901
|
protected:
|
1902
1902
|
using super_t::_header;
|
1903
|
-
using super_t::
|
1903
|
+
using super_t::dest;
|
1904
1904
|
public:
|
1905
1905
|
typedef typename RINEX_NAV<FloatT>::space_node_t space_node_t;
|
1906
1906
|
typedef typename RINEX_NAV<FloatT>::message_t message_t;
|
@@ -2001,7 +2001,7 @@ class RINEX_NAV_Writer : public RINEX_Writer<> {
|
|
2001
2001
|
}
|
2002
2002
|
break;
|
2003
2003
|
}
|
2004
|
-
|
2004
|
+
dest << buf.str();
|
2005
2005
|
return *this;
|
2006
2006
|
}
|
2007
2007
|
self_t &operator<<(const message_t &msg){
|
@@ -2035,7 +2035,7 @@ class RINEX_NAV_Writer : public RINEX_Writer<> {
|
|
2035
2035
|
}
|
2036
2036
|
break;
|
2037
2037
|
}
|
2038
|
-
|
2038
|
+
dest << buf.str();
|
2039
2039
|
return *this;
|
2040
2040
|
}
|
2041
2041
|
self_t &operator<<(const message_glonass_t &msg){
|
@@ -2074,7 +2074,7 @@ class RINEX_NAV_Writer : public RINEX_Writer<> {
|
|
2074
2074
|
}
|
2075
2075
|
break;
|
2076
2076
|
}
|
2077
|
-
|
2077
|
+
dest << buf.str();
|
2078
2078
|
return *this;
|
2079
2079
|
}
|
2080
2080
|
|
@@ -2187,7 +2187,7 @@ class RINEX_NAV_Writer : public RINEX_Writer<> {
|
|
2187
2187
|
if(systems > 1){
|
2188
2188
|
set_version(version, super_t::version_type_t::SYS_MIXED);
|
2189
2189
|
}
|
2190
|
-
super_t::
|
2190
|
+
super_t::dest << header();
|
2191
2191
|
res++;
|
2192
2192
|
|
2193
2193
|
struct {
|
@@ -2292,7 +2292,7 @@ class RINEX_OBS_Writer : public RINEX_Writer<> {
|
|
2292
2292
|
using super_t::RINEX_FloatD;
|
2293
2293
|
using super_t::RINEX_Value;
|
2294
2294
|
using super_t::_header;
|
2295
|
-
using super_t::
|
2295
|
+
using super_t::dest;
|
2296
2296
|
public:
|
2297
2297
|
void set_version(
|
2298
2298
|
const int &version,
|
@@ -2494,7 +2494,7 @@ class RINEX_OBS_Writer : public RINEX_Writer<> {
|
|
2494
2494
|
}
|
2495
2495
|
top << buf << std::endl;
|
2496
2496
|
|
2497
|
-
|
2497
|
+
dest << top.str() << rest.str();
|
2498
2498
|
return *this;
|
2499
2499
|
}
|
2500
2500
|
};
|
@@ -274,7 +274,7 @@ class SBAS_SinglePositioning : public SolverBaseT {
|
|
274
274
|
float_t dt_transit(range / c);
|
275
275
|
gps_time_t t_tx(time_arrival - dt_transit);
|
276
276
|
xyz_t sat_pos(sat.position(t_tx, dt_transit));
|
277
|
-
float_t geometric_range(usr_pos.xyz.
|
277
|
+
float_t geometric_range(usr_pos.xyz.distance(sat_pos));
|
278
278
|
|
279
279
|
// Calculate residual without Sagnac correction (A.4.4.11),
|
280
280
|
// because of the satellite position is calculated in the reception time ECEF.
|
@@ -131,8 +131,12 @@ class System_3D {
|
|
131
131
|
in >> self[2];
|
132
132
|
return in;
|
133
133
|
}
|
134
|
+
protected:
|
135
|
+
FloatT norm() const {
|
136
|
+
return FloatT(std::sqrt(pow2(v[0]) + pow2(v[1]) + pow2(v[2])));
|
137
|
+
}
|
134
138
|
|
135
|
-
|
139
|
+
public:
|
136
140
|
///< Coordinate rotation
|
137
141
|
struct Rotation {
|
138
142
|
Quaternion<FloatT> q;
|
@@ -253,13 +257,12 @@ class System_XYZ : public System_3D<FloatT> {
|
|
253
257
|
return copy -= another;
|
254
258
|
}
|
255
259
|
|
256
|
-
FloatT
|
257
|
-
return
|
258
|
-
pow2(x()) + pow2(y()) + pow2(z())));
|
260
|
+
FloatT distance() const {
|
261
|
+
return super_t::norm();
|
259
262
|
}
|
260
263
|
|
261
|
-
FloatT
|
262
|
-
return (*this - another).
|
264
|
+
FloatT distance(const self_t &another) const {
|
265
|
+
return (*this - another).distance();
|
263
266
|
}
|
264
267
|
|
265
268
|
static const FloatT f0, a0, b0, e0;
|
@@ -463,6 +466,10 @@ class System_ENU : public System_3D<FloatT> {
|
|
463
466
|
north() * c2 + up() * s2 + base.z());
|
464
467
|
}
|
465
468
|
|
469
|
+
FloatT distance() const {
|
470
|
+
return super_t::norm();
|
471
|
+
}
|
472
|
+
|
466
473
|
FloatT elevation() const {
|
467
474
|
return FloatT(std::atan2(up(), std::sqrt(pow2(east()) + pow2(north()))));
|
468
475
|
}
|