#!/usr/bin/env ruby if ARGV.size < 2 then puts "Usage #{__FILE__} ez_in gaia" puts "ez => GPS; gaia => a, omega" exit end preamble = '' open(ARGV[0]).each{|line| if line =~ /^Target device is/ then preamble += 'Target device is ez_gaia.' break end preamble += line } ez_G = [] line_no = 0 open(ARGV.shift).each{|line| line.chop! if line =~ /^G/ then ez_G << ((line.split(/\s+/))[1..-1]).collect{|v| v.to_f} end #if (line_no += 1) > 2000 then break end } gaia_A = [] line_no = 0 open(ARGV.shift).each{|line| line.chop! temp = line.split(/,/) itow = (temp[0].to_f * 1000).to_i temp_a = [10, 11, 12, 14, 13, 15].collect{|i| temp[i].to_f} #p line #p [itow, *temp_a] gaia_A << [itow, *temp_a] #if (line_no += 1) > 2000 then break end } puts preamble while !ez_G.empty? packet_g = ez_G.shift while !(gaia_A.empty?) and (packet_g[0] > gaia_A[0][0]) packet_a = gaia_A.shift printf("A %10d", packet_a.shift) packet_a.each{|item| printf(" %8s", item)} puts end printf('G %10d', packet_g[0]) packet_g[1..-1].each{|param| printf('%12f', param)} puts end while !(gaia_A.empty?) packet_a = gaia_A.shift printf("A %10d", packet_a.shift) packet_a.each{|item| printf(" %8s", item)} puts end