gps_pvt 0.9.3 → 0.10.0

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +159 -3
  3. data/README.md +4 -3
  4. data/Rakefile +24 -0
  5. data/exe/gps2ubx +12 -5
  6. data/exe/gps_pvt +7 -2
  7. data/ext/gps_pvt/Coordinate/Coordinate_wrap.cxx +53 -19
  8. data/ext/gps_pvt/GPS/GPS_wrap.cxx +39 -7
  9. data/ext/gps_pvt/SylphideMath/SylphideMath_wrap.cxx +5210 -2058
  10. data/ext/gps_pvt/extconf.rb +6 -5
  11. data/ext/ninja-scan-light/tool/navigation/GLONASS_Solver.h +1 -1
  12. data/ext/ninja-scan-light/tool/navigation/GPS.h +6 -2
  13. data/ext/ninja-scan-light/tool/navigation/GPS_Solver.h +1 -1
  14. data/ext/ninja-scan-light/tool/navigation/GPS_Solver_Base.h +3 -1
  15. data/ext/ninja-scan-light/tool/navigation/GPS_Solver_MultiFrequency.h +3 -0
  16. data/ext/ninja-scan-light/tool/navigation/RINEX.h +9 -9
  17. data/ext/ninja-scan-light/tool/navigation/SBAS_Solver.h +1 -1
  18. data/ext/ninja-scan-light/tool/navigation/coordinate.h +13 -6
  19. data/ext/ninja-scan-light/tool/param/matrix.h +1020 -247
  20. data/ext/ninja-scan-light/tool/param/matrix_fixed.h +26 -0
  21. data/ext/ninja-scan-light/tool/swig/GPS.i +6 -4
  22. data/ext/ninja-scan-light/tool/swig/SylphideMath.i +139 -36
  23. data/ext/ninja-scan-light/tool/swig/spec/SylphideMath_spec.rb +115 -5
  24. data/gps_pvt.gemspec +3 -1
  25. data/lib/gps_pvt/asn1/asn1.rb +888 -0
  26. data/lib/gps_pvt/asn1/asn1.y +903 -0
  27. data/lib/gps_pvt/asn1/per.rb +182 -0
  28. data/lib/gps_pvt/ntrip.rb +1 -1
  29. data/lib/gps_pvt/receiver/agps.rb +31 -0
  30. data/lib/gps_pvt/receiver/extension.rb +94 -0
  31. data/lib/gps_pvt/receiver/rtcm3.rb +6 -4
  32. data/lib/gps_pvt/receiver.rb +41 -24
  33. data/lib/gps_pvt/rtcm3.rb +24 -34
  34. data/lib/gps_pvt/supl.rb +567 -0
  35. data/lib/gps_pvt/ubx.rb +15 -0
  36. data/lib/gps_pvt/upl/LPP-V17_5_0-Release17.asn +6441 -0
  37. data/lib/gps_pvt/upl/RRLP-V17_0_0-Release17.asn +2780 -0
  38. data/lib/gps_pvt/upl/ULP-V2_0_6-20200720-D.asn +2185 -0
  39. data/lib/gps_pvt/upl/upl.json.gz +0 -0
  40. data/lib/gps_pvt/upl/upl.rb +99 -0
  41. data/lib/gps_pvt/util.rb +1 -0
  42. data/lib/gps_pvt/version.rb +1 -1
  43. metadata +41 -3
Binary file
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'json'
4
+ require 'zlib'
5
+ require_relative '../asn1/asn1'
6
+
7
+ ASN1 = GPS_PVT::ASN1
8
+
9
+ upl = ASN1::resolve_tree(JSON::parse(
10
+ Zlib::GzipReader::open(File::join(File::dirname(__FILE__), 'upl.json.gz')).read,
11
+ {:symbolize_names => true}))
12
+
13
+ # RRLP payload conversion
14
+ ASN1::dig(upl, :ULP, :"ULP-PDU", :message, :msSUPLPOS, :posPayLoad, :rrlpPayload)[:type][1].merge!({
15
+ :hook_encode => proc{|data|
16
+ next data unless data.kind_of?(Hash)
17
+ ASN1::encode_per(upl[:"RRLP-Messages"][:PDU], data).scan(/.{1,8}/).tap{|buf|
18
+ buf[-1] += "0" * (8 - buf[-1].length)
19
+ }.collect{|str| str.to_i(2)}
20
+ },
21
+ :hook_decode => proc{|data|
22
+ data.define_singleton_method(:decode){
23
+ ASN1::decode_per(upl[:"RRLP-Messages"][:PDU], self.collect{|v| "%08b" % [v]}.join)
24
+ }
25
+ data
26
+ },
27
+ })
28
+
29
+ # LPP payload conversion
30
+ ASN1::dig(upl, :ULP, :"ULP-PDU", :message, :msSUPLPOS, :posPayLoad, :"ver2-PosPayLoad-extension", :lPPPayload)[:type][1].merge!({
31
+ :hook_encode => proc{|data|
32
+ next data unless data.kind_of?(Hash)
33
+ ASN1::encode_per(upl[:"LPP-PDU-Definitions"][:"LPP-Message"], data).scan(/.{1,8}/).tap{|buf|
34
+ buf[-1] += "0" * (8 - buf[-1].length)
35
+ }.collect{|str| str.to_i(2)}.scan(/.{1,60000}/)
36
+ },
37
+ :hook_decode => proc{|data|
38
+ data.define_singleton_method(:decode){
39
+ ASN1::decode_per(upl[:"LPP-PDU-Definitions"][:"LPP-Message"], self.flatten.collect{|v| "%08b" % [v]}.join)
40
+ }
41
+ data
42
+ },
43
+ })
44
+
45
+ # BCD String
46
+ [:msisdn, :mdn, :imsi, :"ver2-imei"].each{|k|
47
+ elm = ASN1::dig(upl, :ULP, :"ULP-PDU", :sessionID, :setSessionID, :setId, k)
48
+ next unless elm
49
+ elm[:type][1].merge!({
50
+ :hook_encode => proc{|data|
51
+ next data unless data.kind_of?(String)
52
+ (("0" * (16 - data.size)) + data).scan(/\d{2}/).collect{|v| v.to_i(16)}
53
+ },
54
+ :hook_decode => proc{|data|
55
+ data.collect{|v| "%02X"%[v]}.join
56
+ },
57
+ })
58
+ }
59
+
60
+ =begin
61
+ UPL: User Plane Location
62
+ ULP: UserPlane Location Protocol
63
+ =end
64
+
65
+ GPS_PVT::UPL = Module::new{
66
+ define_method(:generate_skeleton){|k_cmd, *args|
67
+ opts = args[0] || {}
68
+ ver = case [2, 0xFF, 0xFF].zip([opts[:version]].flatten || []) \
69
+ .inject(0){|sum, (v1, v2)| (sum * 0x100) + (v2 || v1)}
70
+ when 0x020006..0x02FFFF; [2, 0, 6]
71
+ #when 0x020000..0x02FFFF; [2, 0, 0]
72
+ else; raise
73
+ end
74
+ res = ASN1::generate_skeleton(upl[:ULP][:"ULP-PDU"])
75
+ [:maj, :min, :servind].zip(ver).each{|k, v|
76
+ res[:version][k] = v
77
+ }
78
+ res[:message].reject!{|k, v|
79
+ "ms#{k_cmd}".to_sym != k
80
+ }
81
+ res.define_singleton_method(:all_keys){
82
+ (iter = proc{|hash|
83
+ hash.collect{|k, v|
84
+ v.kind_of?(Hash) ? {k => iter.call(v)} : k
85
+ }
86
+ }).call(self)
87
+ }
88
+ res
89
+ }
90
+ define_method(:encode){|cmd|
91
+ buf = ASN1::encode_per(upl[:ULP][:"ULP-PDU"], cmd).scan(/.{1,8}/)
92
+ buf[-1] += "0" * (8 - buf[-1].length)
93
+ (buf.length.divmod(1 << 8) + buf[2..-1].collect{|str| str.to_i(2)}).pack("C*")
94
+ }
95
+ define_method(:decode){|str|
96
+ ASN1::decode_per(upl[:ULP][:"ULP-PDU"], str.unpack("C*").collect{|v| "%08b" % [v]}.join)
97
+ }
98
+ module_function(:generate_skeleton, :encode, :decode)
99
+ }
data/lib/gps_pvt/util.rb CHANGED
@@ -27,6 +27,7 @@ proc{
27
27
 
28
28
  require 'open-uri'
29
29
  require_relative 'ntrip'
30
+ require_relative 'supl'
30
31
 
31
32
  class URI::Ntrip
32
33
  def read_format(options = {})
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GPS_PVT
4
- VERSION = "0.9.3"
4
+ VERSION = "0.10.0"
5
5
 
6
6
  def GPS_PVT.version_compare(a, b)
7
7
  Gem::Version::new(a) <=> Gem::Version::new(b)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gps_pvt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fenrir(M.Naruoka)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-07 00:00:00.000000000 Z
11
+ date: 2024-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyserial
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: racc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: github_changelog_generator
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  description: This module calculate PVT by using raw observation obtained from a GPS
70
98
  receiver
71
99
  email:
@@ -134,12 +162,22 @@ files:
134
162
  - gps_pvt.gemspec
135
163
  - gps_pvt.rbs
136
164
  - lib/gps_pvt.rb
165
+ - lib/gps_pvt/asn1/asn1.rb
166
+ - lib/gps_pvt/asn1/asn1.y
167
+ - lib/gps_pvt/asn1/per.rb
137
168
  - lib/gps_pvt/ntrip.rb
138
169
  - lib/gps_pvt/receiver.rb
170
+ - lib/gps_pvt/receiver/agps.rb
139
171
  - lib/gps_pvt/receiver/extension.rb
140
172
  - lib/gps_pvt/receiver/rtcm3.rb
141
173
  - lib/gps_pvt/rtcm3.rb
174
+ - lib/gps_pvt/supl.rb
142
175
  - lib/gps_pvt/ubx.rb
176
+ - lib/gps_pvt/upl/LPP-V17_5_0-Release17.asn
177
+ - lib/gps_pvt/upl/RRLP-V17_0_0-Release17.asn
178
+ - lib/gps_pvt/upl/ULP-V2_0_6-20200720-D.asn
179
+ - lib/gps_pvt/upl/upl.json.gz
180
+ - lib/gps_pvt/upl/upl.rb
143
181
  - lib/gps_pvt/util.rb
144
182
  - lib/gps_pvt/version.rb
145
183
  homepage: https://github.com/fenrir-naru/gps_pvt
@@ -163,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
201
  - !ruby/object:Gem::Version
164
202
  version: '0'
165
203
  requirements: []
166
- rubygems_version: 3.1.2
204
+ rubygems_version: 3.3.5
167
205
  signing_key:
168
206
  specification_version: 4
169
207
  summary: GPS position, velocity, and time (PVT) solver