gps_pvt 0.8.3 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -4
- data/LICENSE +30 -0
- data/README.md +25 -13
- data/exe/{to_ubx → gps2ubx} +0 -0
- data/exe/gps_get +70 -0
- data/exe/gps_pvt +2 -1
- data/gps_pvt.gemspec +3 -1
- data/lib/gps_pvt/ntrip.rb +167 -0
- data/lib/gps_pvt/util.rb +7 -6
- data/lib/gps_pvt/version.rb +5 -1
- metadata +26 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65f27faf8bc6c61e51bd06217b50fad55277e59278c687971a4b3bd83e218603
|
4
|
+
data.tar.gz: 3d56b37228725e36d0edc6e5b1a2a2d2a2f1b42305124aa1abec8280253a0c48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51de2010ed26249277bccac04f2297877b14772c66d406d7b02d81f425ebd4258c56bb8f7f6919ef04db678bae78e803058361509b0dde3c267fe3e454d47e77
|
7
|
+
data.tar.gz: 90f2ffc8892553c8cf381fbeec93dabb1458dbb841b1485df47cf4482a286e1c8f1e971bded03a71c0ddc37d82717ab2b63f34d3ea049a691de9188b02263950
|
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
(The following license is applied to each file in which there is no license statement.)
|
2
|
+
|
3
|
+
BSD 3-Clause License
|
4
|
+
|
5
|
+
Copyright (c) 2022, M.Naruoka (fenrir)
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without
|
8
|
+
modification, are permitted provided that the following conditions are met:
|
9
|
+
|
10
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
11
|
+
list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
14
|
+
this list of conditions and the following disclaimer in the documentation
|
15
|
+
and/or other materials provided with the distribution.
|
16
|
+
|
17
|
+
3. Neither the name of the copyright holder nor the names of its
|
18
|
+
contributors may be used to endorse or promote products derived from
|
19
|
+
this software without specific prior written permission.
|
20
|
+
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
22
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
23
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
24
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
25
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
26
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
27
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
28
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
29
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
@@ -2,14 +2,18 @@
|
|
2
2
|
|
3
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
4
|
|
5
|
-
The PVT solution is obtained with a stand alone positioning (i.e. neither differential nor kinematic) with application of least square to each snapshot. 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
|
5
|
+
The PVT solution is obtained with a stand alone positioning (i.e. neither differential nor kinematic) with application of least square to each snapshot. 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 in C++, and wrapped by [SWIG](http://www.swig.org/).
|
6
6
|
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/gps_pvt.svg)](https://badge.fury.io/rb/gps_pvt)
|
8
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
9
|
|
10
10
|
## Installation
|
11
11
|
|
12
|
-
|
12
|
+
Install it yourself as:
|
13
|
+
|
14
|
+
$ gem install gps_pvt
|
15
|
+
|
16
|
+
Or add this line to your Ruby application's Gemfile:
|
13
17
|
|
14
18
|
```ruby
|
15
19
|
gem 'gps_pvt'
|
@@ -19,11 +23,7 @@ And then execute:
|
|
19
23
|
|
20
24
|
$ bundle install
|
21
25
|
|
22
|
-
|
23
|
-
|
24
|
-
$ gem install gps_pvt
|
25
|
-
|
26
|
-
For Windows users, this gem requires Devkit because of native compilation.
|
26
|
+
For Windows users, this gem requires Devkit because of compilation of native shared library.
|
27
27
|
|
28
28
|
## Usage
|
29
29
|
|
@@ -32,7 +32,7 @@ An attached executable is useful. After installation, type
|
|
32
32
|
|
33
33
|
$ gps_pvt file_or_URI(s)
|
34
34
|
|
35
|
-
The format of file is automatically determined with its extension, such as .ubx will be treated as UBX format. A compressed file of .gz or .Z can be specified directly (decompression is internally performed). URI such as http(s)://... and ftp://, and serial port (COMn for Windows and /dev/tty* for *NIX, version >= 0.8.0) are also acceptable. If you want to specify the file format, instead of file_or_URI(s), use the following arguments:
|
35
|
+
The format of file is automatically determined with its extension, such as .ubx will be treated as UBX format. A compressed file of .gz or .Z can be specified directly (decompression is internally performed). URI such as http(s)://... and ftp://, and serial port (COMn for Windows and /dev/tty* for *NIX, version >= 0.8.0) are also acceptable. Moreover, Ntrip URI of ntrip://(username):(password)@(caster_host):(port)/(mount_point), for exmaple, ```ntrip://test%40example.com:none@rtk2go.com:2101/NAIST-UBX``` (%40 is recognized as '@') is supported (version >= 0.8.4). If you want to specify the file format, instead of file_or_URI(s), use the following arguments:
|
36
36
|
|
37
37
|
| specification | recoginized as |
|
38
38
|
----|----
|
@@ -57,7 +57,7 @@ Additionally, the following command options *--key=value* are available.
|
|
57
57
|
| end_time | time string | end time to perform solution. Its format is the same as start_time. | v0.3.3 |
|
58
58
|
| <a name=opt_online_ephemeris>online_ephemeris</a> | URL string | based on observation, ephemeris which is previously broadcasted from satellite and currently published online will automatically be loaded. If value is not given, the default source "ftp://gssc.esa.int/gnss/data/daily/%Y/brdc/BRDC00IGS_R_%Y%j0000_01D_MN.rnx.gz" is used. The value string is converted with [strftime](https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html) before actual use. | v0.8.1 |
|
59
59
|
|
60
|
-
### For
|
60
|
+
### For advanced user
|
61
61
|
|
62
62
|
This library will be used like:
|
63
63
|
|
@@ -136,25 +136,25 @@ receiver.solver.correction = { # provide by using a Hash
|
|
136
136
|
|
137
137
|
# Dynamic customization of weight for each epoch
|
138
138
|
(class << receiver; self; end).instance_eval{ # do before parse_XXX
|
139
|
-
|
139
|
+
run_orig = instance_method(:run)
|
140
140
|
define_method(:run){|meas, t_meas, &b|
|
141
141
|
meas # observation, same as the 2nd argument of parse_XXX
|
142
142
|
receiver.solver.hooks[:relative_property] = proc{|prn, rel_prop, meas, rcv_e, t_arv, usr_pos, usr_vel|
|
143
143
|
# Do something based on meas, t_meas.
|
144
144
|
rel_prop
|
145
145
|
}
|
146
|
-
run_orig(meas, t_meas, &b)
|
146
|
+
run_orig.bind(self).call(meas, t_meas, &b)
|
147
147
|
}
|
148
148
|
}
|
149
149
|
```
|
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
|
-
$
|
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.
|
data/exe/{to_ubx → gps2ubx}
RENAMED
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
|
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/gps_pvt.gemspec
CHANGED
@@ -59,8 +59,10 @@ Gem::Specification.new do |spec|
|
|
59
59
|
# Uncomment to register a new dependency of your gem
|
60
60
|
# spec.add_dependency "example-gem", "~> 1.0"
|
61
61
|
spec.add_dependency "rubyserial"
|
62
|
-
spec.add_development_dependency "rake"
|
62
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
63
63
|
spec.add_development_dependency "rake-compiler"
|
64
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
65
|
+
spec.add_development_dependency "matrix" if GPS_PVT::version_compare(RUBY_VERSION, "3.1") >= 0
|
64
66
|
|
65
67
|
# For more information and examples about making a new gem, checkout our
|
66
68
|
# guide at: https://bundler.io/guides/creating_gem.html
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# Ntrip (Networked Transport of RTCM via Internet Protocol)
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'uri'
|
5
|
+
require_relative 'version'
|
6
|
+
|
7
|
+
module GPS_PVT
|
8
|
+
class Ntrip < Net::HTTP
|
9
|
+
Net::HTTPResponse.class_eval{
|
10
|
+
orig = singleton_method(:read_new)
|
11
|
+
define_singleton_method(:read_new){|sock|
|
12
|
+
# handle Ntrip(rev1), which does not comply with HTTP
|
13
|
+
unless sock.respond_to?(:ntrip) then
|
14
|
+
orig.call(sock)
|
15
|
+
else
|
16
|
+
str = sock.readline
|
17
|
+
case str
|
18
|
+
when /\A(?:(?:HTTP(?:\/(\d+\.\d+))?|([^\d\s]+))\s+)?(\d\d\d)(?:\s+(.*))?\z/in
|
19
|
+
res = response_class($3).new($1 || '1.1', $3, $2 || $4)
|
20
|
+
each_response_header(sock){|k,v|
|
21
|
+
res.add_field k, v
|
22
|
+
} unless res.message == 'ICY' # or 'SOURCETABLE' for Ntrip(rev1)
|
23
|
+
res
|
24
|
+
else
|
25
|
+
raise Net::HTTPBadResponse, "wrong status line: #{str.dump}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
}
|
29
|
+
}
|
30
|
+
def on_connect
|
31
|
+
super
|
32
|
+
@socket.define_singleton_method(:ntrip){true}
|
33
|
+
end
|
34
|
+
|
35
|
+
SOURCE_TBL_ITEMS = {
|
36
|
+
:STR => [
|
37
|
+
:type, :mountpoint, :identifier, :format, :format_details,
|
38
|
+
:carrier, :nav_system, :network, :country, :latitude, :longitude,
|
39
|
+
:nmea, :solution, :generator, :compression, :authentication, :fee, :bitrate],
|
40
|
+
:CAS => [
|
41
|
+
:type, :host, :port, :identifier, :operator,
|
42
|
+
:nmea, :country, :latitude, :longitude, :fallback_host, :fallback_ip],
|
43
|
+
:NET => [
|
44
|
+
:type, :identifier, :operator, :authentication, :fee,
|
45
|
+
:web_net, :web_str, :web_reg],
|
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
|
61
|
+
def Ntrip.parse_source_table(str)
|
62
|
+
res = {}
|
63
|
+
str.lines.each{|line|
|
64
|
+
values = line.chomp.split(/\s*;\s*/)
|
65
|
+
type = values[0].to_sym
|
66
|
+
next unless keys = SOURCE_TBL_ITEMS[type]
|
67
|
+
next unless (values.size >= keys.size)
|
68
|
+
entry = Hash[*(keys.zip(values).flatten(1))]
|
69
|
+
entry[:misc] = values[(keys.size)..-1] if values.size > keys.size
|
70
|
+
(res[type] ||= []) << entry
|
71
|
+
}
|
72
|
+
res.define_singleton_method(:mount_points, lambda{
|
73
|
+
Hash[*((self[:STR] || []).collect{|entry|
|
74
|
+
[entry[:mountpoint], entry]
|
75
|
+
}.flatten(1))].extend(MountPoints)
|
76
|
+
})
|
77
|
+
res
|
78
|
+
end
|
79
|
+
def generate_request(path, header)
|
80
|
+
req = Net::HTTP::Get.new(path, {
|
81
|
+
'User-Agent' => "GPS_PVT NTRIP client/#{GPS_PVT::VERSION}",
|
82
|
+
'Accept' => '*/*',
|
83
|
+
'Ntrip-Version' => 'Ntrip/2.0',
|
84
|
+
}.merge(header.select{|k, v| k.kind_of?(String)}))
|
85
|
+
header.each{|k, v|
|
86
|
+
next unless k.kind_of?(Symbol)
|
87
|
+
req.send(k, *v)
|
88
|
+
}
|
89
|
+
req
|
90
|
+
end
|
91
|
+
def get_source_table(header = {})
|
92
|
+
Ntrip.parse_source_table(request(generate_request('/', header)).read_body)
|
93
|
+
end
|
94
|
+
def get_data(mount_point, header = {}, &b)
|
95
|
+
request(generate_request("/#{mount_point}", header)){|res|
|
96
|
+
res.read_body(&b)
|
97
|
+
}
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
require 'open-uri'
|
103
|
+
|
104
|
+
OpenURI.class_eval{
|
105
|
+
check_options_orig = singleton_method(:check_options)
|
106
|
+
define_singleton_method(:check_options){|options|
|
107
|
+
uri = options.delete(:uri)
|
108
|
+
case uri
|
109
|
+
when URI::Ntrip
|
110
|
+
options[:basic_auth] ||=
|
111
|
+
options.delete(:http_basic_authentication) ||
|
112
|
+
([:user, :password].collect{|k|
|
113
|
+
URI::decode_www_form_component(uri.send(k))
|
114
|
+
} rescue nil)
|
115
|
+
options['Ntrip-Version'] ||= "Ntrip/%3.1f"%[options.delete(:version)] if options[:version]
|
116
|
+
options['User-Agent'] ||= options[:user_agent]
|
117
|
+
options.select!{|k, v| v} #compact! Ruby >= 2.4.0
|
118
|
+
true
|
119
|
+
else
|
120
|
+
check_options_orig.call(options)
|
121
|
+
end
|
122
|
+
}
|
123
|
+
open_uri_orig = singleton_method(:open_uri)
|
124
|
+
define_singleton_method(:open_uri){|name, *rest, &b|
|
125
|
+
uri = URI::Generic === name ? name : URI.parse(name)
|
126
|
+
(rest[-1].kind_of?(Hash) ? rest : (rest << {}))[-1][:uri] = uri
|
127
|
+
open_uri_orig.call(uri, *rest, &b)
|
128
|
+
}
|
129
|
+
def OpenURI.open_ntrip(buf, target, proxy, options) # :nodoc:
|
130
|
+
GPS_PVT::Ntrip.start(target.host, target.port){|ntrip|
|
131
|
+
# get source table
|
132
|
+
tbl = ntrip.get_source_table(options)
|
133
|
+
|
134
|
+
# check mount point
|
135
|
+
mnt_pt = target.path.sub(%r|^/|, '')
|
136
|
+
prop = tbl.mount_points[mnt_pt]
|
137
|
+
raise Net::ProtocolError::new("Mount point(#{mnt_pt}) not found") unless prop
|
138
|
+
|
139
|
+
# set stream
|
140
|
+
buf.instance_eval{
|
141
|
+
@io, w = IO::pipe
|
142
|
+
@io.define_singleton_method(:property){prop}
|
143
|
+
Thread::new{
|
144
|
+
begin
|
145
|
+
ntrip.get_data(mnt_pt, options){|data| w << data}
|
146
|
+
rescue Errno::EPIPE;
|
147
|
+
rescue; raise
|
148
|
+
ensure; w.close
|
149
|
+
end
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
end
|
154
|
+
}
|
155
|
+
module URI
|
156
|
+
class Ntrip < HTTP
|
157
|
+
def buffer_open(buf, proxy, options)
|
158
|
+
OpenURI.open_ntrip(buf, self, proxy, options)
|
159
|
+
end
|
160
|
+
include OpenURI::OpenRead
|
161
|
+
end
|
162
|
+
if respond_to?(:register_scheme) then
|
163
|
+
register_scheme('NTRIP', Ntrip)
|
164
|
+
else
|
165
|
+
@@schemes['NTRIP'] = Ntrip
|
166
|
+
end
|
167
|
+
end
|
data/lib/gps_pvt/util.rb
CHANGED
@@ -23,16 +23,18 @@ proc{
|
|
23
23
|
}
|
24
24
|
def eof?; false; end
|
25
25
|
}
|
26
|
-
Kernel
|
27
|
-
open_orig =
|
26
|
+
module Kernel
|
27
|
+
open_orig = instance_method(:open)
|
28
28
|
define_method(:open){|*args, &b|
|
29
|
-
return open_orig.call(*args, &b) unless Serial::SPEC =~ args[0]
|
29
|
+
return open_orig.bind(self).call(*args, &b) unless Serial::SPEC =~ args[0]
|
30
30
|
Serial::new($1, $2 ? $2.to_i : 115200)
|
31
31
|
}
|
32
|
-
|
32
|
+
module_function(:open)
|
33
|
+
end
|
33
34
|
}.call if require 'rubyserial'
|
34
35
|
|
35
36
|
require 'open-uri'
|
37
|
+
require_relative 'ntrip'
|
36
38
|
|
37
39
|
module GPS_PVT
|
38
40
|
module Util
|
@@ -53,8 +55,7 @@ module Util
|
|
53
55
|
end
|
54
56
|
def get_txt(fname_or_uri)
|
55
57
|
is_uri = fname_or_uri.kind_of?(URI)
|
56
|
-
(
|
57
|
-
.send(:open, fname_or_uri){|src|
|
58
|
+
(is_uri ? URI : Kernel).send(:open, fname_or_uri){|src|
|
58
59
|
compressed = proc{
|
59
60
|
case src.content_type
|
60
61
|
when /gzip/; next :gz
|
data/lib/gps_pvt/version.rb
CHANGED
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
|
+
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-
|
11
|
+
date: 2022-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyserial
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake-compiler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,13 +52,28 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
55
69
|
description: This module calculate PVT by using raw observation obtained from a GPS
|
56
70
|
receiver
|
57
71
|
email:
|
58
72
|
- fenrir.naru@gmail.com
|
59
73
|
executables:
|
74
|
+
- gps2ubx
|
75
|
+
- gps_get
|
60
76
|
- gps_pvt
|
61
|
-
- to_ubx
|
62
77
|
extensions:
|
63
78
|
- ext/gps_pvt/extconf.rb
|
64
79
|
extra_rdoc_files: []
|
@@ -67,12 +82,14 @@ files:
|
|
67
82
|
- CHANGELOG.md
|
68
83
|
- CODE_OF_CONDUCT.md
|
69
84
|
- Gemfile
|
85
|
+
- LICENSE
|
70
86
|
- README.md
|
71
87
|
- Rakefile
|
72
88
|
- bin/console
|
73
89
|
- bin/setup
|
90
|
+
- exe/gps2ubx
|
91
|
+
- exe/gps_get
|
74
92
|
- exe/gps_pvt
|
75
|
-
- exe/to_ubx
|
76
93
|
- ext/gps_pvt/Coordinate/Coordinate_wrap.cxx
|
77
94
|
- ext/gps_pvt/GPS/GPS_wrap.cxx
|
78
95
|
- ext/gps_pvt/SylphideMath/SylphideMath_wrap.cxx
|
@@ -117,6 +134,7 @@ files:
|
|
117
134
|
- gps_pvt.gemspec
|
118
135
|
- gps_pvt.rbs
|
119
136
|
- lib/gps_pvt.rb
|
137
|
+
- lib/gps_pvt/ntrip.rb
|
120
138
|
- lib/gps_pvt/receiver.rb
|
121
139
|
- lib/gps_pvt/receiver/extension.rb
|
122
140
|
- lib/gps_pvt/ubx.rb
|