gps_pvt 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39089e2daa55491ccf086809797c2fef68d1e0268e75e6217ed793f091e748de
4
- data.tar.gz: cca39a3dbcca26921606019be603526f62766c841a92191ee0a99174f00b54c7
3
+ metadata.gz: 65f27faf8bc6c61e51bd06217b50fad55277e59278c687971a4b3bd83e218603
4
+ data.tar.gz: 3d56b37228725e36d0edc6e5b1a2a2d2a2f1b42305124aa1abec8280253a0c48
5
5
  SHA512:
6
- metadata.gz: becc6540b82ff9d3a97b4b6c5e58f2a7b0872f63584abdee2c425860e1c47b07700f778550ab95bccb3fc7b6462f9fb2f6249ca7846d1a9a9319471e96577c55
7
- data.tar.gz: 67b2b12b88df52a19e84ef68a7773f2ec989dec3858b5d64e0e60961f8f9f4154eda3e36ef1548b61004c8af4cc6b6850ba73c145f15da41832944857c904889
6
+ metadata.gz: 51de2010ed26249277bccac04f2297877b14772c66d406d7b02d81f425ebd4258c56bb8f7f6919ef04db678bae78e803058361509b0dde3c267fe3e454d47e77
7
+ data.tar.gz: 90f2ffc8892553c8cf381fbeec93dabb1458dbb841b1485df47cf4482a286e1c8f1e971bded03a71c0ddc37d82717ab2b63f34d3ea049a691de9188b02263950
data/README.md CHANGED
@@ -150,11 +150,11 @@ receiver.solver.correction = { # provide by using a Hash
150
150
 
151
151
  ## Additional utilities
152
152
 
153
- ### [to_ubx](exe/to_ubx)
153
+ ### [gps2ubx](exe/gps2ubx) <sub>(formerly [to_ubx](../../tree/v0.8.4/exe/to_ubx))</sub>
154
154
 
155
155
  Utility to convert observation into u-blox ubx format and dump standard input. After installation of gps_pvt, to type
156
156
 
157
- $ to_ubx file_or_URI(s) (options) > out.ubx
157
+ $ gps2ubx file_or_URI(s) (options) > out.ubx
158
158
 
159
159
  saves resultant into out.ubx by using redirection. The shared options with gps_pvt executable are [rinex_obs](#opt_rinex_obs), [rinex_nav](#opt_rinex_nav), [ubx](#opt_ubx), and [online_ephemeris](#opt_online_ephemeris). In addition, the following options are available.
160
160
 
@@ -163,6 +163,18 @@ saves resultant into out.ubx by using redirection. The shared options with gps_p
163
163
  | ubx_rawx | | Change output packet types to UBX-RAWX from its default UBX-RAW. | v0.8.1 |
164
164
  | broadcast_data | | In addition to observation, ephemeris is inserted by using UBX-SFRB packets. If ubx_rawx option is specified, UBX-SFRBX is used instead of UBX-SFRB. | v0.8.1 |
165
165
 
166
+ ### [gps_get](exe/gps_get)
167
+
168
+ Utility to get and dump GPS files. After installation of gps_pvt, to type
169
+
170
+ $ gps_get file_or_URI(s) (options) > output_file
171
+
172
+ saves data into output_file by using redirection. http(s), ftp, and ntrip can be used as scheme of URI. Serial port is also supported. Note that compressed data is automatically decompressed before output. The following options are available.
173
+
174
+ | key | value | comment | since |
175
+ ----|----|----|----
176
+ | out | file | Change output target from the standard output. In addition to file, serial port is supported. | v0.8.5 |
177
+
166
178
  ## Development
167
179
 
168
180
  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.
File without changes
data/exe/gps_get ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gps_pvt/util'
4
+ require 'uri'
5
+
6
+ $stderr.puts <<__STRING__
7
+ Usage: #{__FILE__} file_or_URI(s) ...
8
+ This utility outputs GNSS data specified with file_or_URI(s).
9
+ A file_or_URI having additional ".gz" or ".Z" extension is recognized as a compressed file, and the decompression is performed before output.
10
+ In addition to a local file, major URIs such as http(s)://..., ftp://..., and ntrip:// are supported.
11
+ Serial port (COMn for Windows, /dev/tty* for *NIX) is also acceptable as an input file name.
12
+ __STRING__
13
+
14
+ options = []
15
+
16
+ files = ARGV.collect{|arg|
17
+ next arg unless arg =~ /^--([^=]+)=?/
18
+ k, v = [$1.downcase.to_sym, $']
19
+ options << [$1.to_sym, $']
20
+ nil
21
+ }.compact
22
+
23
+ spec2io = proc{
24
+ io_pool = {}
25
+ proc{|spec, mode_r|
26
+ mode_r = true if (mode_r == nil)
27
+ next (io_pool[spec] ||= open(spec)) if Serial::SPEC =~ spec # serial port
28
+ if (uri = (URI::parse(spec) rescue nil)) and !uri.instance_of?(URI::Generic) then # URI
29
+ if mode_r then
30
+ case uri
31
+ when URI::Ntrip; next URI::open(uri)
32
+ else; next GPS_PVT::Util::get_txt(uri)
33
+ end
34
+ end
35
+ raise "Unknown URI: #{spec}"
36
+ end
37
+ if mode_r then # file
38
+ next STDIN if spec == '-'
39
+ next open(GPS_PVT::Util::get_txt(spec), 'r') if File::exist?(spec)
40
+ raise "File not found: #{spec}"
41
+ else
42
+ next STDOUT if spec == '-'
43
+ open(spec, 'a+')
44
+ end
45
+ }
46
+ }.call
47
+
48
+ STDIN.binmode
49
+ STDOUT.binmode
50
+ dst, io_dst = proc{|spec| [spec, spec2io.call(spec, false)]}.call('-')
51
+
52
+ options.reject!{|k, v|
53
+ case k
54
+ when :out
55
+ dst, io_dst = [v, spec2io.call(v, false)]
56
+ next true
57
+ end
58
+ false
59
+ }
60
+ raise "Unknown option: #{options.first}" unless options.empty?
61
+
62
+ $stderr.puts "out: #{{'-' => '(stdout)'}[dst] || dst}"
63
+ threads = files.collect{|src|
64
+ $stderr.puts "in: #{{'-' => '(stdin)'}[src] || src}"
65
+ io_src = spec2io.call(src)
66
+ Thread.start{
67
+ io_dst.write(io_src.read(128)) until io_src.eof?
68
+ }
69
+ }
70
+ threads.each{|t| t.join}
data/exe/gps_pvt CHANGED
@@ -14,7 +14,8 @@ If you want to specify its format manually, command options like --rinex_nav=fil
14
14
  Other than --rinex_nav, --rinex_obs, -rinex_clk, --ubx, --sp3 or --antex are supported.
15
15
  Supported RINEX versions are 2 and 3.
16
16
  A file having additional ".gz" or ".Z" extension is recognized as a compressed file.
17
- Major URL such as http(s)://... or ftp://..., and serial port (COMn for Windows, /dev/tty* for *NIX) is acceptable as an input file name.
17
+ Major URI such as http(s)://... or ftp://..., and serial port (COMn for Windows, /dev/tty* for *NIX) is acceptable as an input file name.
18
+ Ntrip specified in URI as ntrip://(username):(password)@(caster_host):(port)/(mount_point) is also supported.
18
19
  __STRING__
19
20
 
20
21
  options = []
data/lib/gps_pvt/ntrip.rb CHANGED
@@ -44,6 +44,20 @@ class Ntrip < Net::HTTP
44
44
  :type, :identifier, :operator, :authentication, :fee,
45
45
  :web_net, :web_str, :web_reg],
46
46
  }
47
+ module MountPoints
48
+ [:select, :reject, :merge, :clone, :dup].each{|f|
49
+ define_method(f){|*args, &b| super(*args, &b).extend(MountPoints)}
50
+ }
51
+ D2R = Math::PI / 180
52
+ def near_from(lat_deg, lng_deg)
53
+ require 'gps_pvt/Coordinate'
54
+ llh0 = Coordinate::LLH::new(D2R * lat_deg, D2R * lng_deg, 0)
55
+ collect{|pt, prop|
56
+ llh = Coordinate::LLH::new(*([:latitude, :longitude].collect{|k| D2R * prop[k].to_f} + [0]))
57
+ [llh0.xyz.dist(llh.xyz), prop]
58
+ }.sort{|a, b| a[0] <=> b[0]} # return [distance, property]
59
+ end
60
+ end
47
61
  def Ntrip.parse_source_table(str)
48
62
  res = {}
49
63
  str.lines.each{|line|
@@ -55,11 +69,11 @@ class Ntrip < Net::HTTP
55
69
  entry[:misc] = values[(keys.size)..-1] if values.size > keys.size
56
70
  (res[type] ||= []) << entry
57
71
  }
58
- res.define_singleton_method(:mount_points){
72
+ res.define_singleton_method(:mount_points, lambda{
59
73
  Hash[*((self[:STR] || []).collect{|entry|
60
74
  [entry[:mountpoint], entry]
61
- }.flatten(1))]
62
- }
75
+ }.flatten(1))].extend(MountPoints)
76
+ })
63
77
  res
64
78
  end
65
79
  def generate_request(path, header)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GPS_PVT
4
- VERSION = "0.8.4"
4
+ VERSION = "0.8.5"
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.8.4
4
+ version: 0.8.5
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: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2022-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyserial
@@ -71,8 +71,9 @@ description: This module calculate PVT by using raw observation obtained from a
71
71
  email:
72
72
  - fenrir.naru@gmail.com
73
73
  executables:
74
+ - gps2ubx
75
+ - gps_get
74
76
  - gps_pvt
75
- - to_ubx
76
77
  extensions:
77
78
  - ext/gps_pvt/extconf.rb
78
79
  extra_rdoc_files: []
@@ -86,8 +87,9 @@ files:
86
87
  - Rakefile
87
88
  - bin/console
88
89
  - bin/setup
90
+ - exe/gps2ubx
91
+ - exe/gps_get
89
92
  - exe/gps_pvt
90
- - exe/to_ubx
91
93
  - ext/gps_pvt/Coordinate/Coordinate_wrap.cxx
92
94
  - ext/gps_pvt/GPS/GPS_wrap.cxx
93
95
  - ext/gps_pvt/SylphideMath/SylphideMath_wrap.cxx