Module: GPS_PVT::RTCM3::Packet::MSM4_6

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



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/gps_pvt/rtcm3.rb', line 415

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 * 1), nsat] # DF398
  range_fine = self[offset + (nsat * 2), ncell] # DF400/405
  phase_fine = self[offset + (nsat * 2) + (ncell * 1), ncell] # DF401/406
  halfc_amb = self[offset + (nsat * 2) + (ncell * 3), ncell] # DF420
  cn = self[offset + (nsat * 2) + (ncell * 4), ncell] # DF403/408
  Hash[*([:sat_sig, :pseudo_range, :phase_range, :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),
            cn[i][0],
            halfc_amb[i][0]]
      }.transpose).flatten(1))]
end