jeti-log 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jeti/log.rb +3 -1
- data/lib/jeti/log/composite_dataset_builder.rb +30 -0
- data/lib/jeti/log/file.rb +31 -61
- data/lib/jeti/log/mezon_data.rb +15 -10
- data/lib/jeti/log/mgps_data.rb +40 -0
- data/lib/jeti/log/tx_data.rb +7 -0
- data/lib/jeti/log/version.rb +1 -1
- data/spec/data/tx-controls.log +99 -0
- data/spec/file_spec.rb +19 -9
- data/spec/mezon_data_spec.rb +1 -1
- data/spec/{coordinate_spec.rb → mgps_data_spec.rb} +1 -1
- data/spec/tx_data_spec.rb +7 -0
- metadata +12 -6
- data/lib/jeti/log/coordinate.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 524fb73de38b2fab3e17ae6ecc55028d3f8f3262
|
4
|
+
data.tar.gz: bb43f164323fdb1b10c50f8dfed235aa74604fe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cde12671376244b78728f2ce35a83496b53250c93f55adff1637a7136560e3a87a63033c334cc463e9c2210efdde4fd5d5ffa712f8877db5453807edaabbfc68
|
7
|
+
data.tar.gz: 7289922bf86762c069ac0f2378323b4949b865dc3206ff2b18e68cf7212b442ae7bdaccf392478bfae52ad718eb754909912d914baaceb6bf90f78ad6b1361d2
|
data/lib/jeti/log.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
require 'jeti/log/
|
1
|
+
require 'jeti/log/composite_dataset_builder'
|
2
2
|
require 'jeti/log/entry'
|
3
3
|
require 'jeti/log/file'
|
4
4
|
require 'jeti/log/header'
|
5
5
|
require 'jeti/log/mezon_data'
|
6
|
+
require 'jeti/log/mgps_data'
|
6
7
|
require 'jeti/log/mui_data'
|
8
|
+
require 'jeti/log/tx_data'
|
7
9
|
require 'jeti/log/version'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Jeti; module Log;
|
2
|
+
|
3
|
+
class CompositeDatasetBuilder
|
4
|
+
|
5
|
+
def self.build(file, clazz, device, primary, *others)
|
6
|
+
primaries = if primary.is_a? Array
|
7
|
+
file.value_dataset(device, primary[0], primary[1])
|
8
|
+
else
|
9
|
+
file.value_dataset(device, primary)
|
10
|
+
end
|
11
|
+
|
12
|
+
other_data = others.map do |other|
|
13
|
+
if other.is_a? Array
|
14
|
+
file.value_dataset(device, other[0], other[1])
|
15
|
+
else
|
16
|
+
file.value_dataset(device, other)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
primaries.map do |raw|
|
21
|
+
time = raw[0]
|
22
|
+
f0 = raw[1]
|
23
|
+
fn = other_data.map { |d| d.min_by { |dp| (dp[0] - time).abs }[1] }
|
24
|
+
clazz.new(time, fn.unshift(f0))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end; end
|
data/lib/jeti/log/file.rb
CHANGED
@@ -60,7 +60,7 @@ module Jeti; module Log;
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def antenna1_signals
|
63
|
-
@antenna1_signals ||=
|
63
|
+
@antenna1_signals ||= value_dataset(/Rx/, /A1/)
|
64
64
|
end
|
65
65
|
|
66
66
|
def antenna2_signals?
|
@@ -68,7 +68,7 @@ module Jeti; module Log;
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def antenna2_signals
|
71
|
-
@antenna2_signals ||=
|
71
|
+
@antenna2_signals ||= value_dataset(/Rx/, /A2/)
|
72
72
|
end
|
73
73
|
|
74
74
|
def rx_voltages?
|
@@ -84,15 +84,15 @@ module Jeti; module Log;
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def signal_qualities
|
87
|
-
@signal_qualities ||=
|
87
|
+
@signal_qualities ||= value_dataset(/Rx/, /Q/)
|
88
88
|
end
|
89
89
|
|
90
|
-
def
|
90
|
+
def mgps_data?
|
91
91
|
device_present?(/MGPS/)
|
92
92
|
end
|
93
93
|
|
94
|
-
def
|
95
|
-
@
|
94
|
+
def mgps_data
|
95
|
+
@mgps_data ||= MGPSDataBuilder.build(self)
|
96
96
|
end
|
97
97
|
|
98
98
|
def mezon_data?
|
@@ -100,14 +100,22 @@ module Jeti; module Log;
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def mezon_data
|
103
|
-
@mezon_data ||=
|
103
|
+
@mezon_data ||= MezonDataBuilder.build(self)
|
104
|
+
end
|
105
|
+
|
106
|
+
def tx_data?
|
107
|
+
device_present?(/Tx/)
|
108
|
+
end
|
109
|
+
|
110
|
+
def tx_data
|
111
|
+
@tx_data ||= build_tx_data
|
104
112
|
end
|
105
113
|
|
106
114
|
# Determines if KML methods can be called for this session.
|
107
115
|
#
|
108
116
|
# @return [Boolean] true if KML can be generated for this session, false otherwise
|
109
117
|
def to_kml?
|
110
|
-
|
118
|
+
mgps_data?
|
111
119
|
end
|
112
120
|
|
113
121
|
# Converts the session into a KML document containing a placemark.
|
@@ -164,7 +172,7 @@ module Jeti; module Log;
|
|
164
172
|
raise RuntimeError, 'No coordinates available for KML generation' unless to_kml?
|
165
173
|
options = apply_default_placemark_options(options)
|
166
174
|
|
167
|
-
coords =
|
175
|
+
coords = mgps_data.map { |l| [l.longitude, l.latitude, l.altitude] }
|
168
176
|
KML::Placemark.new(
|
169
177
|
:name => options[:name],
|
170
178
|
:style_url => options[:style_url],
|
@@ -177,6 +185,13 @@ module Jeti; module Log;
|
|
177
185
|
)
|
178
186
|
end
|
179
187
|
|
188
|
+
def value_dataset(device, sensor, modifier = ->(val) { val })
|
189
|
+
headers, entries = headers_and_entries_for_device(device)
|
190
|
+
sensor_id = (headers.select { |h| sensor =~ h.name })[0].sensor_id
|
191
|
+
entries.reject! { |e| e.detail(sensor_id).nil? }
|
192
|
+
entries.map { |e| [e.time, modifier.call(e.value(sensor_id))] }
|
193
|
+
end
|
194
|
+
|
180
195
|
private
|
181
196
|
|
182
197
|
def apply_default_file_options options
|
@@ -195,60 +210,19 @@ module Jeti; module Log;
|
|
195
210
|
options
|
196
211
|
end
|
197
212
|
|
198
|
-
def
|
199
|
-
|
200
|
-
ibatts = build_value_dataset(/Mezon/i, /I Battery/)
|
201
|
-
vbecs = build_value_dataset(/Mezon/i, /U BEC/, ->(val) { val / 10.0 })
|
202
|
-
ibecs = build_value_dataset(/Mezon/i, /I BEC/)
|
203
|
-
mahs = build_value_dataset(/Mezon/i, /Capacity/)
|
204
|
-
rpms = build_value_dataset(/Mezon/i, /Revolution/)
|
205
|
-
temps = build_value_dataset(/Mezon/i, /Temp/)
|
206
|
-
times = build_value_dataset(/Mezon/i, /Run Time/)
|
207
|
-
pwms = build_value_dataset(/Mezon/i, /PWM/)
|
208
|
-
|
209
|
-
vbatts.map do |raw_vb|
|
210
|
-
time = raw_vb[0]
|
211
|
-
vbatt = raw_vb[1]
|
212
|
-
ibatt = ibatts.min_by { |e| (e[0] - time).abs }[1]
|
213
|
-
vbec = vbecs.min_by { |e| (e[0] - time).abs }[1]
|
214
|
-
ibec = ibecs.min_by { |e| (e[0] - time).abs }[1]
|
215
|
-
mah = mahs.min_by { |e| (e[0] - time).abs }[1]
|
216
|
-
rpm = rpms.min_by { |e| (e[0] - time).abs }[1]
|
217
|
-
temp = temps.min_by { |e| (e[0] - time).abs }[1]
|
218
|
-
runtime = times.min_by { |e| (e[0] - time).abs }[1]
|
219
|
-
pwm = pwms.min_by { |e| (e[0] - time).abs }[1]
|
220
|
-
MezonData.new(time, vbatt, ibatt, vbec, ibec, mah, rpm, temp, runtime, pwm)
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
def build_mgps_locations
|
225
|
-
lats = build_value_dataset(/MGPS/, /Latitude/)
|
226
|
-
lons = build_value_dataset(/MGPS/, /Longitude/)
|
227
|
-
alts = build_value_dataset(/MGPS/, /Altitude/)
|
228
|
-
crss = build_value_dataset(/MGPS/, /Course/)
|
229
|
-
|
230
|
-
lats.map do |raw_lat|
|
231
|
-
time = raw_lat[0]
|
232
|
-
lat = raw_lat[1]
|
233
|
-
lon = lons.min_by { |lon| (lon[0] - time).abs }[1]
|
234
|
-
alt = alts.min_by { |alt| (alt[0] - time).abs }[1]
|
235
|
-
crs = crss.min_by { |crs| (crs[0] - time).abs }[1]
|
236
|
-
Coordinate.new(time, lat, lon, alt, crs)
|
237
|
-
end
|
213
|
+
def build_rx_voltages
|
214
|
+
value_dataset(/Rx/, /U Rx/, ->(val) { val / 100.0 })
|
238
215
|
end
|
239
216
|
|
240
|
-
def
|
241
|
-
|
217
|
+
def build_tx_data
|
218
|
+
[]
|
242
219
|
end
|
243
220
|
|
244
|
-
def
|
245
|
-
headers
|
246
|
-
sensor_id = (headers.select { |h| sensor =~ h.name })[0].sensor_id
|
247
|
-
entries.reject! { |e| e.detail(sensor_id).nil? }
|
248
|
-
entries.map { |e| [e.time, modifier.call(e.value(sensor_id))] }
|
221
|
+
def device_present?(device)
|
222
|
+
@headers.any? { |h| device =~ h.name }
|
249
223
|
end
|
250
224
|
|
251
|
-
def
|
225
|
+
def headers_and_entries_for_device(device)
|
252
226
|
headers = @headers.select { |h| device =~ h.name }
|
253
227
|
return [[],[]] if headers.empty?
|
254
228
|
|
@@ -258,10 +232,6 @@ module Jeti; module Log;
|
|
258
232
|
[headers, entries]
|
259
233
|
end
|
260
234
|
|
261
|
-
def device_present?(device)
|
262
|
-
@headers.any? { |h| device =~ h.name }
|
263
|
-
end
|
264
|
-
|
265
235
|
end
|
266
236
|
|
267
237
|
end; end
|
data/lib/jeti/log/mezon_data.rb
CHANGED
@@ -12,17 +12,11 @@ module Jeti; module Log;
|
|
12
12
|
attr_reader :run_time
|
13
13
|
attr_reader :pwm
|
14
14
|
|
15
|
-
def initialize(time,
|
15
|
+
def initialize(time, fields)
|
16
|
+
raise ArgumentError unless fields.length == 9
|
16
17
|
@time = time
|
17
|
-
@battery_voltage
|
18
|
-
|
19
|
-
@bec_voltage = vbec
|
20
|
-
@bec_current = ibec
|
21
|
-
@capacity = mah
|
22
|
-
@rpm = rpm
|
23
|
-
@temperature = temp
|
24
|
-
@run_time = runtime
|
25
|
-
@pwm = pwm
|
18
|
+
@battery_voltage, @battery_current, @bec_voltage, @bec_current, @capacity,
|
19
|
+
@rpm, @temperature, @run_time, @pwm = fields
|
26
20
|
end
|
27
21
|
|
28
22
|
def temperature(unit = :c)
|
@@ -36,4 +30,15 @@ module Jeti; module Log;
|
|
36
30
|
|
37
31
|
end
|
38
32
|
|
33
|
+
class MezonDataBuilder
|
34
|
+
|
35
|
+
def self.build(file)
|
36
|
+
div10 = ->(val) { val / 10.0 }
|
37
|
+
CompositeDatasetBuilder.build(file, MezonData, /Mezon/i, [/U Battery/, div10],
|
38
|
+
/I Battery/, [/U BEC/, div10], /I BEC/, /Capacity/,
|
39
|
+
/Revolution/, /Temp/, /Run Time/, /PWM/)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
39
44
|
end; end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Jeti; module Log;
|
2
|
+
|
3
|
+
class MGPSData
|
4
|
+
|
5
|
+
attr_reader :time
|
6
|
+
attr_reader :latitude
|
7
|
+
attr_reader :longitude
|
8
|
+
attr_reader :course
|
9
|
+
|
10
|
+
def initialize(time, fields)
|
11
|
+
raise ArgumentError unless fields.length == 4
|
12
|
+
@time = time
|
13
|
+
@latitude, @longitude, @altitude, @course = fields
|
14
|
+
end
|
15
|
+
|
16
|
+
# Gets the altitude, in desired unit.
|
17
|
+
#
|
18
|
+
# @param unit one of :feet, :meters to define desired unit
|
19
|
+
# @return [Float] altitude in the desired unit
|
20
|
+
def altitude(unit = :feet)
|
21
|
+
case unit
|
22
|
+
when :feet
|
23
|
+
@altitude * 0.32808399
|
24
|
+
else
|
25
|
+
@altitude
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
class MGPSDataBuilder
|
32
|
+
|
33
|
+
def self.build(file)
|
34
|
+
CompositeDatasetBuilder.build(file, MGPSData, /MGPS/, /Latitude/,
|
35
|
+
/Longitude/, /Altitude/, /Course/)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end; end
|
data/lib/jeti/log/version.rb
CHANGED
@@ -0,0 +1,99 @@
|
|
1
|
+
# Blade 130X
|
2
|
+
000000000;4291420554;0;Tx;
|
3
|
+
000000000;4291420554;1;Control P4;
|
4
|
+
000000000;4291420554;2;Control P3;
|
5
|
+
000000000;4291420554;3;Control P2;
|
6
|
+
000000000;4291420554;4;Control P1;
|
7
|
+
000000000;4272121973;0;Rx;
|
8
|
+
000000000;4272121973;1;U Rx;V
|
9
|
+
000000000;4272121973;2;A1;
|
10
|
+
000000000;4272121973;3;A2;
|
11
|
+
000000000;4272121973;4;Q;%
|
12
|
+
000050898;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
13
|
+
000051118;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
14
|
+
000051338;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
15
|
+
000051558;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
16
|
+
000051778;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
17
|
+
000052005;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
18
|
+
000052235;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
19
|
+
000052438;4291420554;1;1;0;3;2;1;0;50;3;1;0;50;4;1;0;50;
|
20
|
+
000052658;4291420554;1;1;0;7;2;1;0;50;3;1;0;50;4;1;0;50;
|
21
|
+
000052878;4291420554;1;1;0;14;2;1;0;50;3;1;0;50;4;1;0;50;
|
22
|
+
000053098;4291420554;1;1;0;21;2;1;0;50;3;1;0;50;4;1;0;50;
|
23
|
+
000053318;4291420554;1;1;0;29;2;1;0;50;3;1;0;50;4;1;0;50;
|
24
|
+
000053565;4291420554;1;1;0;38;2;1;0;50;3;1;0;50;4;1;0;50;
|
25
|
+
000053765;4291420554;1;1;0;46;2;1;0;50;3;1;0;50;4;1;0;50;
|
26
|
+
000053978;4291420554;1;1;0;54;2;1;0;50;3;1;0;50;4;1;0;50;
|
27
|
+
000054198;4291420554;1;1;0;62;2;1;0;50;3;1;0;50;4;1;0;50;
|
28
|
+
000054418;4291420554;1;1;0;70;2;1;0;50;3;1;0;50;4;1;0;50;
|
29
|
+
000054638;4291420554;1;1;0;75;2;1;0;50;3;1;0;50;4;1;0;50;
|
30
|
+
000054874;4291420554;1;1;0;81;2;1;0;50;3;1;0;50;4;1;0;50;
|
31
|
+
000055078;4291420554;1;1;0;88;2;1;0;50;3;1;0;50;4;1;0;50;
|
32
|
+
000055298;4291420554;1;1;0;94;2;1;0;50;3;1;0;50;4;1;0;50;
|
33
|
+
000055518;4291420554;1;1;0;99;2;1;0;50;3;1;0;50;4;1;0;50;
|
34
|
+
000055748;4291420554;1;1;0;99;2;1;0;50;3;1;0;50;4;1;0;50;
|
35
|
+
000055965;4291420554;1;1;0;78;2;1;0;50;3;1;0;50;4;1;0;50;
|
36
|
+
000056194;4291420554;1;1;0;57;2;1;0;27;3;1;0;50;4;1;0;50;
|
37
|
+
000056398;4291420554;1;1;0;50;2;1;0;7;3;1;0;50;4;1;0;50;
|
38
|
+
000056618;4291420554;1;1;0;46;2;1;0;93;3;1;0;50;4;1;0;50;
|
39
|
+
000056838;4291420554;1;1;0;54;2;1;0;50;3;1;0;50;4;1;0;50;
|
40
|
+
000057058;4291420554;1;1;0;49;2;1;0;2;3;1;0;50;4;1;0;50;
|
41
|
+
000057280;4291420554;1;1;0;49;2;1;0;90;3;1;0;50;4;1;0;50;
|
42
|
+
000057498;4291420554;1;1;0;50;2;1;0;38;3;1;0;50;4;1;0;50;
|
43
|
+
000057718;4291420554;1;1;0;52;2;1;0;2;3;1;0;50;4;1;0;50;
|
44
|
+
000057938;4291420554;1;1;0;58;2;1;0;81;3;1;0;50;4;1;0;50;
|
45
|
+
000058158;4291420554;1;1;0;54;2;1;0;89;3;1;0;50;4;1;0;50;
|
46
|
+
000058378;4291420554;1;1;0;51;2;1;0;39;3;1;0;50;4;1;0;50;
|
47
|
+
000058598;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;50;
|
48
|
+
000058845;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;50;
|
49
|
+
000059038;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;50;
|
50
|
+
000059258;4291420554;1;1;0;50;2;1;0;50;3;1;0;84;4;1;0;50;
|
51
|
+
000059478;4291420554;1;1;0;50;2;1;0;50;3;1;0;37;4;1;0;50;
|
52
|
+
000059698;4291420554;1;1;0;50;2;1;0;50;3;1;0;12;4;1;0;50;
|
53
|
+
000059918;4291420554;1;1;0;50;2;1;0;50;3;1;0;86;4;1;0;50;
|
54
|
+
000060154;4291420554;1;1;0;50;2;1;0;50;3;1;0;49;4;1;0;50;
|
55
|
+
000060358;4291420554;1;1;0;50;2;1;0;50;3;1;0;17;4;1;0;50;
|
56
|
+
000060578;4291420554;1;1;0;50;2;1;0;50;3;1;0;70;4;1;0;50;
|
57
|
+
000060798;4291420554;1;1;0;50;2;1;0;50;3;1;0;83;4;1;0;50;
|
58
|
+
000061018;4291420554;1;1;0;50;2;1;0;50;3;1;0;29;4;1;0;50;
|
59
|
+
000061245;4291420554;1;1;0;50;2;1;0;50;3;1;0;20;4;1;0;50;
|
60
|
+
000061474;4291420554;1;1;0;50;2;1;0;50;3;1;0;69;4;1;0;50;
|
61
|
+
000061678;4291420554;1;1;0;50;2;1;0;50;3;1;0;80;4;1;0;50;
|
62
|
+
000061898;4291420554;1;1;0;50;2;1;0;50;3;1;0;20;4;1;0;50;
|
63
|
+
000062118;4291420554;1;1;0;50;2;1;0;50;3;1;0;13;4;1;0;50;
|
64
|
+
000062338;4291420554;1;1;0;50;2;1;0;50;3;1;0;75;4;1;0;50;
|
65
|
+
000062558;4291420554;1;1;0;50;2;1;0;50;3;1;0;77;4;1;0;50;
|
66
|
+
000062805;4291420554;1;1;0;50;2;1;0;50;3;1;0;38;4;1;0;50;
|
67
|
+
000062998;4291420554;1;1;0;50;2;1;0;50;3;1;0;47;4;1;0;41;
|
68
|
+
000063218;4291420554;1;1;0;50;2;1;0;50;3;1;0;43;4;1;0;3;
|
69
|
+
000063438;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;70;
|
70
|
+
000063658;4291420554;1;1;0;50;2;1;0;50;3;1;0;47;4;1;0;60;
|
71
|
+
000063878;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;11;
|
72
|
+
000064125;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;79;
|
73
|
+
000064318;4291420554;1;1;0;50;2;1;0;50;3;1;0;45;4;1;0;65;
|
74
|
+
000064538;4291420554;1;1;0;50;2;1;0;50;3;1;0;44;4;1;0;1;
|
75
|
+
000064758;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;76;
|
76
|
+
000064978;4291420554;1;1;0;50;2;1;0;50;3;1;0;44;4;1;0;76;
|
77
|
+
000065201;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;9;
|
78
|
+
000065434;4291420554;1;1;0;50;2;1;0;50;3;1;0;51;4;1;0;65;
|
79
|
+
000065638;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;86;
|
80
|
+
000065858;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;9;
|
81
|
+
000066078;4291420554;1;1;0;50;2;1;0;50;3;1;0;53;4;1;0;50;
|
82
|
+
000066298;4291420554;1;1;0;50;2;1;0;50;3;1;0;49;4;1;0;59;
|
83
|
+
000066525;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;50;
|
84
|
+
000066754;4291420554;1;1;0;50;2;1;0;50;3;1;0;50;4;1;0;50;
|
85
|
+
000066958;4291420554;1;1;0;39;2;1;0;50;3;1;0;50;4;1;0;50;
|
86
|
+
000067178;4291420554;1;1;0;34;2;1;0;50;3;1;0;50;4;1;0;50;
|
87
|
+
000067398;4291420554;1;1;0;34;2;1;0;50;3;1;0;50;4;1;0;50;
|
88
|
+
000067618;4291420554;1;1;0;34;2;1;0;50;3;1;0;50;4;1;0;50;
|
89
|
+
000067838;4291420554;1;1;0;34;2;1;0;50;3;1;0;50;4;1;0;50;
|
90
|
+
000068058;4291420554;1;1;0;34;2;1;0;50;3;1;0;50;4;1;0;50;
|
91
|
+
000068278;4291420554;1;1;0;34;2;1;0;50;3;1;0;50;4;1;0;50;
|
92
|
+
000068498;4291420554;1;1;0;34;2;1;0;50;3;1;0;50;4;1;0;50;
|
93
|
+
000068718;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
94
|
+
000068938;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
95
|
+
000069158;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
96
|
+
000069400;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
97
|
+
000069598;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
98
|
+
000069818;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
99
|
+
000070038;4291420554;1;1;0;1;2;1;0;50;3;1;0;50;4;1;0;50;
|
data/spec/file_spec.rb
CHANGED
@@ -50,7 +50,7 @@ describe Jeti::Log::File do
|
|
50
50
|
expect(subject.signal_qualities[90]).to eql([1120425, 100])
|
51
51
|
end
|
52
52
|
|
53
|
-
its(:
|
53
|
+
its(:mgps_data?) { should be_false }
|
54
54
|
|
55
55
|
its(:to_kml?) { should be_false }
|
56
56
|
|
@@ -110,26 +110,26 @@ describe Jeti::Log::File do
|
|
110
110
|
expect(subject.signal_qualities[90]).to eql([265538, 100])
|
111
111
|
end
|
112
112
|
|
113
|
-
its(:
|
113
|
+
its(:mgps_data?) { should be_true }
|
114
114
|
|
115
|
-
it { should have(539).
|
115
|
+
it { should have(539).mgps_data }
|
116
116
|
|
117
117
|
it 'should have some select gps locations' do
|
118
|
-
loc = subject.
|
118
|
+
loc = subject.mgps_data[0]
|
119
119
|
expect(loc.time).to eql(219552)
|
120
120
|
expect(loc.latitude).to be_within(0.0001).of(41.1856)
|
121
121
|
expect(loc.longitude).to be_within(0.0001).of(-96.0103)
|
122
122
|
expect(loc.altitude(:meters)).to eql(309)
|
123
123
|
expect(loc.course).to eql(0)
|
124
124
|
|
125
|
-
loc = subject.
|
125
|
+
loc = subject.mgps_data[250]
|
126
126
|
expect(loc.time).to eql(347038)
|
127
127
|
expect(loc.latitude).to be_within(0.0001).of(41.1868)
|
128
128
|
expect(loc.longitude).to be_within(0.0001).of(-96.0094)
|
129
129
|
expect(loc.altitude(:meters)).to eql(352)
|
130
130
|
expect(loc.course).to eql(294)
|
131
131
|
|
132
|
-
loc = subject.
|
132
|
+
loc = subject.mgps_data[450]
|
133
133
|
expect(loc.time).to eql(456409)
|
134
134
|
expect(loc.latitude).to be_within(0.0001).of(41.1871)
|
135
135
|
expect(loc.longitude).to be_within(0.0001).of(-96.0091)
|
@@ -171,7 +171,7 @@ describe Jeti::Log::File do
|
|
171
171
|
|
172
172
|
its(:signal_qualities?) { should be_true }
|
173
173
|
|
174
|
-
its(:
|
174
|
+
its(:mgps_data?) { should be_false }
|
175
175
|
|
176
176
|
its(:mezon_data?) { should be_true }
|
177
177
|
|
@@ -221,7 +221,7 @@ describe Jeti::Log::File do
|
|
221
221
|
|
222
222
|
its(:signal_qualities?) { should be_true }
|
223
223
|
|
224
|
-
its(:
|
224
|
+
its(:mgps_data?) { should be_false }
|
225
225
|
|
226
226
|
its(:mezon_data?) { should be_true }
|
227
227
|
|
@@ -277,7 +277,7 @@ describe Jeti::Log::File do
|
|
277
277
|
|
278
278
|
its(:signal_qualities?) { should be_true }
|
279
279
|
|
280
|
-
its(:
|
280
|
+
its(:mgps_data?) { should be_false }
|
281
281
|
|
282
282
|
its(:mezon_data?) { should be_true }
|
283
283
|
|
@@ -358,6 +358,16 @@ describe Jeti::Log::File do
|
|
358
358
|
|
359
359
|
end
|
360
360
|
|
361
|
+
context 'with data file tx-controls.log' do
|
362
|
+
|
363
|
+
before(:all) { @file = Jeti::Log::File.new(data_file('tx-controls.log')) }
|
364
|
+
|
365
|
+
subject { @file }
|
366
|
+
|
367
|
+
its(:duration) { should be_within(1).of(19) }
|
368
|
+
|
369
|
+
end
|
370
|
+
|
361
371
|
it 'should raise for invalid or missing files' do
|
362
372
|
files = invalid_data_files
|
363
373
|
files.should have(9).files
|
data/spec/mezon_data_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jeti-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Veys
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -152,14 +152,15 @@ files:
|
|
152
152
|
- Rakefile
|
153
153
|
- jeti-log.gemspec
|
154
154
|
- lib/jeti/log.rb
|
155
|
-
- lib/jeti/log/
|
155
|
+
- lib/jeti/log/composite_dataset_builder.rb
|
156
156
|
- lib/jeti/log/entry.rb
|
157
157
|
- lib/jeti/log/file.rb
|
158
158
|
- lib/jeti/log/header.rb
|
159
159
|
- lib/jeti/log/mezon_data.rb
|
160
|
+
- lib/jeti/log/mgps_data.rb
|
160
161
|
- lib/jeti/log/mui_data.rb
|
162
|
+
- lib/jeti/log/tx_data.rb
|
161
163
|
- lib/jeti/log/version.rb
|
162
|
-
- spec/coordinate_spec.rb
|
163
164
|
- spec/data/1min-tx-rx.log
|
164
165
|
- spec/data/gps-crash.log
|
165
166
|
- spec/data/invalid/castle/long-flight.csv
|
@@ -172,10 +173,13 @@ files:
|
|
172
173
|
- spec/data/mezon-1.log
|
173
174
|
- spec/data/mezon-2.log
|
174
175
|
- spec/data/mezon-3.log
|
176
|
+
- spec/data/tx-controls.log
|
175
177
|
- spec/file_spec.rb
|
176
178
|
- spec/mezon_data_spec.rb
|
179
|
+
- spec/mgps_data_spec.rb
|
177
180
|
- spec/mui_data_spec.rb
|
178
181
|
- spec/spec_helper.rb
|
182
|
+
- spec/tx_data_spec.rb
|
179
183
|
homepage: ''
|
180
184
|
licenses:
|
181
185
|
- MIT
|
@@ -196,12 +200,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
200
|
version: '0'
|
197
201
|
requirements: []
|
198
202
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.0.
|
203
|
+
rubygems_version: 2.0.6
|
200
204
|
signing_key:
|
201
205
|
specification_version: 4
|
202
206
|
summary: Jeti telemetry log file reader
|
203
207
|
test_files:
|
204
|
-
- spec/coordinate_spec.rb
|
205
208
|
- spec/data/1min-tx-rx.log
|
206
209
|
- spec/data/gps-crash.log
|
207
210
|
- spec/data/invalid/castle/long-flight.csv
|
@@ -214,7 +217,10 @@ test_files:
|
|
214
217
|
- spec/data/mezon-1.log
|
215
218
|
- spec/data/mezon-2.log
|
216
219
|
- spec/data/mezon-3.log
|
220
|
+
- spec/data/tx-controls.log
|
217
221
|
- spec/file_spec.rb
|
218
222
|
- spec/mezon_data_spec.rb
|
223
|
+
- spec/mgps_data_spec.rb
|
219
224
|
- spec/mui_data_spec.rb
|
220
225
|
- spec/spec_helper.rb
|
226
|
+
- spec/tx_data_spec.rb
|
data/lib/jeti/log/coordinate.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
module Jeti; module Log;
|
2
|
-
|
3
|
-
class Coordinate
|
4
|
-
|
5
|
-
attr_reader :time, :latitude, :longitude, :course
|
6
|
-
|
7
|
-
def initialize(time, latitude, longitude, altitude, course)
|
8
|
-
@time = time
|
9
|
-
@latitude = latitude
|
10
|
-
@longitude = longitude
|
11
|
-
@altitude = altitude
|
12
|
-
@course = course
|
13
|
-
end
|
14
|
-
|
15
|
-
# Gets the altitude, in desired unit.
|
16
|
-
#
|
17
|
-
# @param unit one of :feet, :meters to define desired unit
|
18
|
-
# @return [Float] altitude in the desired unit
|
19
|
-
def altitude(unit = :feet)
|
20
|
-
case unit
|
21
|
-
when :feet
|
22
|
-
@altitude * 0.32808399
|
23
|
-
else
|
24
|
-
@altitude
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
end; end
|