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) ⇒ GpsLog

Returns a new instance of GpsLog.



3
4
5
6
7
8
9
10
11
12
13
14
# 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
  @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
end

Instance Method Details

#csv_lineObject



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

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

#jstObject



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

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

#latObject



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

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

#lonObject



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

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

#msecObject



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

def msec
  @msec.to_i
end

#speedObject



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

def speed
  @speed.to_i
end

#x_accelerationObject



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

def x_acceleration
  @x_acceleration.to_f/1000
end

#y_accelerationObject



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

def y_acceleration
  @y_acceleration.to_f/1000
end

#z_accelerationObject



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

def z_acceleration
  @z_acceleration.to_f/1000
end