gps_pvt 0.1.1 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +117 -86
- data/Rakefile +85 -85
- data/exe/gps_pvt +46 -0
- data/ext/gps_pvt/Coordinate/Coordinate_wrap.cxx +6613 -6613
- data/ext/gps_pvt/GPS/GPS_wrap.cxx +16029 -16019
- data/ext/gps_pvt/SylphideMath/SylphideMath_wrap.cxx +21050 -21050
- data/ext/gps_pvt/extconf.rb +70 -70
- data/ext/ninja-scan-light/tool/swig/GPS.i +20 -9
- data/gps_pvt.gemspec +57 -57
- data/lib/gps_pvt/receiver.rb +353 -375
- data/lib/gps_pvt/ubx.rb +147 -147
- data/lib/gps_pvt/version.rb +5 -5
- data/lib/gps_pvt.rb +9 -9
- data/sig/gps_pvt.rbs +4 -4
- metadata +6 -4
data/ext/gps_pvt/extconf.rb
CHANGED
@@ -1,70 +1,70 @@
|
|
1
|
-
ninja_tool_dir = File::absolute_path(File::join(
|
2
|
-
File::dirname(__FILE__), '..', 'ninja-scan-light', 'tool'))
|
3
|
-
|
4
|
-
require "mkmf"
|
5
|
-
cflags = " -Wall -I#{ninja_tool_dir}"
|
6
|
-
$CFLAGS += cflags
|
7
|
-
$CPPFLAGS += cflags if RUBY_VERSION >= "2.0.0"
|
8
|
-
$LOCAL_LIBS += " -lstdc++ "
|
9
|
-
|
10
|
-
IO_TARGETS = [
|
11
|
-
[Kernel, :instance_eval],
|
12
|
-
[(class << File; self; end), :class_eval], # https://github.com/ruby/ruby/commit/19beb028
|
13
|
-
]
|
14
|
-
def IO_TARGETS.mod(&b)
|
15
|
-
self.each{|class_, func| class_.send(func, &b)}
|
16
|
-
end
|
17
|
-
|
18
|
-
IO_TARGETS.mod{
|
19
|
-
alias_method(:open_orig, :open)
|
20
|
-
}
|
21
|
-
|
22
|
-
Dir::glob(File::join(File::dirname(__FILE__), "*/")).each{|dir|
|
23
|
-
mod_name = File::basename(dir)
|
24
|
-
|
25
|
-
dst = File::join(Dir.getwd, mod_name)
|
26
|
-
FileUtils::mkdir_p(dst) if dir != dst
|
27
|
-
|
28
|
-
$stderr.puts "For #{mod_name} ..."
|
29
|
-
|
30
|
-
# @see https://stackoverflow.com/a/35842162/15992898
|
31
|
-
$srcs = Dir::glob(File::join(dir, '*.cxx')).collect{|path|
|
32
|
-
File::join(mod_name, File::basename(path))
|
33
|
-
}
|
34
|
-
$objs = $srcs.collect{|path|
|
35
|
-
path.sub(/\.[^\.]+$/, '.o')
|
36
|
-
}
|
37
|
-
|
38
|
-
IO_TARGETS.mod{
|
39
|
-
# rename Makefile to Makefile.#{mod_name}
|
40
|
-
define_method(:open){|*args, &b|
|
41
|
-
args[0] += ".#{mod_name}" if (args[0] && (args[0] == "Makefile"))
|
42
|
-
open_orig(*args, &b)
|
43
|
-
}
|
44
|
-
}
|
45
|
-
create_makefile("gps_pvt/#{mod_name}")
|
46
|
-
}
|
47
|
-
|
48
|
-
IO_TARGETS.mod{
|
49
|
-
alias_method(:open, :open_orig)
|
50
|
-
}
|
51
|
-
|
52
|
-
# manual generation of top-level Makefile
|
53
|
-
# @see https://yorickpeterse.com/articles/hacking-extconf-rb/
|
54
|
-
open("Makefile", 'w'){|io|
|
55
|
-
# @see https://stackoverflow.com/a/17845120/15992898
|
56
|
-
io.write(<<-__TOPLEVEL_MAKEFILE__)
|
57
|
-
TOPTARGETS := all clean distclean realclean install site-install
|
58
|
-
|
59
|
-
SUBMFS := $(wildcard Makefile.*)
|
60
|
-
|
61
|
-
$(TOPTARGETS): $(SUBMFS)
|
62
|
-
$(SUBMFS):
|
63
|
-
#{"\t"}$(MAKE) -f $@ $(MAKECMDGOALS)
|
64
|
-
|
65
|
-
.PHONY: $(TOPTARGETS) $(SUBMFS)
|
66
|
-
__TOPLEVEL_MAKEFILE__
|
67
|
-
}
|
68
|
-
|
69
|
-
require 'fileutils'
|
70
|
-
FileUtils::touch("gps_pvt.so") # dummy
|
1
|
+
ninja_tool_dir = File::absolute_path(File::join(
|
2
|
+
File::dirname(__FILE__), '..', 'ninja-scan-light', 'tool'))
|
3
|
+
|
4
|
+
require "mkmf"
|
5
|
+
cflags = " -Wall -I#{ninja_tool_dir}"
|
6
|
+
$CFLAGS += cflags
|
7
|
+
$CPPFLAGS += cflags if RUBY_VERSION >= "2.0.0"
|
8
|
+
$LOCAL_LIBS += " -lstdc++ "
|
9
|
+
|
10
|
+
IO_TARGETS = [
|
11
|
+
[Kernel, :instance_eval],
|
12
|
+
[(class << File; self; end), :class_eval], # https://github.com/ruby/ruby/commit/19beb028
|
13
|
+
]
|
14
|
+
def IO_TARGETS.mod(&b)
|
15
|
+
self.each{|class_, func| class_.send(func, &b)}
|
16
|
+
end
|
17
|
+
|
18
|
+
IO_TARGETS.mod{
|
19
|
+
alias_method(:open_orig, :open)
|
20
|
+
}
|
21
|
+
|
22
|
+
Dir::glob(File::join(File::dirname(__FILE__), "*/")).each{|dir|
|
23
|
+
mod_name = File::basename(dir)
|
24
|
+
|
25
|
+
dst = File::join(Dir.getwd, mod_name)
|
26
|
+
FileUtils::mkdir_p(dst) if dir != dst
|
27
|
+
|
28
|
+
$stderr.puts "For #{mod_name} ..."
|
29
|
+
|
30
|
+
# @see https://stackoverflow.com/a/35842162/15992898
|
31
|
+
$srcs = Dir::glob(File::join(dir, '*.cxx')).collect{|path|
|
32
|
+
File::join(mod_name, File::basename(path))
|
33
|
+
}
|
34
|
+
$objs = $srcs.collect{|path|
|
35
|
+
path.sub(/\.[^\.]+$/, '.o')
|
36
|
+
}
|
37
|
+
|
38
|
+
IO_TARGETS.mod{
|
39
|
+
# rename Makefile to Makefile.#{mod_name}
|
40
|
+
define_method(:open){|*args, &b|
|
41
|
+
args[0] += ".#{mod_name}" if (args[0] && (args[0] == "Makefile"))
|
42
|
+
open_orig(*args, &b)
|
43
|
+
}
|
44
|
+
}
|
45
|
+
create_makefile("gps_pvt/#{mod_name}")
|
46
|
+
}
|
47
|
+
|
48
|
+
IO_TARGETS.mod{
|
49
|
+
alias_method(:open, :open_orig)
|
50
|
+
}
|
51
|
+
|
52
|
+
# manual generation of top-level Makefile
|
53
|
+
# @see https://yorickpeterse.com/articles/hacking-extconf-rb/
|
54
|
+
open("Makefile", 'w'){|io|
|
55
|
+
# @see https://stackoverflow.com/a/17845120/15992898
|
56
|
+
io.write(<<-__TOPLEVEL_MAKEFILE__)
|
57
|
+
TOPTARGETS := all clean distclean realclean install site-install
|
58
|
+
|
59
|
+
SUBMFS := $(wildcard Makefile.*)
|
60
|
+
|
61
|
+
$(TOPTARGETS): $(SUBMFS)
|
62
|
+
$(SUBMFS):
|
63
|
+
#{"\t"}$(MAKE) -f $@ $(MAKECMDGOALS)
|
64
|
+
|
65
|
+
.PHONY: $(TOPTARGETS) $(SUBMFS)
|
66
|
+
__TOPLEVEL_MAKEFILE__
|
67
|
+
}
|
68
|
+
|
69
|
+
require 'fileutils'
|
70
|
+
FileUtils::touch("gps_pvt.so") # dummy
|
@@ -22,6 +22,17 @@
|
|
22
22
|
#include "navigation/GPS_Solver_Base.h"
|
23
23
|
#include "navigation/GPS_Solver.h"
|
24
24
|
#include "navigation/GPS_Solver_RAIM.h"
|
25
|
+
|
26
|
+
#if defined(__cplusplus) && (__cplusplus < 201103L)
|
27
|
+
#include <sstream>
|
28
|
+
namespace std {
|
29
|
+
template <class T>
|
30
|
+
inline std::string to_string(const T &value){
|
31
|
+
// @see https://stackoverflow.com/a/5590404/15992898
|
32
|
+
return static_cast<std::ostringstream &>(std::ostringstream() << value).str();
|
33
|
+
}
|
34
|
+
}
|
35
|
+
#endif
|
25
36
|
%}
|
26
37
|
|
27
38
|
%include typemaps.i
|
@@ -246,12 +257,12 @@ struct GPS_Ionospheric_UTC_Parameters : public GPS_SpaceNode<FloatT>::Ionospheri
|
|
246
257
|
MAKE_ACCESSOR(delta_t_LSF, int);
|
247
258
|
static GPS_Ionospheric_UTC_Parameters<FloatT> parse(const unsigned int *buf){
|
248
259
|
typedef typename GPS_SpaceNode<FloatT>
|
249
|
-
::
|
260
|
+
::BroadcastedMessage<unsigned int, 30> parser_t;
|
250
261
|
if((parser_t::subframe_id(buf) != 4) || (parser_t::sv_page_id(buf) != 56)){
|
251
262
|
throw std::runtime_error("Not valid data");
|
252
263
|
}
|
253
264
|
typename GPS_SpaceNode<FloatT>::Ionospheric_UTC_Parameters::raw_t raw;
|
254
|
-
raw.
|
265
|
+
raw.update<2, 0>(buf);
|
255
266
|
GPS_Ionospheric_UTC_Parameters<FloatT> res;
|
256
267
|
(typename GPS_SpaceNode<FloatT>::Ionospheric_UTC_Parameters &)res = raw;
|
257
268
|
return res;
|
@@ -330,12 +341,12 @@ struct GPS_Ephemeris : public GPS_SpaceNode<FloatT>::SatelliteProperties::Epheme
|
|
330
341
|
typename eph_t::raw_t raw;
|
331
342
|
eph_t eph;
|
332
343
|
*subframe_no = GPS_SpaceNode<FloatT>
|
333
|
-
::
|
344
|
+
::BroadcastedMessage<unsigned int, 30>
|
334
345
|
::subframe_id(buf);
|
335
346
|
*iodc_or_iode = -1;
|
336
347
|
switch(*subframe_no){
|
337
348
|
case 1:
|
338
|
-
*iodc_or_iode = raw.
|
349
|
+
*iodc_or_iode = raw.update_subframe1<2, 0>(buf);
|
339
350
|
eph = raw;
|
340
351
|
self->WN = eph.WN;
|
341
352
|
self->URA = eph.URA;
|
@@ -348,7 +359,7 @@ struct GPS_Ephemeris : public GPS_SpaceNode<FloatT>::SatelliteProperties::Epheme
|
|
348
359
|
self->a_f0 = eph.a_f0;
|
349
360
|
break;
|
350
361
|
case 2:
|
351
|
-
*iodc_or_iode = raw.
|
362
|
+
*iodc_or_iode = raw.update_subframe2<2, 0>(buf);
|
352
363
|
eph = raw;
|
353
364
|
self->iode = eph.iode;
|
354
365
|
self->c_rs = eph.c_rs;
|
@@ -362,7 +373,7 @@ struct GPS_Ephemeris : public GPS_SpaceNode<FloatT>::SatelliteProperties::Epheme
|
|
362
373
|
self->fit_interval = eph_t::raw_t::fit_interval(raw.fit_interval_flag, self->iodc);
|
363
374
|
break;
|
364
375
|
case 3:
|
365
|
-
*iodc_or_iode = self->iode_subframe3 = raw.
|
376
|
+
*iodc_or_iode = self->iode_subframe3 = raw.update_subframe3<2, 0>(buf);
|
366
377
|
eph = raw;
|
367
378
|
self->c_ic = eph.c_ic;
|
368
379
|
self->Omega0 = eph.Omega0;
|
@@ -787,10 +798,10 @@ struct GPS_SolverOptions : public GPS_SinglePositioning<FloatT>::options_t {
|
|
787
798
|
}
|
788
799
|
std::vector<int> set_ionospheric_models(const std::vector<int> &models){
|
789
800
|
typedef typename base_t::ionospheric_model_t model_t;
|
790
|
-
for(int i(0), j(0), j_max(models.size()); i <
|
791
|
-
model_t v(
|
801
|
+
for(int i(0), j(0), j_max(models.size()); i < base_t::IONOSPHERIC_MODELS; ++i){
|
802
|
+
model_t v(base_t::IONOSPHERIC_SKIP);
|
792
803
|
if(j < j_max){
|
793
|
-
if((models[j] >= 0) && (models[j] <
|
804
|
+
if((models[j] >= 0) && (models[j] < base_t::IONOSPHERIC_SKIP)){
|
794
805
|
v = (model_t)models[j];
|
795
806
|
}
|
796
807
|
++j;
|
data/gps_pvt.gemspec
CHANGED
@@ -1,57 +1,57 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/gps_pvt/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "gps_pvt"
|
7
|
-
spec.version = GPS_PVT::VERSION
|
8
|
-
spec.authors = ["fenrir(M.Naruoka)"]
|
9
|
-
spec.email = ["fenrir.naru@gmail.com"]
|
10
|
-
|
11
|
-
spec.summary = "GPS position, velocity, and time (PVT) solver"
|
12
|
-
spec.description = "This module calculate PVT by using raw observation obtained from a GPS receiver"
|
13
|
-
spec.homepage = "https://github.com/fenrir-naru/gps_pvt"
|
14
|
-
spec.required_ruby_version = ">= 2.
|
15
|
-
|
16
|
-
#spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
17
|
-
|
18
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
20
|
-
#spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
21
|
-
|
22
|
-
spec.extensions = ["ext/gps_pvt/extconf.rb"]
|
23
|
-
|
24
|
-
# Specify which files should be added to the gem when it is released.
|
25
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
28
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
29
|
-
end
|
30
|
-
end
|
31
|
-
spec.bindir = "exe"
|
32
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
33
|
-
spec.require_paths = ["lib"]
|
34
|
-
|
35
|
-
spec.files += proc{
|
36
|
-
|
37
|
-
|
38
|
-
# get an array of submodule dirs by executing 'pwd' inside each submodule
|
39
|
-
`git submodule --quiet foreach pwd`.split($/).collect{|dir|
|
40
|
-
# issue git ls-files in submodule's directory
|
41
|
-
`git -C #{dir} ls-files -v`.split($/).collect{|f|
|
42
|
-
next nil unless f =~ /^H */ # consider git sparse checkout
|
43
|
-
# get relative path
|
44
|
-
f = Pathname::new(File::join(dir, $'))
|
45
|
-
(f.relative? ? f : f.relative_path_from(base_dir)).to_s
|
46
|
-
}.compact
|
47
|
-
}.flatten
|
48
|
-
}.call
|
49
|
-
|
50
|
-
# Uncomment to register a new dependency of your gem
|
51
|
-
# spec.add_dependency "example-gem", "~> 1.0"
|
52
|
-
spec.add_development_dependency "rake"
|
53
|
-
spec.add_development_dependency "rake-compiler"
|
54
|
-
|
55
|
-
# For more information and examples about making a new gem, checkout our
|
56
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
57
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/gps_pvt/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "gps_pvt"
|
7
|
+
spec.version = GPS_PVT::VERSION
|
8
|
+
spec.authors = ["fenrir(M.Naruoka)"]
|
9
|
+
spec.email = ["fenrir.naru@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "GPS position, velocity, and time (PVT) solver"
|
12
|
+
spec.description = "This module calculate PVT by using raw observation obtained from a GPS receiver"
|
13
|
+
spec.homepage = "https://github.com/fenrir-naru/gps_pvt"
|
14
|
+
spec.required_ruby_version = ">= 2.3.0"
|
15
|
+
|
16
|
+
#spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
17
|
+
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
20
|
+
#spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
21
|
+
|
22
|
+
spec.extensions = ["ext/gps_pvt/extconf.rb"]
|
23
|
+
|
24
|
+
# Specify which files should be added to the gem when it is released.
|
25
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
29
|
+
end
|
30
|
+
end
|
31
|
+
spec.bindir = "exe"
|
32
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ["lib"]
|
34
|
+
|
35
|
+
spec.files += proc{
|
36
|
+
require 'pathname'
|
37
|
+
base_dir = Pathname::new(File::absolute_path(File.dirname(__FILE__)))
|
38
|
+
# get an array of submodule dirs by executing 'pwd' inside each submodule
|
39
|
+
`git submodule --quiet foreach pwd`.split($/).collect{|dir|
|
40
|
+
# issue git ls-files in submodule's directory
|
41
|
+
`git -C #{dir} ls-files -v`.split($/).collect{|f|
|
42
|
+
next nil unless f =~ /^H */ # consider git sparse checkout
|
43
|
+
# get relative path
|
44
|
+
f = Pathname::new(File::join(dir, $'))
|
45
|
+
(f.relative? ? f : f.relative_path_from(base_dir)).to_s
|
46
|
+
}.compact
|
47
|
+
}.flatten
|
48
|
+
}.call
|
49
|
+
|
50
|
+
# Uncomment to register a new dependency of your gem
|
51
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
52
|
+
spec.add_development_dependency "rake"
|
53
|
+
spec.add_development_dependency "rake-compiler"
|
54
|
+
|
55
|
+
# For more information and examples about making a new gem, checkout our
|
56
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
57
|
+
end
|