Class: ComtecDR::GpsLog

Inherits:
Object
  • Object
show all
Defined in:
lib/comtec-dr/gps_log.rb

Instance Method Summary collapse

Constructor Details

#initialize(lat, lat_s, lon, lon_s, speed, jst, msec, x_a, y_a, z_a, filename) ⇒ GpsLog

Returns a new instance of GpsLog.



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/comtec-dr/gps_log.rb', line 3

def initialize lat, lat_s, lon, lon_s, speed, jst, msec, x_a, y_a, z_a, filename
  @lat      = lat
  @lat_sign = lat_s
  @lon      = lon
  @lon_sign = lon_s
  @speed = speed
  @jst   = jst
  @msec  = msec
  @x_acceleration = x_a
  @y_acceleration = y_a
  @z_acceleration = z_a
  @filename = filename
end

Instance Method Details

#csv_lineObject



49
50
51
# File 'lib/comtec-dr/gps_log.rb', line 49

def csv_line
  [lat, lon, speed, jst, msec, x_acceleration, y_acceleration, z_acceleration, @filename]
end

#jstObject



29
30
31
# File 'lib/comtec-dr/gps_log.rb', line 29

def jst
  Time.parse "20#{@jst}}+0900"
end

#latObject



17
18
19
# File 'lib/comtec-dr/gps_log.rb', line 17

def lat
  (dmm_to_dms(@lat) * (@lat_sign == 'N' ? 1 : -1)).to_f
end

#lonObject



21
22
23
# File 'lib/comtec-dr/gps_log.rb', line 21

def lon
  (dmm_to_dms(@lon) * (@lon_sign == 'E' ? 1 : -1)).to_f
end

#msecObject



33
34
35
# File 'lib/comtec-dr/gps_log.rb', line 33

def msec
  @msec.to_i
end

#speedObject



25
26
27
# File 'lib/comtec-dr/gps_log.rb', line 25

def speed
  @speed.to_i
end

#x_accelerationObject



37
38
39
# File 'lib/comtec-dr/gps_log.rb', line 37

def x_acceleration
  @x_acceleration.to_f/1000
end

#y_accelerationObject



41
42
43
# File 'lib/comtec-dr/gps_log.rb', line 41

def y_acceleration
  @y_acceleration.to_f/1000
end

#z_accelerationObject



45
46
47
# File 'lib/comtec-dr/gps_log.rb', line 45

def z_acceleration
  @z_acceleration.to_f/1000
end