gps_pvt 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db616707d74b61691f2d968fe2034c513333d300257f72a6968df7c6a538f07b
4
- data.tar.gz: 875638b4fb9378dc1928ba532e868138373174a1bc8316f7852a88867f52b43d
3
+ metadata.gz: 859eb4d8638d8ac33ffe0b070242da4a90e92427a49d3ecc8cca82850ad27921
4
+ data.tar.gz: 6ddb0a60db3e9cf4adab2dd4bed0175ec86c8675c1223079a9801513e93f2769
5
5
  SHA512:
6
- metadata.gz: 77e3567bbc1a124faa29b78f9e2f745c6713d5b81f5b7204432ba64134d1914fd93bed6b11e6e047e6dd50dd42372df8deba379b7940a74b65dedddc2aac3156
7
- data.tar.gz: 171c292e462856f0f4f566954311d393063dd1b2864b15dbeab887c4eafb84875a95b7e242010de17652a281665c0e7bffaa1833a4e89971d8d55a5997138a37
6
+ metadata.gz: b7db4b42ef5175e1b90d95230bc40323d284f75bfa70a155d1dff0cc18ec8abf12b2b17990f2d59131dd32b2b6b718feab828a0d6f0650a5141304b43b0adfc8
7
+ data.tar.gz: 49ee8add62f37aefbcf7ec5bbb154ab7b6dab0f30c0c7677193c80286ce4149b8aa9d7a626004fa5769b2fd7ae0ee823f511d7698a15571547b860895daee35c
data/README.md CHANGED
@@ -1,86 +1,90 @@
1
- # GPS_PVT
2
-
3
- GPS_PVT is a Ruby GPS (Global positioning system) PVT (position, velocity and time) solver. It accepts RINEX NAV and OBS files in addition to u-blox ubx format. Its significant features are easy to use with highly flexibility to customize internal solver behavior such as weight for each available satellite.
4
-
5
- The PVT solution is obtained with a stand alone positioning (i.e. neither differential nor kinematic) with lease square. Its main internal codes are derived from ones of [ninja-scan-light](https://github.com/fenrir-naru/ninja-scan-light) having capability to calculate tightly-coupled GNSS/INS integrated solution. These codes are written by C++, and wrapped by [SWIG](http://www.swig.org/).
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'gps_pvt'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle install
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install gps_pvt
22
-
23
- ## Usage
24
-
25
- ```ruby
26
- require 'gps_pvt'
27
-
28
- receiver = GPS_PVT::Receiver::new
29
- receiver.parse_rinex_nav(rinex_nav_file)
30
-
31
- # For generate solution in CSV format
32
- puts GPS_PVT::Receiver::header
33
- receiver.parse_rinex_obs(rinex_obs_file)
34
-
35
- # receiver.parse_ubx(ubx_file) # same as above for ubx file including RXM-RAW(X) and RXM-SFRB(X)
36
-
37
- # Or precise control of outputs
38
- receiver.parse_rinex_obs(rinex_obs_file){|pvt, meas| # per epoch
39
- meas # => measurement, array of [prn, key, value]; key is represented by GPS_PVT::GPS::Measurement::L1_PSEUDORANGE
40
- pvt # => PVT solution, all properties are shown by pvt.methods
41
- # for example
42
- if(pvt.position_solved?){
43
- pvt.receiver_time # receiver time; .to_a => [GPS week, seconds], .c_tm => [year, month, day, hour, min, sec] without leap second consideration
44
- [:lat, :lng, :alt].collect{|f| pvt.llh.send(f)} # latitude[rad], longitude[rad], WGS-84 altitude[m]
45
- pvt.receiver_error # receiver clock error in meter
46
- [:g, :p, :h, :v, :t].collect{|k| pvt.send("#{k}dop".to_sym)} # various DOP, dilution of precision
47
- if(pvt.velocity_solved?){
48
- [:north, east, :down].collect{|dir| pvt.velocity.send(dir)} # speed in north/east/down [m/s]
49
- pvt.receiver_error_rate # clock error rate in m/s
50
- }
51
- pvt.used_satellite_list # array of used, i.e., visible and weight>0, satellite
52
- pvt.G # design matrix in Earth-centered-Earth-fixed (ECEF); .to_a returns double array converted from matrix. its row corresponds to one of used_satellite_list
53
- pvt.G_enu # design matrix in East-North-Up (ENU)
54
- pvt.W # weight for each satellite
55
- pvt.delta_r # residual of pseudo range
56
- pvt.S # (delta position) = S * (residual) in last iteration in ECEF
57
- }
58
- }
59
-
60
- # Customize solution
61
- receiver.solver.options.exclude(prn) # Exclude satellite; the default is to use every satellite if visible
62
- receiver.solver.options.include(prn) # Discard previous setting of exclusion
63
- receiver.solver.hooks[:relative_property] = proc{|prn, rel_prop, rcv_e, t_arv, usr_pos, usr_vel|
64
- # control weight per satellite per iteration
65
- weight, range_c, range_r, rate_rel_neg, *los_neg = rel_prop # relative property
66
- weight = 1 # default; same weight
67
- # or weight based on elevation
68
- # elv = GPS_PVT::Coordinate::ENU::relative_rel(GPS_PVT::Coordinate::XYZ::new(*los_neg), usr_pos).elevation
69
- # weight = (Math::sin(elv)/0.8)**2
70
- [weight, range_c, range_r, rate_rel_neg] + los_neg
71
- }
72
- ```
73
-
74
- ## Development
75
-
76
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to build library and run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
77
-
78
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
79
-
80
- ## Contributing
81
-
82
- Bug reports and pull requests are welcome on GitHub at https://github.com/fenrir-naru/gps_pvt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/fenrir-naru/gps_pvt/blob/master/CODE_OF_CONDUCT.md).
83
-
84
- ## Code of Conduct
85
-
86
- Everyone interacting in the GPS_PVT project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/fenrir-naru/gps_pvt/blob/master/CODE_OF_CONDUCT.md).
1
+ # GPS_PVT
2
+
3
+ GPS_PVT is a Ruby GPS (Global positioning system) PVT (position, velocity and time) solver. It accepts RINEX NAV and OBS files in addition to u-blox ubx format. Its significant features are easy to use with highly flexibility to customize internal solver behavior such as weight for each available satellite.
4
+
5
+ The PVT solution is obtained with a stand alone positioning (i.e. neither differential nor kinematic) with least square. Its main internal codes are derived from ones of [ninja-scan-light](https://github.com/fenrir-naru/ninja-scan-light) having capability to calculate tightly-coupled GNSS/INS integrated solution. These codes are written by C++, and wrapped by [SWIG](http://www.swig.org/).
6
+
7
+ [![Gem Version](https://badge.fury.io/rb/gps_pvt.svg)](https://badge.fury.io/rb/gps_pvt)
8
+ [![Ruby](https://github.com/fenrir-naru/gps_pvt/actions/workflows/main.yml/badge.svg)](https://github.com/fenrir-naru/gps_pvt/actions/workflows/main.yml)
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'gps_pvt'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle install
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install gps_pvt
25
+
26
+ For Windows users, this gem requires Devkit because of native compilation.
27
+
28
+ ## Usage
29
+
30
+ ```ruby
31
+ require 'gps_pvt'
32
+
33
+ receiver = GPS_PVT::Receiver::new
34
+ receiver.parse_rinex_nav(rinex_nav_file) # This is required before parsing RINEX obs file (For ubx, skippable)
35
+
36
+ # For generate solution in CSV format
37
+ puts GPS_PVT::Receiver::header
38
+ receiver.parse_rinex_obs(rinex_obs_file)
39
+ # receiver.parse_ubx(ubx_file) # same as above for ubx file including RXM-RAW(X) and RXM-SFRB(X)
40
+
41
+ # Or precise control of outputs
42
+ receiver.parse_rinex_obs(rinex_obs_file){|pvt, meas| # per epoch
43
+ meas # => measurement, array of [prn, key, value]; key is represented by GPS_PVT::GPS::Measurement::L1_PSEUDORANGE
44
+ pvt # => PVT solution, all properties are shown by pvt.methods
45
+ # for example
46
+ if(pvt.position_solved?){
47
+ pvt.receiver_time # receiver time; .to_a => [GPS week, seconds], .c_tm => [year, month, day, hour, min, sec] without leap second consideration
48
+ [:lat, :lng, :alt].collect{|f| pvt.llh.send(f)} # latitude[rad], longitude[rad], WGS-84 altitude[m]
49
+ pvt.receiver_error # receiver clock error in meter
50
+ [:g, :p, :h, :v, :t].collect{|k| pvt.send("#{k}dop".to_sym)} # various DOP, dilution of precision
51
+ if(pvt.velocity_solved?){
52
+ [:north, east, :down].collect{|dir| pvt.velocity.send(dir)} # speed in north/east/down [m/s]
53
+ pvt.receiver_error_rate # clock error rate in m/s
54
+ }
55
+ pvt.used_satellite_list # array of used, i.e., visible and weight>0, satellite
56
+ pvt.G # design matrix in Earth-centered-Earth-fixed (ECEF); .to_a returns double array converted from matrix. its row corresponds to one of used_satellite_list
57
+ pvt.G_enu # design matrix in East-North-Up (ENU)
58
+ pvt.W # weight for each satellite
59
+ pvt.delta_r # residual of pseudo range
60
+ pvt.S # (delta position) = S * (residual) in last iteration in ECEF
61
+ }
62
+ }
63
+
64
+ # Customize solution
65
+ receiver.solver.options.exclude(prn) # Exclude satellite; the default is to use every satellite if visible
66
+ receiver.solver.options.include(prn) # Discard previous setting of exclusion
67
+ receiver.solver.hooks[:relative_property] = proc{|prn, rel_prop, rcv_e, t_arv, usr_pos, usr_vel|
68
+ # control weight per satellite per iteration
69
+ weight, range_c, range_r, rate_rel_neg, *los_neg = rel_prop # relative property
70
+ weight = 1 # default; same weight
71
+ # or weight based on elevation
72
+ # elv = GPS_PVT::Coordinate::ENU::relative_rel(GPS_PVT::Coordinate::XYZ::new(*los_neg), usr_pos).elevation
73
+ # weight = (Math::sin(elv)/0.8)**2
74
+ [weight, range_c, range_r, rate_rel_neg] + los_neg
75
+ }
76
+ ```
77
+
78
+ ## Development
79
+
80
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to build library and run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
81
+
82
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
83
+
84
+ ## Contributing
85
+
86
+ Bug reports and pull requests are welcome on GitHub at https://github.com/fenrir-naru/gps_pvt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/fenrir-naru/gps_pvt/blob/master/CODE_OF_CONDUCT.md).
87
+
88
+ ## Code of Conduct
89
+
90
+ Everyone interacting in the GPS_PVT project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/fenrir-naru/gps_pvt/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,86 +1,86 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- require "rake/extensiontask"
9
-
10
- Rake::ExtensionTask.new("gps_pvt") do |ext|
11
- ext.lib_dir = "lib/gps_pvt"
12
- end
13
-
14
- namespace :git do
15
- namespace :submodules do
16
- desc "Initialize git submodules"
17
- task :init do
18
- sh "git submodule init"
19
- # for sparse-checkout; @see https://stackoverflow.com/a/59521050/15992898
20
- `git config --file .gitmodules --name-only --get-regexp path`.lines.each{|str|
21
- # list submodule; @see https://stackoverflow.com/a/23490756/15992898
22
- next unless str =~ /submodule\.(.+)\.path/
23
- repo_dir = $1
24
- sh "git clone -n #{`git config submodule.#{repo_dir}.url`.chomp} #{repo_dir}"
25
- }
26
- {
27
- 'ext/ninja-scan-light' => [
28
- "sparse-checkout init", # same as "git -C #{repo} config core.sparseCheckout true"
29
- # same as #{repo}/.git/info/sparse-checkout
30
- "sparse-checkout set" + (<<-__SPARSE_PATTERNS__).lines.collect{|str| str.chomp.gsub(/^ */, ' ')}.join,
31
- /tool/param/
32
- /tool/navigation/GPS*
33
- /tool/navigation/coordinate.h
34
- /tool/navigation/EGM.h
35
- /tool/navigation/MagneticField.h
36
- /tool/navigation/NTCM.h
37
- /tool/navigation/RINEX.h
38
- /tool/navigation/WGS84.h
39
- /tool/swig/SylphideMath.i
40
- /tool/swig/GPS.i
41
- /tool/swig/Coordinate.i
42
- /tool/swig/makefile
43
- /tool/swig/extconf.rb
44
- /tool/swig/spec/GPS_spec.rb
45
- /tool/swig/spec/SylphideMath_spec.rb
46
- __SPARSE_PATTERNS__
47
- ]
48
- }.each{|repo, commands|
49
- commands.each{|str| sh "git -C #{repo} #{str}"}
50
- }
51
- sh "git submodule absorbgitdirs" # Move #{repo}/.git to .git/modules/#{repo}/.git
52
- sh "git submodule update"
53
- # if already checked out, then git -C #{repo} read-tree -mu HEAD
54
- end
55
- end
56
- end
57
-
58
-
59
- desc "Generate SWIG wrapper codes"
60
- task :swig do
61
- swig_dir = File::join(File::dirname(__FILE__), 'ext', 'ninja-scan-light', 'tool', 'swig')
62
- out_base_dir = File::join(File::dirname(__FILE__), 'ext', 'gps_pvt')
63
- Dir::chdir(swig_dir){
64
- Dir::glob("*.i"){|src|
65
- mod_name = File::basename(src, '.*')
66
- out_dir = File::join(out_base_dir, mod_name)
67
- sh "mkdir -p #{out_dir}"
68
- wrapper = File::join(out_dir, "#{mod_name}_wrap.cxx")
69
- sh [:make, :clean, wrapper,
70
- "BUILD_DIR=#{out_dir}",
71
- "SWIGFLAGS='-c++ -ruby -prefix \"GPS_PVT::\"#{" -D__MINGW__" if ENV["MSYSTEM"]}'"].join(' ')
72
- lines = open(wrapper, 'r').read.lines.collect{|line|
73
- line.sub(/rb_require\(\"([^\"]+)\"\)/){ # from camel to underscore downcase style
74
- "rb_require(\"#{$1.sub('GPS_PVT', 'gps_pvt')}\")"
75
- }
76
- }
77
- open(wrapper, 'w').write(lines.join)
78
- }
79
- }
80
- end
81
-
82
- file "ext/ninja-scan-light/tool" do |t|
83
- Rake::Task["git:submodules:init"].invoke
84
- end
85
-
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rake/extensiontask"
9
+
10
+ Rake::ExtensionTask.new("gps_pvt") do |ext|
11
+ ext.lib_dir = "lib/gps_pvt"
12
+ end
13
+
14
+ namespace :git do
15
+ namespace :submodules do
16
+ desc "Initialize git submodules"
17
+ task :init do
18
+ sh "git submodule init"
19
+ # for sparse-checkout; @see https://stackoverflow.com/a/59521050/15992898
20
+ `git config --file .gitmodules --name-only --get-regexp path`.lines.each{|str|
21
+ # list submodule; @see https://stackoverflow.com/a/23490756/15992898
22
+ next unless str =~ /submodule\.(.+)\.path/
23
+ repo_dir = $1
24
+ sh "git clone -n #{`git config submodule.#{repo_dir}.url`.chomp} #{repo_dir}"
25
+ }
26
+ {
27
+ 'ext/ninja-scan-light' => [
28
+ "sparse-checkout init", # same as "git -C #{repo} config core.sparseCheckout true"
29
+ # same as #{repo}/.git/info/sparse-checkout
30
+ "sparse-checkout set" + (<<-__SPARSE_PATTERNS__).lines.collect{|str| str.chomp.gsub(/^ */, ' ')}.join,
31
+ /tool/param/
32
+ /tool/navigation/GPS*
33
+ /tool/navigation/coordinate.h
34
+ /tool/navigation/EGM.h
35
+ /tool/navigation/MagneticField.h
36
+ /tool/navigation/NTCM.h
37
+ /tool/navigation/RINEX.h
38
+ /tool/navigation/WGS84.h
39
+ /tool/swig/SylphideMath.i
40
+ /tool/swig/GPS.i
41
+ /tool/swig/Coordinate.i
42
+ /tool/swig/makefile
43
+ /tool/swig/extconf.rb
44
+ /tool/swig/spec/GPS_spec.rb
45
+ /tool/swig/spec/SylphideMath_spec.rb
46
+ __SPARSE_PATTERNS__
47
+ ]
48
+ }.each{|repo, commands|
49
+ commands.each{|str| sh "git -C #{repo} #{str}"}
50
+ }
51
+ sh "git submodule absorbgitdirs" # Move #{repo}/.git to .git/modules/#{repo}/.git
52
+ sh "git submodule update"
53
+ # if already checked out, then git -C #{repo} read-tree -mu HEAD
54
+ end
55
+ end
56
+ end
57
+
58
+
59
+ desc "Generate SWIG wrapper codes"
60
+ task :swig do
61
+ swig_dir = File::join(File::dirname(__FILE__), 'ext', 'ninja-scan-light', 'tool', 'swig')
62
+ out_base_dir = File::join(File::dirname(__FILE__), 'ext', 'gps_pvt')
63
+ Dir::chdir(swig_dir){
64
+ Dir::glob("*.i"){|src|
65
+ mod_name = File::basename(src, '.*')
66
+ out_dir = File::join(out_base_dir, mod_name)
67
+ sh "mkdir -p #{out_dir}"
68
+ wrapper = File::join(out_dir, "#{mod_name}_wrap.cxx")
69
+ sh [:make, :clean, wrapper,
70
+ "BUILD_DIR=#{out_dir}",
71
+ "SWIGFLAGS='-c++ -ruby -prefix \"GPS_PVT::\"#{" -D__MINGW__" if ENV["MSYSTEM"]}'"].join(' ')
72
+ lines = open(wrapper, 'r').read.lines.collect{|line|
73
+ line.sub(/rb_require\(\"([^\"]+)\"\)/){ # from camel to underscore downcase style
74
+ "rb_require(\"#{$1.sub('GPS_PVT', 'gps_pvt')}\")"
75
+ }
76
+ }
77
+ open(wrapper, 'w').write(lines.join)
78
+ }
79
+ }
80
+ end
81
+
82
+ file "ext/ninja-scan-light/tool" do |t|
83
+ Rake::Task["git:submodules:init"].invoke
84
+ end
85
+
86
86
  task :default => ["ext/ninja-scan-light/tool", :compile, :spec]