comtec-dr 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/comtec_mov_demux +18 -0
- data/exe/comtec_mov_extract_csv +29 -0
- data/lib/comtec-dr.rb +2 -0
- data/lib/comtec-dr/gps_log.rb +53 -0
- data/lib/comtec-dr/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c74a683bfdc83ede96d433fead7b21daabd90d19
|
4
|
+
data.tar.gz: 0cd484b3e4f7e722aa12809c45edd9847984df33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca73f21d56a4bb3a22dbd02e24aab1ab9e7c4184efcbdd9c940ba70c98e4f3c1e92d9a3dbe1ba2a47e5c4ca5a291acf0a3f37c3bf20072205f51d20f4d6840d9
|
7
|
+
data.tar.gz: 7e30ce78e2915a33b6bd27bad126ea9de86f3bc56cfc42e835b464800d22211470172592f97a1a387fbd647e28a9f76601b59d97b3fc0a7a0cfddb06cdbf2290
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require 'pathname'
|
5
|
+
require "comtec-dr"
|
6
|
+
|
7
|
+
ARGV.each do |arg|
|
8
|
+
path = Pathname arg
|
9
|
+
if path.file? && path.basename.to_s.end_with?('.MOV')
|
10
|
+
puts ComtecDR::MovDemuxer.demux path.to_s
|
11
|
+
elsif path.directory?
|
12
|
+
path.children.each do |child_path|
|
13
|
+
if child_path.file? && child_path.basename.to_s.end_with?('.MOV')
|
14
|
+
puts ComtecDR::MovDemuxer.demux child_path.to_s
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require 'pathname'
|
5
|
+
require 'csv'
|
6
|
+
require "comtec-dr"
|
7
|
+
|
8
|
+
ARGV.each do |arg|
|
9
|
+
path = Pathname arg
|
10
|
+
if path.file? && path.basename.to_s.end_with?('.MOV')
|
11
|
+
CSV.open("#{path.basename.to_s}.csv",'w') do |csv|
|
12
|
+
ComtecDR::UdatAnalyzer.analyze(ComtecDR::MovDemuxer.demux path.to_s).each do |line|
|
13
|
+
log = GpsLog.new *line
|
14
|
+
csv << log.csv_line
|
15
|
+
end
|
16
|
+
end
|
17
|
+
elsif path.directory?
|
18
|
+
CSV.open("#{path.basename.to_s}.csv",'w') do |csv|
|
19
|
+
path.children.each do |child_path|
|
20
|
+
if child_path.file? && child_path.basename.to_s.end_with?('.MOV')
|
21
|
+
ComtecDR::UdatAnalyzer.analyze(ComtecDR::MovDemuxer.demux child_path.to_s).each do |line|
|
22
|
+
log = GpsLog.new *line
|
23
|
+
csv << log.csv_line
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/comtec-dr.rb
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
class GpsLog
|
2
|
+
def initialize lat, lat_s, lon, lon_s, speed, jst, time, x_a, y_a, z_a
|
3
|
+
@lat = lat
|
4
|
+
@lat_sign = lat_s
|
5
|
+
@lon = lon
|
6
|
+
@lon_sign = lon_s
|
7
|
+
@speed = speed
|
8
|
+
@jst = jst
|
9
|
+
@time = time
|
10
|
+
@x_acceleration = x_a
|
11
|
+
@y_acceleration = y_a
|
12
|
+
@z_acceleration = z_a
|
13
|
+
end
|
14
|
+
|
15
|
+
def lat
|
16
|
+
(dmm_to_dms(@lat) * (@lat_sign == 'N' ? 1 : -1)).to_f
|
17
|
+
end
|
18
|
+
|
19
|
+
def lon
|
20
|
+
(dmm_to_dms(@lon) * (@lon_sign == 'E' ? 1 : -1)).to_f
|
21
|
+
end
|
22
|
+
|
23
|
+
def speed
|
24
|
+
@speed.to_i
|
25
|
+
end
|
26
|
+
|
27
|
+
def jst
|
28
|
+
Time.parse "20#{@jst}}+0900"
|
29
|
+
end
|
30
|
+
|
31
|
+
def x_acceleration
|
32
|
+
@x_acceleration.to_f/10000
|
33
|
+
end
|
34
|
+
|
35
|
+
def y_acceleration
|
36
|
+
@y_acceleration.to_f/10000
|
37
|
+
end
|
38
|
+
|
39
|
+
def z_acceleration
|
40
|
+
@z_acceleration.to_f/10000
|
41
|
+
end
|
42
|
+
|
43
|
+
def csv_line
|
44
|
+
[lat, lon, speed, jst, x_acceleration, y_acceleration, z_acceleration]
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
# DMM形式から変換
|
49
|
+
def dmm_to_dms str
|
50
|
+
number, fractional = str.split('.')
|
51
|
+
number[0...-2].to_r + "#{number[-2..-1]}.#{fractional}".to_r / 60
|
52
|
+
end
|
53
|
+
end
|
data/lib/comtec-dr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comtec-dr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogo Kawaguchi
|
@@ -55,7 +55,9 @@ dependencies:
|
|
55
55
|
description: comtec drive recorder analyzer
|
56
56
|
email:
|
57
57
|
- platycod0n.ramosa@gmail.com
|
58
|
-
executables:
|
58
|
+
executables:
|
59
|
+
- comtec_mov_demux
|
60
|
+
- comtec_mov_extract_csv
|
59
61
|
extensions: []
|
60
62
|
extra_rdoc_files: []
|
61
63
|
files:
|
@@ -68,7 +70,10 @@ files:
|
|
68
70
|
- bin/console
|
69
71
|
- bin/setup
|
70
72
|
- comtec-dr.gemspec
|
73
|
+
- exe/comtec_mov_demux
|
74
|
+
- exe/comtec_mov_extract_csv
|
71
75
|
- lib/comtec-dr.rb
|
76
|
+
- lib/comtec-dr/gps_log.rb
|
72
77
|
- lib/comtec-dr/mov_demuxer.rb
|
73
78
|
- lib/comtec-dr/udat_analyzer.rb
|
74
79
|
- lib/comtec-dr/version.rb
|