spektrum-log 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/data/X5-GPS2.TLM +0 -0
- data/lib/spektrum/log/flight.rb +34 -1
- data/lib/spektrum/log/reader.rb +3 -3
- data/lib/spektrum/log/records.rb +26 -23
- data/lib/spektrum/log/version.rb +1 -1
- data/spec/basic_data_record_spec.rb +5 -5
- data/spec/flight_log_record_spec.rb +3 -3
- data/spec/flight_spec.rb +141 -9
- data/spec/gps_record1_spec.rb +7 -7
- data/spec/gps_record2_spec.rb +2 -2
- data/spec/reader_spec.rb +26 -6
- metadata +42 -15
- checksums.yaml +0 -7
data/data/X5-GPS2.TLM
ADDED
Binary file
|
data/lib/spektrum/log/flight.rb
CHANGED
@@ -22,7 +22,7 @@ module Spektrum
|
|
22
22
|
#
|
23
23
|
# @return [Float] duration of the flight, in seconds
|
24
24
|
def duration
|
25
|
-
@duration ||=
|
25
|
+
@duration ||= timestamp_delta / time_divisor
|
26
26
|
end
|
27
27
|
|
28
28
|
# Determines if this flight has any data. Models without telemetry
|
@@ -75,6 +75,32 @@ module Spektrum
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
# Gets the type of telemetry unit that sent the data.
|
79
|
+
#
|
80
|
+
# @return [String] telemetry unit
|
81
|
+
def telemetry_unit
|
82
|
+
@telemetry_unit ||= derive_telemetry_unit
|
83
|
+
end
|
84
|
+
|
85
|
+
def time_divisor
|
86
|
+
@time_divisor ||= case telemetry_unit
|
87
|
+
when 'TM1000'
|
88
|
+
256.0
|
89
|
+
when 'TM1100'
|
90
|
+
1024.0
|
91
|
+
else
|
92
|
+
1.0
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Gets the difference between the last and the first timestamps. May
|
97
|
+
# be zero if no records exist.
|
98
|
+
#
|
99
|
+
# @return [Number] difference between the last and first timestamp
|
100
|
+
def timestamp_delta
|
101
|
+
@timestamp_delta ||= @records.empty? ? 0.0 : (@records.last.timestamp - @records.first.timestamp)
|
102
|
+
end
|
103
|
+
|
78
104
|
def altimeter_records?
|
79
105
|
any_records? AltimeterRecord
|
80
106
|
end
|
@@ -178,6 +204,13 @@ module Spektrum
|
|
178
204
|
@records.any? { |rec| rec.is_a?(type) && rec.valid? }
|
179
205
|
end
|
180
206
|
|
207
|
+
def derive_telemetry_unit
|
208
|
+
return "None" unless basic_data_records? && flight_log_records?
|
209
|
+
key = [basic_data_records.first.type, flight_log_records.first.type]
|
210
|
+
types = { [0x7E, 0x7F] => 'TM1000', [0xFE, 0xFF] => 'TM1100' }
|
211
|
+
types.fetch(key, 'Unknown')
|
212
|
+
end
|
213
|
+
|
181
214
|
def select_records(type)
|
182
215
|
@records.select { |rec| rec.is_a?(type) && rec.valid? }
|
183
216
|
end
|
data/lib/spektrum/log/reader.rb
CHANGED
@@ -41,9 +41,9 @@ module Spektrum
|
|
41
41
|
|
42
42
|
headers_complete = rest.unpack('S')[0] == 0x1717
|
43
43
|
else
|
44
|
-
|
45
|
-
|
46
|
-
records << Records.create(type, first,
|
44
|
+
data = file.read(16)
|
45
|
+
type = data[0].unpack('C')[0]
|
46
|
+
records << Records.create(type, first, data)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
data/lib/spektrum/log/records.rb
CHANGED
@@ -7,13 +7,17 @@ module Spektrum
|
|
7
7
|
attr_reader :timestamp
|
8
8
|
|
9
9
|
def initialize timestamp, raw_data
|
10
|
-
if raw_data.length !=
|
10
|
+
if raw_data.length != 16
|
11
11
|
raise ArgumentError, "raw_data incorrectly sized (#{raw_data.length})"
|
12
12
|
end
|
13
13
|
@timestamp = timestamp
|
14
14
|
@raw_data = raw_data
|
15
15
|
end
|
16
16
|
|
17
|
+
def type
|
18
|
+
@type ||= byte_field(0)
|
19
|
+
end
|
20
|
+
|
17
21
|
# Determines if this record should be considered valid. Definitions of valid
|
18
22
|
# will vary by the type of record.
|
19
23
|
#
|
@@ -49,7 +53,7 @@ module Spektrum
|
|
49
53
|
end
|
50
54
|
|
51
55
|
def altitude
|
52
|
-
@altitude ||= two_byte_field(
|
56
|
+
@altitude ||= two_byte_field(2..3)
|
53
57
|
end
|
54
58
|
|
55
59
|
end
|
@@ -77,7 +81,7 @@ module Spektrum
|
|
77
81
|
end
|
78
82
|
|
79
83
|
def temperature unit = :f
|
80
|
-
@temperature ||= two_byte_field(
|
84
|
+
@temperature ||= two_byte_field(6..7)
|
81
85
|
case unit
|
82
86
|
when :f
|
83
87
|
@temperature
|
@@ -95,11 +99,11 @@ module Spektrum
|
|
95
99
|
private
|
96
100
|
|
97
101
|
def raw_rpm
|
98
|
-
@raw_rpm ||= two_byte_field(
|
102
|
+
@raw_rpm ||= two_byte_field(2..3)
|
99
103
|
end
|
100
104
|
|
101
105
|
def raw_voltage
|
102
|
-
@raw_voltage ||= two_byte_field(
|
106
|
+
@raw_voltage ||= two_byte_field(4..5)
|
103
107
|
end
|
104
108
|
|
105
109
|
end
|
@@ -127,7 +131,7 @@ module Spektrum
|
|
127
131
|
private
|
128
132
|
|
129
133
|
def raw_rx_voltage
|
130
|
-
@raw_rx_voltage ||= two_byte_field(
|
134
|
+
@raw_rx_voltage ||= two_byte_field(14..15)
|
131
135
|
end
|
132
136
|
|
133
137
|
end
|
@@ -139,27 +143,27 @@ module Spektrum
|
|
139
143
|
end
|
140
144
|
|
141
145
|
def x
|
142
|
-
@x ||= two_byte_field(
|
146
|
+
@x ||= two_byte_field(2..3)
|
143
147
|
end
|
144
148
|
|
145
149
|
def y
|
146
|
-
@y ||= two_byte_field(
|
150
|
+
@y ||= two_byte_field(4..5)
|
147
151
|
end
|
148
152
|
|
149
153
|
def z
|
150
|
-
@z ||= two_byte_field(
|
154
|
+
@z ||= two_byte_field(6..7)
|
151
155
|
end
|
152
156
|
|
153
157
|
def x_max
|
154
|
-
@x_max ||= two_byte_field(
|
158
|
+
@x_max ||= two_byte_field(8..9)
|
155
159
|
end
|
156
160
|
|
157
161
|
def y_max
|
158
|
-
@y_max ||= two_byte_field(
|
162
|
+
@y_max ||= two_byte_field(10..11)
|
159
163
|
end
|
160
164
|
|
161
165
|
def z_max
|
162
|
-
@z_max ||= two_byte_field(
|
166
|
+
@z_max ||= two_byte_field(12..13)
|
163
167
|
end
|
164
168
|
|
165
169
|
end
|
@@ -172,7 +176,7 @@ module Spektrum
|
|
172
176
|
|
173
177
|
# :feet, :meters
|
174
178
|
def altitude unit = :feet
|
175
|
-
@altitude ||= (hex_byte_field(
|
179
|
+
@altitude ||= (hex_byte_field(3) * 100) + hex_byte_field(2)
|
176
180
|
case unit
|
177
181
|
when :feet
|
178
182
|
@altitude * 0.32808399
|
@@ -185,22 +189,22 @@ module Spektrum
|
|
185
189
|
|
186
190
|
# + N, - S
|
187
191
|
def latitude
|
188
|
-
elements =
|
192
|
+
elements = 7.downto(4).map { |i| hex_byte_field(i) }
|
189
193
|
@latitude ||= convert_latlon([0, elements].flatten)
|
190
194
|
end
|
191
195
|
|
192
196
|
# + E, - W
|
193
197
|
def longitude
|
194
|
-
elements =
|
198
|
+
elements = 11.downto(8).map { |i| hex_byte_field(i) }
|
195
199
|
|
196
200
|
# 100+ longitude indicator guesses (X marks proven invalid guess):
|
197
201
|
# X upper nybble of 13th byte
|
198
202
|
# - 2nd bit of 14th byte
|
199
|
-
hundreds = ((byte_field(
|
203
|
+
hundreds = ((byte_field(15) & 0x04) == 0x04) ? 1 : 0
|
200
204
|
|
201
205
|
# +/- longitude indicator guesses (X marks proven invalid guess):
|
202
206
|
# - 1st bit of 14th byte (1 - pos, 0 - neg)
|
203
|
-
multiplier = ((byte_field(
|
207
|
+
multiplier = ((byte_field(15) & 0x02) == 0x02) ? 1 : -1
|
204
208
|
|
205
209
|
elements = [hundreds, elements].flatten
|
206
210
|
@longitude ||= multiplier * convert_latlon(elements)
|
@@ -211,7 +215,7 @@ module Spektrum
|
|
211
215
|
end
|
212
216
|
|
213
217
|
def heading
|
214
|
-
@heading ||= (hex_byte_field(
|
218
|
+
@heading ||= (hex_byte_field(13) * 10) + (hex_byte_field(12) / 10.0)
|
215
219
|
end
|
216
220
|
|
217
221
|
def valid?
|
@@ -235,7 +239,7 @@ module Spektrum
|
|
235
239
|
|
236
240
|
# :knots, :mph, :kph
|
237
241
|
def speed unit = :knots
|
238
|
-
@speed ||= (hex_byte_field(
|
242
|
+
@speed ||= (hex_byte_field(3) * 100) + hex_byte_field(2)
|
239
243
|
case unit
|
240
244
|
when :knots
|
241
245
|
@speed / 10.0
|
@@ -249,12 +253,12 @@ module Spektrum
|
|
249
253
|
end
|
250
254
|
|
251
255
|
def time
|
252
|
-
elements =
|
256
|
+
elements = 7.downto(4).map { |i| hex_byte_field(i) }
|
253
257
|
@time ||= "%.2i:%.2i:%.2i.%.2i" % elements
|
254
258
|
end
|
255
259
|
|
256
260
|
def satellites
|
257
|
-
@satellites ||= hex_byte_field(
|
261
|
+
@satellites ||= hex_byte_field(8)
|
258
262
|
end
|
259
263
|
|
260
264
|
end
|
@@ -274,12 +278,11 @@ module Spektrum
|
|
274
278
|
end
|
275
279
|
|
276
280
|
def speed
|
277
|
-
@speed ||= two_byte_field(
|
281
|
+
@speed ||= two_byte_field(2..3)
|
278
282
|
end
|
279
283
|
|
280
284
|
end
|
281
285
|
|
282
|
-
|
283
286
|
class Records
|
284
287
|
|
285
288
|
@@types = {
|
data/lib/spektrum/log/version.rb
CHANGED
@@ -4,7 +4,7 @@ describe Spektrum::Log::BasicDataRecord do
|
|
4
4
|
|
5
5
|
let(:timestamp) { 0xC67C0100 }
|
6
6
|
|
7
|
-
let(:raw_data) { ["
|
7
|
+
let(:raw_data) { ["7E00FFFF13897FFF0000000000000000"].pack('H*') }
|
8
8
|
|
9
9
|
subject { Spektrum::Log::BasicDataRecord.new(timestamp, raw_data) }
|
10
10
|
|
@@ -12,7 +12,7 @@ describe Spektrum::Log::BasicDataRecord do
|
|
12
12
|
|
13
13
|
context 'with only rpm' do
|
14
14
|
|
15
|
-
let(:raw_data) { ["
|
15
|
+
let(:raw_data) { ["FE000123FFFF7FFF0000000000000000"].pack('H*') }
|
16
16
|
|
17
17
|
its(:rpm?) { should be_true }
|
18
18
|
|
@@ -28,7 +28,7 @@ describe Spektrum::Log::BasicDataRecord do
|
|
28
28
|
|
29
29
|
context 'with only temperature' do
|
30
30
|
|
31
|
-
let(:raw_data) { ["
|
31
|
+
let(:raw_data) { ["7E00FFFFFFFF00A10000000000000000"].pack('H*') }
|
32
32
|
|
33
33
|
its(:rpm?) { should be_false }
|
34
34
|
|
@@ -46,7 +46,7 @@ describe Spektrum::Log::BasicDataRecord do
|
|
46
46
|
|
47
47
|
context 'with only voltage' do
|
48
48
|
|
49
|
-
let(:raw_data) { ["
|
49
|
+
let(:raw_data) { ["FE00FFFF13897FFF0000000000000000"].pack('H*') }
|
50
50
|
|
51
51
|
its(:rpm?) { should be_false }
|
52
52
|
|
@@ -60,7 +60,7 @@ describe Spektrum::Log::BasicDataRecord do
|
|
60
60
|
|
61
61
|
context 'with everything' do
|
62
62
|
|
63
|
-
let(:raw_data) { ["
|
63
|
+
let(:raw_data) { ["7E0000A6138900A60000000000000000"].pack('H*') }
|
64
64
|
|
65
65
|
its(:rpm?) { should be_true }
|
66
66
|
|
@@ -4,7 +4,7 @@ describe Spektrum::Log::FlightLogRecord do
|
|
4
4
|
|
5
5
|
let(:timestamp) { 0xC67C0101 }
|
6
6
|
|
7
|
-
let(:raw_data) { ["
|
7
|
+
let(:raw_data) { ["7F00FFFF13897FFF0000000000000347"].pack('H*') }
|
8
8
|
|
9
9
|
subject { Spektrum::Log::FlightLogRecord.new(timestamp, raw_data) }
|
10
10
|
|
@@ -12,7 +12,7 @@ describe Spektrum::Log::FlightLogRecord do
|
|
12
12
|
|
13
13
|
context 'with voltage' do
|
14
14
|
|
15
|
-
let(:raw_data) { ["
|
15
|
+
let(:raw_data) { ["FF00FFFF13897FFF0000000000000347"].pack('H*') }
|
16
16
|
|
17
17
|
its(:rx_voltage?) { should be_true }
|
18
18
|
|
@@ -22,7 +22,7 @@ describe Spektrum::Log::FlightLogRecord do
|
|
22
22
|
|
23
23
|
context 'without voltage' do
|
24
24
|
|
25
|
-
let(:raw_data) { ["
|
25
|
+
let(:raw_data) { ["7F00FFFF13897FFF0000000000007FFF"].pack('H*') }
|
26
26
|
|
27
27
|
its(:rx_voltage?) { should be_false }
|
28
28
|
|
data/spec/flight_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe Spektrum::Log::Flight do
|
|
14
14
|
|
15
15
|
it { should have(191).records }
|
16
16
|
|
17
|
-
its(:duration) { should be_within(0.1).of(
|
17
|
+
its(:duration) { should be_within(0.1).of(4.5) }
|
18
18
|
|
19
19
|
its(:bind_type) { should eql('DSMX') }
|
20
20
|
|
@@ -24,6 +24,8 @@ describe Spektrum::Log::Flight do
|
|
24
24
|
|
25
25
|
its(:model_type) { should eql('Fixed Wing') }
|
26
26
|
|
27
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
28
|
+
|
27
29
|
its(:gps1_records?) { should be_false }
|
28
30
|
|
29
31
|
its(:gps2_records?) { should be_true }
|
@@ -38,7 +40,9 @@ describe Spektrum::Log::Flight do
|
|
38
40
|
|
39
41
|
it { should have(634).records }
|
40
42
|
|
41
|
-
its(:duration) { should be_within(0.1).of(
|
43
|
+
its(:duration) { should be_within(0.1).of(14.8) }
|
44
|
+
|
45
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
42
46
|
|
43
47
|
its(:gps1_records?) { should be_true }
|
44
48
|
|
@@ -54,7 +58,9 @@ describe Spektrum::Log::Flight do
|
|
54
58
|
|
55
59
|
it { should have(641).records }
|
56
60
|
|
57
|
-
its(:duration) { should be_within(0.1).of(
|
61
|
+
its(:duration) { should be_within(0.1).of(15.0) }
|
62
|
+
|
63
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
58
64
|
|
59
65
|
its(:gps1_records?) { should be_true }
|
60
66
|
|
@@ -88,6 +94,8 @@ describe Spektrum::Log::Flight do
|
|
88
94
|
|
89
95
|
its(:model_type) { should eql('Helicopter') }
|
90
96
|
|
97
|
+
its(:telemetry_unit) { should == 'TM1100' }
|
98
|
+
|
91
99
|
its(:to_kml?) { should be_false }
|
92
100
|
|
93
101
|
end
|
@@ -98,6 +106,8 @@ describe Spektrum::Log::Flight do
|
|
98
106
|
|
99
107
|
its(:model_name) { should eql('ERW|N XL ULTRALIGHT') }
|
100
108
|
|
109
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
110
|
+
|
101
111
|
its(:to_kml?) { should be_true }
|
102
112
|
|
103
113
|
end
|
@@ -148,6 +158,8 @@ describe Spektrum::Log::Flight do
|
|
148
158
|
|
149
159
|
its(:duration) { should eql(0.0) }
|
150
160
|
|
161
|
+
its(:telemetry_unit) { should == 'None' }
|
162
|
+
|
151
163
|
it { should be_empty }
|
152
164
|
|
153
165
|
end
|
@@ -162,6 +174,8 @@ describe Spektrum::Log::Flight do
|
|
162
174
|
|
163
175
|
its(:duration) { should eql(0.0) }
|
164
176
|
|
177
|
+
its(:telemetry_unit) { should == 'None' }
|
178
|
+
|
165
179
|
it { should be_empty }
|
166
180
|
|
167
181
|
end
|
@@ -176,6 +190,8 @@ describe Spektrum::Log::Flight do
|
|
176
190
|
|
177
191
|
its(:duration) { should eql(0.0) }
|
178
192
|
|
193
|
+
its(:telemetry_unit) { should == 'None' }
|
194
|
+
|
179
195
|
it { should be_empty }
|
180
196
|
|
181
197
|
end
|
@@ -190,6 +206,8 @@ describe Spektrum::Log::Flight do
|
|
190
206
|
|
191
207
|
its(:duration) { should eql(0.0) }
|
192
208
|
|
209
|
+
its(:telemetry_unit) { should == 'None' }
|
210
|
+
|
193
211
|
it { should be_empty }
|
194
212
|
|
195
213
|
end
|
@@ -204,6 +222,8 @@ describe Spektrum::Log::Flight do
|
|
204
222
|
|
205
223
|
its(:duration) { should eql(0.0) }
|
206
224
|
|
225
|
+
its(:telemetry_unit) { should == 'None' }
|
226
|
+
|
207
227
|
it { should be_empty }
|
208
228
|
|
209
229
|
end
|
@@ -218,6 +238,8 @@ describe Spektrum::Log::Flight do
|
|
218
238
|
|
219
239
|
its(:duration) { should eql(0.0) }
|
220
240
|
|
241
|
+
its(:telemetry_unit) { should == 'None' }
|
242
|
+
|
221
243
|
it { should be_empty }
|
222
244
|
|
223
245
|
end
|
@@ -232,6 +254,8 @@ describe Spektrum::Log::Flight do
|
|
232
254
|
|
233
255
|
its(:duration) { should eql(0.0) }
|
234
256
|
|
257
|
+
its(:telemetry_unit) { should == 'None' }
|
258
|
+
|
235
259
|
it { should be_empty }
|
236
260
|
|
237
261
|
end
|
@@ -246,6 +270,8 @@ describe Spektrum::Log::Flight do
|
|
246
270
|
|
247
271
|
its(:duration) { should eql(0.0) }
|
248
272
|
|
273
|
+
its(:telemetry_unit) { should == 'None' }
|
274
|
+
|
249
275
|
it { should be_empty }
|
250
276
|
|
251
277
|
end
|
@@ -258,7 +284,9 @@ describe Spektrum::Log::Flight do
|
|
258
284
|
|
259
285
|
it { should have(23155).records }
|
260
286
|
|
261
|
-
its(:duration) { should be_within(1).of(
|
287
|
+
its(:duration) { should be_within(0.1).of(144.8) }
|
288
|
+
|
289
|
+
its(:telemetry_unit) { should == 'TM1100' }
|
262
290
|
|
263
291
|
it { should_not be_empty }
|
264
292
|
|
@@ -280,7 +308,7 @@ describe Spektrum::Log::Flight do
|
|
280
308
|
|
281
309
|
it { should_not be_empty }
|
282
310
|
|
283
|
-
its(:duration) { should be_within(0.1).of(
|
311
|
+
its(:duration) { should be_within(0.1).of(15.9) }
|
284
312
|
|
285
313
|
its(:bind_type) { should eql('DSMX') }
|
286
314
|
|
@@ -290,6 +318,8 @@ describe Spektrum::Log::Flight do
|
|
290
318
|
|
291
319
|
its(:model_type) { should eql('Helicopter') }
|
292
320
|
|
321
|
+
its(:telemetry_unit) { should == 'TM1100' }
|
322
|
+
|
293
323
|
its(:altimeter_records?) { should be_false }
|
294
324
|
|
295
325
|
its(:basic_data_records?) { should be_true }
|
@@ -316,7 +346,9 @@ describe Spektrum::Log::Flight do
|
|
316
346
|
|
317
347
|
subject { reader.flights[0] }
|
318
348
|
|
319
|
-
its(:duration) { should be_within(1).of(
|
349
|
+
its(:duration) { should be_within(1).of(697) }
|
350
|
+
|
351
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
320
352
|
|
321
353
|
its(:gps1_records?) { should be_true }
|
322
354
|
|
@@ -334,7 +366,9 @@ describe Spektrum::Log::Flight do
|
|
334
366
|
|
335
367
|
subject { reader.flights[1] }
|
336
368
|
|
337
|
-
its(:duration) { should be_within(1).of(
|
369
|
+
its(:duration) { should be_within(1).of(733) }
|
370
|
+
|
371
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
338
372
|
|
339
373
|
its(:gps1_records?) { should be_true }
|
340
374
|
|
@@ -358,7 +392,9 @@ describe Spektrum::Log::Flight do
|
|
358
392
|
|
359
393
|
subject { reader.flights[0] }
|
360
394
|
|
361
|
-
its(:duration) { should be_within(1).of(
|
395
|
+
its(:duration) { should be_within(1).of(503) }
|
396
|
+
|
397
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
362
398
|
|
363
399
|
its(:gps1_records?) { should be_true }
|
364
400
|
|
@@ -376,7 +412,9 @@ describe Spektrum::Log::Flight do
|
|
376
412
|
|
377
413
|
subject { reader.flights[1] }
|
378
414
|
|
379
|
-
its(:duration) { should be_within(1).of(
|
415
|
+
its(:duration) { should be_within(1).of(347) }
|
416
|
+
|
417
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
380
418
|
|
381
419
|
it { should have(4792).gps1_records }
|
382
420
|
|
@@ -412,6 +450,100 @@ describe Spektrum::Log::Flight do
|
|
412
450
|
|
413
451
|
end
|
414
452
|
|
453
|
+
context 'flight 1' do
|
454
|
+
|
455
|
+
subject { reader.flights[0] }
|
456
|
+
|
457
|
+
its(:duration) { should be_within(0.1).of(318.6) }
|
458
|
+
|
459
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
460
|
+
|
461
|
+
end
|
462
|
+
|
463
|
+
context 'flight 2' do
|
464
|
+
|
465
|
+
subject { reader.flights[1] }
|
466
|
+
|
467
|
+
its(:duration) { should be_within(0.1).of(327.5) }
|
468
|
+
|
469
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
470
|
+
|
471
|
+
end
|
472
|
+
|
473
|
+
context 'flight 3' do
|
474
|
+
|
475
|
+
subject { reader.flights[2] }
|
476
|
+
|
477
|
+
its(:duration) { should be_within(0.1).of(326.5) }
|
478
|
+
|
479
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
480
|
+
|
481
|
+
end
|
482
|
+
|
483
|
+
context 'flight 4' do
|
484
|
+
|
485
|
+
subject { reader.flights[3] }
|
486
|
+
|
487
|
+
its(:duration) { should eql(0.0) }
|
488
|
+
|
489
|
+
its(:telemetry_unit) { should == 'None' }
|
490
|
+
|
491
|
+
end
|
492
|
+
|
493
|
+
context 'flight 5' do
|
494
|
+
|
495
|
+
subject { reader.flights[4] }
|
496
|
+
|
497
|
+
its(:duration) { should be_within(0.1).of(332.6) }
|
498
|
+
|
499
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
500
|
+
|
501
|
+
end
|
502
|
+
|
503
|
+
end
|
504
|
+
|
505
|
+
context 'data file X5-GPS2.TLM' do
|
506
|
+
|
507
|
+
let(:reader) { Spektrum::Log::Reader.new(data_file('X5-GPS2.TLM')) }
|
508
|
+
|
509
|
+
its 'flights should contain some gps coordinates' do
|
510
|
+
|
511
|
+
reader.flights.select { |f| f.gps1_records? }.should have(2).flights
|
512
|
+
|
513
|
+
end
|
514
|
+
|
515
|
+
its 'longitudes should all be negative' do
|
516
|
+
|
517
|
+
reader.flights.each do |flight|
|
518
|
+
|
519
|
+
flight.gps1_records.each do |gps1|
|
520
|
+
gps1.longitude.should be < 0.0
|
521
|
+
end
|
522
|
+
|
523
|
+
end
|
524
|
+
|
525
|
+
end
|
526
|
+
|
527
|
+
context 'flight 1' do
|
528
|
+
|
529
|
+
subject { reader.flights[0] }
|
530
|
+
|
531
|
+
its(:duration) { should be_within(0.1).of(328.6) }
|
532
|
+
|
533
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
534
|
+
|
535
|
+
end
|
536
|
+
|
537
|
+
context 'flight 2' do
|
538
|
+
|
539
|
+
subject { reader.flights[1] }
|
540
|
+
|
541
|
+
its(:duration) { should be_within(0.1).of(299.1) }
|
542
|
+
|
543
|
+
its(:telemetry_unit) { should == 'TM1000' }
|
544
|
+
|
545
|
+
end
|
546
|
+
|
415
547
|
end
|
416
548
|
|
417
549
|
end
|
data/spec/gps_record1_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Spektrum::Log::GPSRecord1 do
|
|
8
8
|
|
9
9
|
context 'data set 1' do
|
10
10
|
|
11
|
-
let(:raw_data) { ["
|
11
|
+
let(:raw_data) { ["1600870084214054886918094633093B"].pack('H*') }
|
12
12
|
|
13
13
|
its(:timestamp) { should eql(0x00010E8D) }
|
14
14
|
|
@@ -28,7 +28,7 @@ describe Spektrum::Log::GPSRecord1 do
|
|
28
28
|
|
29
29
|
context 'data set 2' do
|
30
30
|
|
31
|
-
let(:raw_data) { ["
|
31
|
+
let(:raw_data) { ["1600660221234054966218093030103B"].pack('H*') }
|
32
32
|
|
33
33
|
its(:altitude) { should be_within(0.1).of(87.3) }
|
34
34
|
|
@@ -42,7 +42,7 @@ describe Spektrum::Log::GPSRecord1 do
|
|
42
42
|
|
43
43
|
context 'data set 3' do
|
44
44
|
|
45
|
-
let(:raw_data) { ["
|
45
|
+
let(:raw_data) { ["1600130052242101046851036804153F"].pack('H*') }
|
46
46
|
|
47
47
|
its(:altitude) { should be_within(0.1).of(4.3) }
|
48
48
|
|
@@ -60,7 +60,7 @@ describe Spektrum::Log::GPSRecord1 do
|
|
60
60
|
|
61
61
|
context 'data set 4' do
|
62
62
|
|
63
|
-
let(:raw_data) { ["
|
63
|
+
let(:raw_data) { ["1600560359222101676651038623141F"].pack('H*') }
|
64
64
|
|
65
65
|
its(:altitude) { should be_within(0.1).of(116.8) }
|
66
66
|
|
@@ -78,7 +78,7 @@ describe Spektrum::Log::GPSRecord1 do
|
|
78
78
|
|
79
79
|
context 'data set 5' do
|
80
80
|
|
81
|
-
let(:raw_data) { ["
|
81
|
+
let(:raw_data) { ["1600142125250249434045084625183B"].pack('H*') }
|
82
82
|
|
83
83
|
its(:altitude) { should be_within(0.1).of(693.6) }
|
84
84
|
|
@@ -96,7 +96,7 @@ describe Spektrum::Log::GPSRecord1 do
|
|
96
96
|
|
97
97
|
context 'data set 6' do
|
98
98
|
|
99
|
-
let(:raw_data) { ["
|
99
|
+
let(:raw_data) { ["16007430561011417459009672350939"].pack('H*') }
|
100
100
|
|
101
101
|
its(:altitude) { should be_within(0.1).of(1008.5) }
|
102
102
|
|
@@ -114,7 +114,7 @@ describe Spektrum::Log::GPSRecord1 do
|
|
114
114
|
|
115
115
|
context 'data set 7' do
|
116
116
|
|
117
|
-
let(:raw_data) { ["
|
117
|
+
let(:raw_data) { ["16005518231111415959009602100939"].pack('H*') }
|
118
118
|
|
119
119
|
its(:altitude) { should be_within(0.1).of(608.6) }
|
120
120
|
|
data/spec/gps_record2_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Spektrum::Log::GPSRecord2 do
|
|
8
8
|
|
9
9
|
context 'data set 1' do
|
10
10
|
|
11
|
-
let(:raw_data) { ["
|
11
|
+
let(:raw_data) { ["1700500000184412110018099909073B"].pack('H*') }
|
12
12
|
|
13
13
|
its(:timestamp) { should eql(0x0002C8D5) }
|
14
14
|
|
@@ -30,7 +30,7 @@ describe Spektrum::Log::GPSRecord2 do
|
|
30
30
|
|
31
31
|
context 'data set 2' do
|
32
32
|
|
33
|
-
let(:raw_data) { ["
|
33
|
+
let(:raw_data) { ["1700270300011013080018093030103B"].pack('H*') }
|
34
34
|
|
35
35
|
its(:satellites) { should eql(8) }
|
36
36
|
|
data/spec/reader_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Spektrum::Log::Reader do
|
|
8
8
|
|
9
9
|
it { should have(3).flights }
|
10
10
|
|
11
|
-
its(:duration) { should be_within(0.1).of(
|
11
|
+
its(:duration) { should be_within(0.1).of(34.3) }
|
12
12
|
|
13
13
|
end
|
14
14
|
|
@@ -18,7 +18,7 @@ describe Spektrum::Log::Reader do
|
|
18
18
|
|
19
19
|
it { should have(312).flights }
|
20
20
|
|
21
|
-
its(:duration) { should be_within(0.1).of(
|
21
|
+
its(:duration) { should be_within(0.1).of(1570.7) }
|
22
22
|
|
23
23
|
end
|
24
24
|
|
@@ -28,7 +28,7 @@ describe Spektrum::Log::Reader do
|
|
28
28
|
|
29
29
|
it { should have(12).flights }
|
30
30
|
|
31
|
-
its(:duration) { should be_within(0.1).of(
|
31
|
+
its(:duration) { should be_within(0.1).of(144.8) }
|
32
32
|
|
33
33
|
end
|
34
34
|
|
@@ -38,7 +38,7 @@ describe Spektrum::Log::Reader do
|
|
38
38
|
|
39
39
|
it { should have(1).flights }
|
40
40
|
|
41
|
-
its(:duration) { should be_within(0.1).of(
|
41
|
+
its(:duration) { should be_within(0.1).of(15.9) }
|
42
42
|
|
43
43
|
end
|
44
44
|
|
@@ -48,7 +48,7 @@ describe Spektrum::Log::Reader do
|
|
48
48
|
|
49
49
|
it { should have(2).flights }
|
50
50
|
|
51
|
-
its(:duration) { should be_within(0.1).of(
|
51
|
+
its(:duration) { should be_within(0.1).of(1431.4) }
|
52
52
|
|
53
53
|
end
|
54
54
|
|
@@ -58,7 +58,27 @@ describe Spektrum::Log::Reader do
|
|
58
58
|
|
59
59
|
it { should have(2).flights }
|
60
60
|
|
61
|
-
its(:duration) { should be_within(0.1).of(
|
61
|
+
its(:duration) { should be_within(0.1).of(851.0) }
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'data file X5-GPS1.TLM' do
|
66
|
+
|
67
|
+
subject { Spektrum::Log::Reader.new(data_file('X5-GPS1.TLM')) }
|
68
|
+
|
69
|
+
it { should have(5).flights }
|
70
|
+
|
71
|
+
its(:duration) { should be_within(0.1).of(1305.2) }
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'data file X5-GPS2.TLM' do
|
76
|
+
|
77
|
+
subject { Spektrum::Log::Reader.new(data_file('X5-GPS2.TLM')) }
|
78
|
+
|
79
|
+
it { should have(2).flights }
|
80
|
+
|
81
|
+
its(:duration) { should be_within(0.1).of(627.7) }
|
62
82
|
|
63
83
|
end
|
64
84
|
|
metadata
CHANGED
@@ -1,32 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spektrum-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Nick Veys
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-04 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: awesome_print
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: bundler
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,6 +46,7 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: ci_reporter
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - '='
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - '='
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: rake
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,6 +78,7 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: rspec
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
83
|
- - ~>
|
74
84
|
- !ruby/object:Gem::Version
|
@@ -76,6 +86,7 @@ dependencies:
|
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
91
|
- - ~>
|
81
92
|
- !ruby/object:Gem::Version
|
@@ -83,48 +94,55 @@ dependencies:
|
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: simplecov
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
|
-
- - '>='
|
99
|
+
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
89
101
|
version: '0'
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
|
-
- - '>='
|
107
|
+
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
96
109
|
version: '0'
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: simplecov-gem-adapter
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
|
-
- - '>='
|
115
|
+
- - ! '>='
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
|
-
- - '>='
|
123
|
+
- - ! '>='
|
109
124
|
- !ruby/object:Gem::Version
|
110
125
|
version: '0'
|
111
126
|
- !ruby/object:Gem::Dependency
|
112
127
|
name: simplecov-rcov
|
113
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
114
130
|
requirements:
|
115
|
-
- - '>='
|
131
|
+
- - ! '>='
|
116
132
|
- !ruby/object:Gem::Version
|
117
133
|
version: '0'
|
118
134
|
type: :development
|
119
135
|
prerelease: false
|
120
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
121
138
|
requirements:
|
122
|
-
- - '>='
|
139
|
+
- - ! '>='
|
123
140
|
- !ruby/object:Gem::Version
|
124
141
|
version: '0'
|
125
142
|
- !ruby/object:Gem::Dependency
|
126
143
|
name: ruby_kml
|
127
144
|
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
128
146
|
requirements:
|
129
147
|
- - ~>
|
130
148
|
- !ruby/object:Gem::Version
|
@@ -132,6 +150,7 @@ dependencies:
|
|
132
150
|
type: :runtime
|
133
151
|
prerelease: false
|
134
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
135
154
|
requirements:
|
136
155
|
- - ~>
|
137
156
|
- !ruby/object:Gem::Version
|
@@ -157,6 +176,7 @@ files:
|
|
157
176
|
- data/GPS.TLM
|
158
177
|
- data/GPS2.TLM
|
159
178
|
- data/X5-GPS1.TLM
|
179
|
+
- data/X5-GPS2.TLM
|
160
180
|
- lib/spektrum/log.rb
|
161
181
|
- lib/spektrum/log/flight.rb
|
162
182
|
- lib/spektrum/log/headers.rb
|
@@ -174,26 +194,33 @@ files:
|
|
174
194
|
homepage: ''
|
175
195
|
licenses:
|
176
196
|
- MIT
|
177
|
-
metadata: {}
|
178
197
|
post_install_message:
|
179
198
|
rdoc_options: []
|
180
199
|
require_paths:
|
181
200
|
- lib
|
182
201
|
required_ruby_version: !ruby/object:Gem::Requirement
|
202
|
+
none: false
|
183
203
|
requirements:
|
184
|
-
- - '>='
|
204
|
+
- - ! '>='
|
185
205
|
- !ruby/object:Gem::Version
|
186
206
|
version: '0'
|
207
|
+
segments:
|
208
|
+
- 0
|
209
|
+
hash: -2804857274968739668
|
187
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
|
+
none: false
|
188
212
|
requirements:
|
189
|
-
- - '>='
|
213
|
+
- - ! '>='
|
190
214
|
- !ruby/object:Gem::Version
|
191
215
|
version: '0'
|
216
|
+
segments:
|
217
|
+
- 0
|
218
|
+
hash: -2804857274968739668
|
192
219
|
requirements: []
|
193
220
|
rubyforge_project:
|
194
|
-
rubygems_version:
|
221
|
+
rubygems_version: 1.8.25
|
195
222
|
signing_key:
|
196
|
-
specification_version:
|
223
|
+
specification_version: 3
|
197
224
|
summary: Spektrum TLM log file reader
|
198
225
|
test_files:
|
199
226
|
- spec/basic_data_record_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 3273a5b15027e4c72b4447bd283dc345dd4dc005
|
4
|
-
data.tar.gz: ed6cde1b8223a9cd2191c940a297c503748951c9
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: bcda6474caa68201bef60f8b99533b41a6b5d8ae10e3b562660930af6015b6b826f415f5b0cec0c1bd77659cc19f425f439fedc50e8854061c87e413081d50e6
|
7
|
-
data.tar.gz: 0a9ae4eec82b6792136d301e8435e29e14eee18de7158e0f6052b4fdc9c63075e8013dfcd4ba7c6d72f16b3735fc7568aca7f5188c984cbbafc84523c568ee90
|