Module: GPS_PVT::RTCM3::Packet::MSM5_7

Includes:
MSM
Defined in:
lib/gps_pvt/rtcm3.rb

Constant Summary

Constants included from MSM

GPS_PVT::RTCM3::Packet::MSM::SPEED_OF_LIGHT

Instance Method Summary collapse

Methods included from MSM_Header

#more_data?, #property

Instance Method Details

#rangesObject



437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/gps_pvt/rtcm3.rb', line 437

def ranges
  sats, cells, offset = property.values_at(:sats, :cells, :header_items)
  nsat, ncell = [sats.size, cells.size]
  range_rough = self[offset, nsat] # DF397
  range_rough2 = self[offset + (nsat * 2), nsat] # DF398
  delta_rough = self[offset + (nsat * 3), nsat] # DF399
  range_fine = self[offset + (nsat * 4), ncell] # DF400/405
  phase_fine = self[offset + (nsat * 4) + (ncell * 1), ncell] # DF401/406
  halfc_amb = self[offset + (nsat * 4) + (ncell * 3), ncell] # DF420
  cn = self[offset + (nsat * 4) + (ncell * 4), ncell] # DF403/408
  delta_fine = self[offset + (nsat * 4) + (ncell * 5), ncell] # DF404
  Hash[*([:sat_sig, :pseudo_range, :phase_range, :phase_range_rate, :cn, :halfc_amb].zip(
      [cells] + cells.collect.with_index{|(sat, sig), i|
        i2 = sats.find_index(sat)
        rough_ms = (range_rough2[i2][0] + range_rough[i2][0]) rescue nil
        [(((range_fine[i][0] + rough_ms) * SPEED_OF_LIGHT) rescue nil),
            (((phase_fine[i][0] + rough_ms) * SPEED_OF_LIGHT) rescue nil),
            ((delta_fine[i][0] + delta_rough[i2][0]) rescue nil),
            cn[i][0],
            halfc_amb[i][0]]
      }.transpose).flatten(1))]
end