gps_pvt 0.2.0 → 0.3.0

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: b49839b2da332d30293697783114af90a441fe477dfb85e17ac166c381970836
4
- data.tar.gz: 4227cc97c2bdd1c5994a598ab1723c9bad86331478f0cc60aaa8435302bc9838
3
+ metadata.gz: 3ceeb392e9d4a3df9a3b6af1ed6b19a92fec4fae110c9c89118602f3213d6905
4
+ data.tar.gz: c91c94043d2e39dde8ea0909dbd862f0194b15a4f2baa3030b48d760f933a147
5
5
  SHA512:
6
- metadata.gz: a81577f725c28dfe949342076d10826eb14238ec791bc58bc8b7797715b5bc6d6b014fd10454e8f2c56a66ac6b6d03965c79f9e94f39ac65b193fa815cd83924
7
- data.tar.gz: f7eb1d3c1eb4e4ef61d8ada6b12efe1a0d4a9c167d87fc6d2ee7f829dcddb0f3b3c50c6a47a58b08cce57ca220283e2f73af24fafed27da3bb112e4af71a5efd
6
+ metadata.gz: bcf702f83fd0df488470b385df370c3639e953b064a6acd9cdc4418a98b03ffab9c15dc9af0ad79185177bc3feb03e74b0ee0c9dba667bf73af1e1afabdca7be
7
+ data.tar.gz: eac046233bfd52db17a3fb94d2c74fcf01c8cd3200d0d5dce2546a669bb9313cccda4bdb74e2b991f1397d27325ec87d79d8c0e87be36b05fa6856daf0342ad0
data/README.md CHANGED
@@ -31,7 +31,17 @@ For user who just generate PVT solution, an attached executable is useful. After
31
31
 
32
32
  $ gps_pvt RINEX_or_UBX_file(s)
33
33
 
34
- For developer, this library will be used in the following:
34
+ The format of RINEX_or_UBX_file is automatically determined with its extention, such as .ubx will be treated as UBX format. If you want to specify the file format, instead of RINEX_or_UBX_file(s), use the following arguments:
35
+
36
+ --rinex_nav=filename
37
+ --rinex_obs=filename
38
+ --ubx=filename
39
+
40
+ From version 0.2.0, SBAS and QZSS are supported in addition to GPS. QZSS ranging is activated in default, however, SBAS is just utilized for ionospheric correction. If you want to activate SBAS ranging, "--with=(SBAS PRN number, ex. 137)" option is used with gps_pvt executable like
41
+
42
+ $ gps_pvt --with=137 RINEX_or_UBX_file(s)
43
+
44
+ For developer, this library will be used like:
35
45
 
36
46
  ```ruby
37
47
  require 'gps_pvt'
@@ -71,30 +81,47 @@ receiver.parse_rinex_obs(rinex_obs_file){|pvt, meas| # per epoch
71
81
  }
72
82
  }
73
83
 
74
- # Customize solution
84
+ ## Further customization
85
+ # General options
75
86
  receiver.solver.gps_options.exclude(prn) # Exclude satellite; the default is to use every satellite if visible
76
87
  receiver.solver.gps_options.include(prn) # Discard previous setting of exclusion
77
88
  receiver.solver.gps_options.elevation_mask = Math::PI / 180 * 10 # example 10 [deg] elevation mask
78
- receiver.solver.hooks[:relative_property] = proc{|prn, rel_prop, rcv_e, t_arv, usr_pos, usr_vel|
79
- # control weight per satellite per iteration
89
+ # receiver.solver.sbas_options is for SBAS.
90
+
91
+ # Precise control of properties for each satellite and for each iteration
92
+ receiver.solver.hooks[:relative_property] = proc{|prn, rel_prop, meas, rcv_e, t_arv, usr_pos, usr_vel|
80
93
  weight, range_c, range_r, rate_rel_neg, *los_neg = rel_prop # relative property
94
+ # meas is measurement represented by pseudo range of the selected satellite.
81
95
  # rcv_e, t_arv, usr_pos, usr_vel are temporary solution of
82
96
  # receiver clock error [m], time of arrival [s], user position and velocity in ECEF, respectively.
83
97
 
84
98
  weight = 1 # same as default; identical weight for each visible satellite
85
- # or weight based on elevation
99
+ # or weight based on elevation, for example:
86
100
  # elv = GPS_PVT::Coordinate::ENU::relative_rel(GPS_PVT::Coordinate::XYZ::new(*los_neg), usr_pos).elevation
87
101
  # weight = (Math::sin(elv)/0.8)**2
88
102
 
89
103
  [weight, range_c, range_r, rate_rel_neg] + los_neg # must return relative property
90
104
  }
91
105
 
106
+ # Range correction (since v0.3.0)
107
+ receiver.solver.correction = { # provide by using a Hash
108
+ # ionospheric and transpheric models are changeable, and current configuration
109
+ # can be obtained by receiver.solver.correction without assigner.
110
+ :gps_ionospheric => proc{|t, usr_pos_xyz, sat_pos_enu|
111
+ # t, usr_pos_xyz, sat_pos_enu are temporary solution of
112
+ # time of arrival [s], user position in ECEF,
113
+ # and satellite position in ENU respectively.
114
+ 0 # must return correction value, delaying is negative.
115
+ },
116
+ # combination of (gps or sbas) and (ionospheric or tropospheric) are available
117
+ }
118
+
92
119
  # Dynamic customization of weight for each epoch
93
120
  (class << receiver; self; end).instance_eval{ # do before parse_XXX
94
121
  alias_method(:run_orig, :run)
95
122
  define_method(:run){|meas, t_meas, &b|
96
123
  meas # observation, same as the 2nd argument of parse_XXX
97
- receiver.solver.hooks[:relative_property] = proc{|prn, rel_prop, rcv_e, t_arv, usr_pos, usr_vel|
124
+ receiver.solver.hooks[:relative_property] = proc{|prn, rel_prop, meas, rcv_e, t_arv, usr_pos, usr_vel|
98
125
  # Do something based on meas, t_meas.
99
126
  rel_prop
100
127
  }
data/Rakefile CHANGED
File without changes
data/exe/gps_pvt CHANGED
@@ -6,23 +6,35 @@ require 'gps_pvt'
6
6
 
7
7
  $stderr.puts <<__STRING__
8
8
  Usage: #{__FILE__} GPS_file1 GPS_file2 ...
9
- As GPS_file, rinex_nav(*.YYn), rinex_obs(*.YYo), and ubx(*.ubx) format are currently supported.
9
+ As GPS_file, rinex_nav(*.YYn, *.YYh, *.YYq), rinex_obs(*.YYo), and ubx(*.ubx) format are currently supported.
10
10
  File format is automatically determined based on its extention described in above parentheses.
11
+ If you want to specify its format manually, --rinex_(nav|obs)=file_name or --ubx=file_name are available.
12
+ Supported RINEX versions are 2 and 3.
11
13
  Note: YY = last two digit of year.
12
14
  __STRING__
13
15
 
14
16
  options = []
15
17
 
16
- # check options
17
- ARGV.reject!{|arg|
18
- next false unless arg =~ /^--([^=]+)=?/
18
+ # check options and file format
19
+ files = ARGV.collect{|arg|
20
+ next [arg, nil] unless arg =~ /^--([^=]+)=?/
21
+ k, v = [$1.downcase.to_sym, $']
22
+ next [v, k] if [:rinex_nav, :rinex_obs, :ubx].include?(k) # file type
19
23
  options << [$1.to_sym, $']
20
- true
21
- }
22
-
23
- # Check file existence
24
- ARGV.each{|arg|
25
- raise "File not found: #{arg}" unless File::exist?(arg)
24
+ nil
25
+ }.compact
26
+
27
+ # Check file existence and extension
28
+ files.collect!{|fname, ftype|
29
+ raise "File not found: #{fname}" unless File::exist?(fname)
30
+ ftype ||= case fname
31
+ when /\.\d{2}[nhq]$/; :rinex_nav
32
+ when /\.\d{2}o$/; :rinex_obs
33
+ when /\.ubx$/; :ubx
34
+ else
35
+ raise "Format cannot be guessed, use --(format, ex. rinex_nav)=#{fname}"
36
+ end
37
+ [fname, ftype]
26
38
  }
27
39
 
28
40
  rcv = GPS_PVT::Receiver::new(options)
@@ -30,17 +42,14 @@ rcv = GPS_PVT::Receiver::new(options)
30
42
  puts rcv.header
31
43
 
32
44
  # parse RINEX NAV
33
- ARGV.reject!{|arg|
34
- next false unless arg =~ /\.\d{2}[nq]$/
35
- rcv.parse_rinex_nav(arg)
45
+ files.each{|fname, ftype|
46
+ rcv.parse_rinex_nav(fname) if ftype == :rinex_nav
36
47
  }
37
48
 
38
49
  # other files
39
- ARGV.each{|arg|
40
- case arg
41
- when /\.ubx$/
42
- rcv.parse_ubx(arg)
43
- when /\.\d{2}o$/
44
- rcv.parse_rinex_obs(arg)
50
+ files.each{|fname, ftype|
51
+ case ftype
52
+ when :ubx; rcv.parse_ubx(fname)
53
+ when :rinex_obs; rcv.parse_rinex_obs(fname)
45
54
  end
46
55
  }