#!/usr/local/bin/ruby -Ks $: << '~/src/eclipse/autopilot/common/ruby' require 'ublox' if $0 == __FILE__ then if ARGV.size < 1 then puts "Usage: #{__FILE__} target_log" end longlats = [] open(ARGV[0]).each{|line| #(ARGV.size >= 1 ? open(ARGV[0]) : $stdin) if line =~ /^G/ then packet = U_blox::string2packet(line[2...(line.size - 2)]) if !U_blox::valid_header?(packet) then next end if !U_blox::valid_size?(packet) then next end if !U_blox::valid_parity?(packet) then next end longlat = U_blox::fetch_longlatheight(packet) longlats << longlat[0..1] if longlat end } previous_lat = 0 previous_long = 0 longlats.each{|longlat| long, lat = longlat if previous_long == long and previous_lat == long then next end puts " [#{previous_long = long},#{previous_lat = lat}]," } end