jeti-log 0.4.0 → 0.5.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 +6 -5
- data/lib/jeti/log/{composite_dataset_builder.rb → data/composite_dataset_builder.rb} +2 -2
- data/lib/jeti/log/{mezon_data.rb → data/mezon_data.rb} +2 -2
- data/lib/jeti/log/data/mgps_data.rb +99 -0
- data/lib/jeti/log/data/mui_data.rb +15 -0
- data/lib/jeti/log/data/rx_data.rb +27 -0
- data/lib/jeti/log/data/tx_data.rb +15 -0
- data/lib/jeti/log/entry.rb +9 -0
- data/lib/jeti/log/file.rb +18 -41
- data/lib/jeti/log/version.rb +1 -1
- data/spec/{mezon_data_spec.rb → data/mezon_data_spec.rb} +2 -2
- data/spec/data/mgps_data_spec.rb +58 -0
- data/spec/data/mui_data_spec.rb +7 -0
- data/spec/data/tx_data_spec.rb +7 -0
- data/spec/file_spec.rb +22 -94
- data/spec/{data → sample-data}/1min-tx-rx.log +0 -0
- data/spec/{data → sample-data}/gps-crash.log +0 -0
- data/spec/{data → sample-data}/invalid/castle/long-flight.csv +0 -0
- data/spec/{data → sample-data}/invalid/eagle_tree/multi-session-2.fdr +0 -0
- data/spec/{data → sample-data}/invalid/empty.file +0 -0
- data/spec/data/invalid/mavlink/2013-10-13 16-58-51.tlog b/data/spec/sample-data/invalid/mavlink/2013-10-13 → 16-58-51.tlog +0 -0
- data/spec/data/invalid/mavlink/2013-10-13 18-31-24.tlog b/data/spec/sample-data/invalid/mavlink/2013-10-13 → 18-31-24.tlog +0 -0
- data/spec/data/invalid/mavlink/2013-10-13 18-50-10.tlog b/data/spec/sample-data/invalid/mavlink/2013-10-13 → 18-50-10.tlog +0 -0
- data/spec/{data → sample-data}/invalid/spektrum/1.TLM +0 -0
- data/spec/{data → sample-data}/mezon-1.log +0 -0
- data/spec/{data → sample-data}/mezon-2.log +0 -0
- data/spec/{data → sample-data}/mezon-3.log +0 -0
- data/spec/{data → sample-data}/tx-controls.log +0 -0
- data/spec/spec_helper.rb +4 -4
- metadata +41 -40
- data/lib/jeti/log/mgps_data.rb +0 -40
- data/lib/jeti/log/mui_data.rb +0 -7
- data/lib/jeti/log/tx_data.rb +0 -7
- data/spec/mgps_data_spec.rb +0 -7
- data/spec/mui_data_spec.rb +0 -7
- data/spec/tx_data_spec.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c00527836445e3216dc0a0f66ab34d6a1f7a6c3d
|
4
|
+
data.tar.gz: 5fb91cfe5589f9c8778649aa2e48bbcfb7ad985a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26deabd8448f51e97ea6ded5860ee9be99db532fec23856d06b278fa016c251ae23e2d0728db0bf319600713a9e0c85e77ceb7f1849a48e4440256ab12059cb8
|
7
|
+
data.tar.gz: f3d5de813c78cd15823d0b5b43a0891df162fedbc1ee6bd740b9b6d8ba6f9555db11fe8d2c4e6b4ba7ca06569898012435532f3dcd03ae5c71787b9f9f47168f
|
data/lib/jeti/log.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
require 'jeti/log/composite_dataset_builder'
|
2
1
|
require 'jeti/log/entry'
|
3
2
|
require 'jeti/log/file'
|
4
3
|
require 'jeti/log/header'
|
5
|
-
require 'jeti/log/mezon_data'
|
6
|
-
require 'jeti/log/mgps_data'
|
7
|
-
require 'jeti/log/mui_data'
|
8
|
-
require 'jeti/log/tx_data'
|
9
4
|
require 'jeti/log/version'
|
5
|
+
require 'jeti/log/data/composite_dataset_builder'
|
6
|
+
require 'jeti/log/data/mezon_data'
|
7
|
+
require 'jeti/log/data/mgps_data'
|
8
|
+
require 'jeti/log/data/mui_data'
|
9
|
+
require 'jeti/log/data/rx_data'
|
10
|
+
require 'jeti/log/data/tx_data'
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module Jeti; module Log; module Data;
|
2
|
+
|
3
|
+
class MGPSData
|
4
|
+
|
5
|
+
attr_reader :time
|
6
|
+
attr_reader :stamp
|
7
|
+
attr_reader :latitude
|
8
|
+
attr_reader :longitude
|
9
|
+
attr_reader :quality
|
10
|
+
attr_reader :satellite_count
|
11
|
+
attr_reader :distance
|
12
|
+
attr_reader :speed
|
13
|
+
attr_reader :course
|
14
|
+
attr_reader :azimuth
|
15
|
+
attr_reader :impulse
|
16
|
+
attr_reader :date
|
17
|
+
|
18
|
+
def initialize(time, fields)
|
19
|
+
raise ArgumentError unless fields.length == 14
|
20
|
+
@time = time
|
21
|
+
@stamp, @latitude, @longitude, @quality, @satellite_count, @altitude,
|
22
|
+
@distance, @speed, @relative_altitude, @course, @azimuth, @impulse,
|
23
|
+
@trip, @date = fields
|
24
|
+
end
|
25
|
+
|
26
|
+
# Gets the altitude, in desired unit.
|
27
|
+
#
|
28
|
+
# @param unit one of :feet, :meters to define desired unit
|
29
|
+
# @return [Float] altitude in the desired unit
|
30
|
+
def altitude(unit = :meters)
|
31
|
+
convert_length(@altitude, unit)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Gets the distance from point of origin, in desired unit.
|
35
|
+
#
|
36
|
+
# @param unit one of :feet, :meters to define desired unit
|
37
|
+
# @return [Float] distance in the desired unit
|
38
|
+
def distance(unit = :meters)
|
39
|
+
convert_length(@distance, unit)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Gets the relative altitude, in desired unit.
|
43
|
+
#
|
44
|
+
# @param unit one of :feet, :meters to define desired unit
|
45
|
+
# @return [Float] relative altitude in the desired unit
|
46
|
+
def relative_altitude(unit = :meters)
|
47
|
+
convert_length(@relative_altitude, unit)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Gets the ground speed, in desired unit.
|
51
|
+
#
|
52
|
+
# @param unit one of :mps (m/s), :mph (mi/hr) to define desired unit
|
53
|
+
# @return [Float] ground speed in the desired unit
|
54
|
+
def speed(unit = :mps)
|
55
|
+
convert_speed(@speed, unit)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Gets the traveled path length, in desired unit.
|
59
|
+
#
|
60
|
+
# @param unit one of :feet, :meters to define desired unit
|
61
|
+
# @return [Float] trip in the desired unit
|
62
|
+
def trip(unit = :meters)
|
63
|
+
convert_length(@trip, unit)
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def convert_length(value_in_meters, unit)
|
69
|
+
case unit
|
70
|
+
when :feet
|
71
|
+
value_in_meters * 0.32808399
|
72
|
+
else
|
73
|
+
value_in_meters
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def convert_speed(value_in_meters_per_second, unit)
|
78
|
+
case unit
|
79
|
+
when :mph
|
80
|
+
value_in_meters_per_second * 2.23694
|
81
|
+
else
|
82
|
+
value_in_meters_per_second
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
class MGPSDataBuilder
|
89
|
+
|
90
|
+
def self.build(file)
|
91
|
+
CompositeDatasetBuilder.build(file, MGPSData, /MGPS/, /Timestamp/i, /Latitude/,
|
92
|
+
/Longitude/, /Quality/, /SatCount/, /Altitude/,
|
93
|
+
/Distance/, /Speed/, /AltRelat/, /Course/, /Azimuth/,
|
94
|
+
/Impulse/, /Trip/, /Date/)
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
end; end; end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Jeti; module Log; module Data;
|
2
|
+
|
3
|
+
class RxData
|
4
|
+
|
5
|
+
attr_reader :voltage
|
6
|
+
attr_reader :antenna1
|
7
|
+
attr_reader :antenna2
|
8
|
+
attr_reader :quality
|
9
|
+
|
10
|
+
def initialize(time, fields)
|
11
|
+
raise ArgumentError unless fields.length == 4
|
12
|
+
@time = time
|
13
|
+
@voltage, @antenna1, @antenna2, @quality = fields
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class RxDataBuilder
|
19
|
+
|
20
|
+
def self.build(file)
|
21
|
+
div100 = ->(val) { val / 100.0 }
|
22
|
+
CompositeDatasetBuilder.build(file, RxData, /Rx/, [/U Rx/, div100], /A1/, /A2/, /Q/)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end; end; end
|
data/lib/jeti/log/entry.rb
CHANGED
@@ -31,6 +31,8 @@ module Jeti; module Log;
|
|
31
31
|
(min * 60) + sec
|
32
32
|
when '9'
|
33
33
|
format_gps(raw[2].to_i, raw[3].to_i)
|
34
|
+
when '14'
|
35
|
+
format_date(raw[3])
|
34
36
|
else
|
35
37
|
nil
|
36
38
|
end
|
@@ -40,6 +42,13 @@ module Jeti; module Log;
|
|
40
42
|
|
41
43
|
private
|
42
44
|
|
45
|
+
def format_date(val)
|
46
|
+
month = (val & 0xFF00) >> 8
|
47
|
+
day = val >> 16
|
48
|
+
year = val & 0x00FF
|
49
|
+
Date.new(year, month, day)
|
50
|
+
end
|
51
|
+
|
43
52
|
def format_gps(dec, val)
|
44
53
|
minute = (val & 0xFFFF) / 1000.0
|
45
54
|
degrees = (val >> 16) & 0xFF
|
data/lib/jeti/log/file.rb
CHANGED
@@ -55,52 +55,36 @@ module Jeti; module Log;
|
|
55
55
|
(@entries.last.time - @entries.first.time) / 1000.0
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
def antenna1_signals
|
63
|
-
@antenna1_signals ||= value_dataset(/Rx/, /A1/)
|
64
|
-
end
|
65
|
-
|
66
|
-
def antenna2_signals?
|
67
|
-
!antenna2_signals.empty?
|
68
|
-
end
|
69
|
-
|
70
|
-
def antenna2_signals
|
71
|
-
@antenna2_signals ||= value_dataset(/Rx/, /A2/)
|
72
|
-
end
|
73
|
-
|
74
|
-
def rx_voltages?
|
75
|
-
!rx_voltages.empty?
|
58
|
+
def mgps_data?
|
59
|
+
device_present?(/MGPS/)
|
76
60
|
end
|
77
61
|
|
78
|
-
def
|
79
|
-
|
62
|
+
def mgps_data
|
63
|
+
@mgps_data ||= Data::MGPSDataBuilder.build(self)
|
80
64
|
end
|
81
65
|
|
82
|
-
def
|
83
|
-
|
66
|
+
def mezon_data?
|
67
|
+
device_present?(/Mezon/i)
|
84
68
|
end
|
85
69
|
|
86
|
-
def
|
87
|
-
@
|
70
|
+
def mezon_data
|
71
|
+
@mezon_data ||= Data::MezonDataBuilder.build(self)
|
88
72
|
end
|
89
73
|
|
90
|
-
def
|
91
|
-
device_present?(/
|
74
|
+
def mui_data?
|
75
|
+
device_present?(/Mezon/i)
|
92
76
|
end
|
93
77
|
|
94
|
-
def
|
95
|
-
|
78
|
+
def mui_data
|
79
|
+
@mui_data ||= Data::MuiDataBuilder.build(self)
|
96
80
|
end
|
97
81
|
|
98
|
-
def
|
99
|
-
device_present?(/
|
82
|
+
def rx_data?
|
83
|
+
device_present?(/Rx/)
|
100
84
|
end
|
101
85
|
|
102
|
-
def
|
103
|
-
@
|
86
|
+
def rx_data
|
87
|
+
@rx_data ||= Data::RxDataBuilder.build(self)
|
104
88
|
end
|
105
89
|
|
106
90
|
def tx_data?
|
@@ -108,7 +92,7 @@ module Jeti; module Log;
|
|
108
92
|
end
|
109
93
|
|
110
94
|
def tx_data
|
111
|
-
@tx_data ||=
|
95
|
+
@tx_data ||= Data::TxDataBuilder.build(self)
|
112
96
|
end
|
113
97
|
|
114
98
|
# Determines if KML methods can be called for this session.
|
@@ -210,16 +194,9 @@ module Jeti; module Log;
|
|
210
194
|
options
|
211
195
|
end
|
212
196
|
|
213
|
-
def build_rx_voltages
|
214
|
-
value_dataset(/Rx/, /U Rx/, ->(val) { val / 100.0 })
|
215
|
-
end
|
216
|
-
|
217
|
-
def build_tx_data
|
218
|
-
[]
|
219
|
-
end
|
220
|
-
|
221
197
|
def device_present?(device)
|
222
198
|
@headers.any? { |h| device =~ h.name }
|
199
|
+
# XXX improve, make sure there are entries
|
223
200
|
end
|
224
201
|
|
225
202
|
def headers_and_entries_for_device(device)
|
data/lib/jeti/log/version.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Jeti::Log::MezonData do
|
3
|
+
describe Jeti::Log::Data::MezonData do
|
4
4
|
|
5
|
-
subject {
|
5
|
+
subject { described_class.new(25, [15.1, 5, 5.4, 1, 250, 1000, 25, 150, 99]) }
|
6
6
|
|
7
7
|
its(:time) { should eql(25) }
|
8
8
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Jeti::Log::Data::MGPSData do
|
4
|
+
|
5
|
+
subject { described_class.new(25, [150, 41.124, -95.024, 1, 8, 350, 5000, 15, 25,
|
6
|
+
45, 35, 0, 250, Date.new(2013, 1, 1)]) }
|
7
|
+
|
8
|
+
its(:time) { should eql(25) }
|
9
|
+
|
10
|
+
its(:stamp) { should eql(150) }
|
11
|
+
|
12
|
+
its(:latitude) { should be_within(0.001).of(41.124) }
|
13
|
+
|
14
|
+
its(:longitude) { should be_within(0.001).of(-95.024) }
|
15
|
+
|
16
|
+
its(:quality) { should eql(1) }
|
17
|
+
|
18
|
+
its(:satellite_count) { should eql(8) }
|
19
|
+
|
20
|
+
its(:altitude) { should be_within(0.01).of(350) }
|
21
|
+
|
22
|
+
it 'should provide altitude in feet' do
|
23
|
+
expect(subject.altitude(:feet)).to be_within(0.01).of(114.83)
|
24
|
+
end
|
25
|
+
|
26
|
+
its(:distance) { should be_within(0.01).of(5000) }
|
27
|
+
|
28
|
+
it 'should provide distance in feet' do
|
29
|
+
expect(subject.distance(:feet)).to be_within(0.01).of(1640.42)
|
30
|
+
end
|
31
|
+
|
32
|
+
its(:speed) { should be_within(0.01).of(15) }
|
33
|
+
|
34
|
+
it 'should provide speed in mph' do
|
35
|
+
expect(subject.speed(:mph)).to be_within(0.01).of(33.55)
|
36
|
+
end
|
37
|
+
|
38
|
+
its(:relative_altitude) { should be_within(0.01).of(25) }
|
39
|
+
|
40
|
+
it 'should provide relative altitude in feet' do
|
41
|
+
expect(subject.relative_altitude(:feet)).to be_within(0.01).of(8.20)
|
42
|
+
end
|
43
|
+
|
44
|
+
its(:course) { should eql(45) }
|
45
|
+
|
46
|
+
its(:azimuth) { should eql(35) }
|
47
|
+
|
48
|
+
its(:impulse) { should eql(0) }
|
49
|
+
|
50
|
+
its(:trip) { should be_within(0.01).of(250) }
|
51
|
+
|
52
|
+
it 'should provide trip in feet' do
|
53
|
+
expect(subject.trip(:feet)).to be_within(0.01).of(82.02)
|
54
|
+
end
|
55
|
+
|
56
|
+
its(:date) { should eql(Date.new(2013, 1, 1)) }
|
57
|
+
|
58
|
+
end
|
data/spec/file_spec.rb
CHANGED
@@ -10,45 +10,7 @@ describe Jeti::Log::File do
|
|
10
10
|
|
11
11
|
its(:duration) { should be_within(1.0).of(60.0) }
|
12
12
|
|
13
|
-
its(:
|
14
|
-
|
15
|
-
it { should have(115).antenna1_signals }
|
16
|
-
|
17
|
-
it 'should have some select antenna1 signals' do
|
18
|
-
expect(subject.antenna1_signals[0]).to eql([1073617, 9])
|
19
|
-
expect(subject.antenna1_signals[50]).to eql([1099599, 9])
|
20
|
-
expect(subject.antenna1_signals[100]).to eql([1125599, 9])
|
21
|
-
end
|
22
|
-
|
23
|
-
its(:antenna2_signals?) { should be_true }
|
24
|
-
|
25
|
-
it { should have(115).antenna2_signals }
|
26
|
-
|
27
|
-
it 'should have some select antenna2 signals' do
|
28
|
-
expect(subject.antenna1_signals[10]).to eql([1078799, 9])
|
29
|
-
expect(subject.antenna1_signals[60]).to eql([1104817, 9])
|
30
|
-
expect(subject.antenna1_signals[90]).to eql([1120425, 9])
|
31
|
-
end
|
32
|
-
|
33
|
-
its(:rx_voltages?) { should be_true }
|
34
|
-
|
35
|
-
it { should have(115).rx_voltages }
|
36
|
-
|
37
|
-
it 'should have some select rx voltages' do
|
38
|
-
expect(subject.rx_voltages[10]).to eql([1078799, 4.71])
|
39
|
-
expect(subject.rx_voltages[60]).to eql([1104817, 4.7])
|
40
|
-
expect(subject.rx_voltages[90]).to eql([1120425, 4.71])
|
41
|
-
end
|
42
|
-
|
43
|
-
its(:signal_qualities?) { should be_true }
|
44
|
-
|
45
|
-
it { should have(115).signal_qualities }
|
46
|
-
|
47
|
-
it 'should have some select signal qualities' do
|
48
|
-
expect(subject.signal_qualities[10]).to eql([1078799, 100])
|
49
|
-
expect(subject.signal_qualities[60]).to eql([1104817, 100])
|
50
|
-
expect(subject.signal_qualities[90]).to eql([1120425, 100])
|
51
|
-
end
|
13
|
+
its(:rx_data?) { should be_true }
|
52
14
|
|
53
15
|
its(:mgps_data?) { should be_false }
|
54
16
|
|
@@ -70,44 +32,28 @@ describe Jeti::Log::File do
|
|
70
32
|
|
71
33
|
its(:duration) { should be_within(0.1).of(286.2) }
|
72
34
|
|
73
|
-
its(:
|
74
|
-
|
75
|
-
it { should have(553).antenna1_signals }
|
76
|
-
|
77
|
-
it 'should have some select antenna1 signals' do
|
78
|
-
expect(subject.antenna1_signals[0]).to eql([219714, 9])
|
79
|
-
expect(subject.antenna1_signals[50]).to eql([244741, 9])
|
80
|
-
expect(subject.antenna1_signals[100]).to eql([270738, 9])
|
81
|
-
end
|
82
|
-
|
83
|
-
its(:antenna2_signals?) { should be_true }
|
35
|
+
its(:rx_data?) { should be_true }
|
84
36
|
|
85
|
-
it { should have(553).
|
37
|
+
it { should have(553).rx_data }
|
86
38
|
|
87
|
-
it 'should have some select
|
88
|
-
|
89
|
-
expect(
|
90
|
-
expect(
|
91
|
-
|
39
|
+
it 'should have some select rx data' do
|
40
|
+
d = subject.rx_data[0]
|
41
|
+
expect(d.antenna1).to eql(9)
|
42
|
+
expect(d.antenna2).to eql(9)
|
43
|
+
expect(d.quality).to eql(100)
|
44
|
+
expect(d.voltage).to be_within(0.1).of(4.7)
|
92
45
|
|
93
|
-
|
46
|
+
d = subject.rx_data[100]
|
47
|
+
expect(d.antenna1).to eql(9)
|
48
|
+
expect(d.antenna2).to eql(9)
|
49
|
+
expect(d.quality).to eql(100)
|
50
|
+
expect(d.voltage).to be_within(0.1).of(4.7)
|
94
51
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
expect(
|
99
|
-
expect(
|
100
|
-
expect(subject.rx_voltages[90]).to eql([265538, 4.69])
|
101
|
-
end
|
102
|
-
|
103
|
-
its(:signal_qualities?) { should be_true }
|
104
|
-
|
105
|
-
it { should have(553).signal_qualities }
|
106
|
-
|
107
|
-
it 'should have some select signal qualities' do
|
108
|
-
expect(subject.signal_qualities[10]).to eql([223938, 100])
|
109
|
-
expect(subject.signal_qualities[60]).to eql([249938, 100])
|
110
|
-
expect(subject.signal_qualities[90]).to eql([265538, 100])
|
52
|
+
d = subject.rx_data[400]
|
53
|
+
expect(d.antenna1).to eql(5)
|
54
|
+
expect(d.antenna2).to eql(4)
|
55
|
+
expect(d.quality).to eql(96)
|
56
|
+
expect(d.voltage).to be_within(0.1).of(4.7)
|
111
57
|
end
|
112
58
|
|
113
59
|
its(:mgps_data?) { should be_true }
|
@@ -163,13 +109,7 @@ describe Jeti::Log::File do
|
|
163
109
|
|
164
110
|
its(:duration) { should be_within(0.1).of(9.2) }
|
165
111
|
|
166
|
-
its(:
|
167
|
-
|
168
|
-
its(:antenna2_signals?) { should be_true }
|
169
|
-
|
170
|
-
its(:rx_voltages?) { should be_true }
|
171
|
-
|
172
|
-
its(:signal_qualities?) { should be_true }
|
112
|
+
its(:rx_data?) { should be_true }
|
173
113
|
|
174
114
|
its(:mgps_data?) { should be_false }
|
175
115
|
|
@@ -213,13 +153,7 @@ describe Jeti::Log::File do
|
|
213
153
|
|
214
154
|
its(:duration) { should be_within(0.1).of(43.6) }
|
215
155
|
|
216
|
-
its(:
|
217
|
-
|
218
|
-
its(:antenna2_signals?) { should be_true }
|
219
|
-
|
220
|
-
its(:rx_voltages?) { should be_true }
|
221
|
-
|
222
|
-
its(:signal_qualities?) { should be_true }
|
156
|
+
its(:rx_data?) { should be_true }
|
223
157
|
|
224
158
|
its(:mgps_data?) { should be_false }
|
225
159
|
|
@@ -269,13 +203,7 @@ describe Jeti::Log::File do
|
|
269
203
|
|
270
204
|
its(:duration) { should be_within(1).of(371) }
|
271
205
|
|
272
|
-
its(:
|
273
|
-
|
274
|
-
its(:antenna2_signals?) { should be_true }
|
275
|
-
|
276
|
-
its(:rx_voltages?) { should be_true }
|
277
|
-
|
278
|
-
its(:signal_qualities?) { should be_true }
|
206
|
+
its(:rx_data?) { should be_true }
|
279
207
|
|
280
208
|
its(:mgps_data?) { should be_false }
|
281
209
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -22,18 +22,18 @@ RSpec.configure do |config|
|
|
22
22
|
config.order = 'random'
|
23
23
|
end
|
24
24
|
|
25
|
-
# root from spec/data
|
25
|
+
# root from spec/sample-data
|
26
26
|
def data_file(name)
|
27
|
-
File.expand_path("#{File.dirname(__FILE__)}/data/#{name}")
|
27
|
+
File.expand_path("#{File.dirname(__FILE__)}/sample-data/#{name}")
|
28
28
|
end
|
29
29
|
|
30
30
|
def data_files
|
31
|
-
dir = "#{File.dirname(__FILE__)}/data/#{dir}"
|
31
|
+
dir = "#{File.dirname(__FILE__)}/sample-data/#{dir}"
|
32
32
|
Dir.glob("#{dir}/*").select { |e| File.file? e }
|
33
33
|
end
|
34
34
|
|
35
35
|
def invalid_data_files
|
36
|
-
dir = "#{File.dirname(__FILE__)}/data/invalid"
|
36
|
+
dir = "#{File.dirname(__FILE__)}/sample-data/invalid"
|
37
37
|
invalid = Dir.glob("#{dir}/**/*").select { |e| File.file? e }
|
38
38
|
invalid << __FILE__
|
39
39
|
invalid << 'NOFILE.TLM'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jeti-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Veys
|
@@ -152,34 +152,35 @@ files:
|
|
152
152
|
- Rakefile
|
153
153
|
- jeti-log.gemspec
|
154
154
|
- lib/jeti/log.rb
|
155
|
-
- lib/jeti/log/composite_dataset_builder.rb
|
155
|
+
- lib/jeti/log/data/composite_dataset_builder.rb
|
156
|
+
- lib/jeti/log/data/mezon_data.rb
|
157
|
+
- lib/jeti/log/data/mgps_data.rb
|
158
|
+
- lib/jeti/log/data/mui_data.rb
|
159
|
+
- lib/jeti/log/data/rx_data.rb
|
160
|
+
- lib/jeti/log/data/tx_data.rb
|
156
161
|
- lib/jeti/log/entry.rb
|
157
162
|
- lib/jeti/log/file.rb
|
158
163
|
- lib/jeti/log/header.rb
|
159
|
-
- lib/jeti/log/mezon_data.rb
|
160
|
-
- lib/jeti/log/mgps_data.rb
|
161
|
-
- lib/jeti/log/mui_data.rb
|
162
|
-
- lib/jeti/log/tx_data.rb
|
163
164
|
- lib/jeti/log/version.rb
|
164
|
-
- spec/data/
|
165
|
-
- spec/data/
|
166
|
-
- spec/data/
|
167
|
-
- spec/data/
|
168
|
-
- spec/data/invalid/empty.file
|
169
|
-
- spec/data/invalid/mavlink/2013-10-13 16-58-51.tlog
|
170
|
-
- spec/data/invalid/mavlink/2013-10-13 18-31-24.tlog
|
171
|
-
- spec/data/invalid/mavlink/2013-10-13 18-50-10.tlog
|
172
|
-
- spec/data/invalid/spektrum/1.TLM
|
173
|
-
- spec/data/mezon-1.log
|
174
|
-
- spec/data/mezon-2.log
|
175
|
-
- spec/data/mezon-3.log
|
176
|
-
- spec/data/tx-controls.log
|
165
|
+
- spec/data/mezon_data_spec.rb
|
166
|
+
- spec/data/mgps_data_spec.rb
|
167
|
+
- spec/data/mui_data_spec.rb
|
168
|
+
- spec/data/tx_data_spec.rb
|
177
169
|
- spec/file_spec.rb
|
178
|
-
- spec/
|
179
|
-
- spec/
|
180
|
-
- spec/
|
170
|
+
- spec/sample-data/1min-tx-rx.log
|
171
|
+
- spec/sample-data/gps-crash.log
|
172
|
+
- spec/sample-data/invalid/castle/long-flight.csv
|
173
|
+
- spec/sample-data/invalid/eagle_tree/multi-session-2.fdr
|
174
|
+
- spec/sample-data/invalid/empty.file
|
175
|
+
- spec/sample-data/invalid/mavlink/2013-10-13 16-58-51.tlog
|
176
|
+
- spec/sample-data/invalid/mavlink/2013-10-13 18-31-24.tlog
|
177
|
+
- spec/sample-data/invalid/mavlink/2013-10-13 18-50-10.tlog
|
178
|
+
- spec/sample-data/invalid/spektrum/1.TLM
|
179
|
+
- spec/sample-data/mezon-1.log
|
180
|
+
- spec/sample-data/mezon-2.log
|
181
|
+
- spec/sample-data/mezon-3.log
|
182
|
+
- spec/sample-data/tx-controls.log
|
181
183
|
- spec/spec_helper.rb
|
182
|
-
- spec/tx_data_spec.rb
|
183
184
|
homepage: ''
|
184
185
|
licenses:
|
185
186
|
- MIT
|
@@ -205,22 +206,22 @@ signing_key:
|
|
205
206
|
specification_version: 4
|
206
207
|
summary: Jeti telemetry log file reader
|
207
208
|
test_files:
|
208
|
-
- spec/data/
|
209
|
-
- spec/data/
|
210
|
-
- spec/data/
|
211
|
-
- spec/data/
|
212
|
-
- spec/data/invalid/empty.file
|
213
|
-
- spec/data/invalid/mavlink/2013-10-13 16-58-51.tlog
|
214
|
-
- spec/data/invalid/mavlink/2013-10-13 18-31-24.tlog
|
215
|
-
- spec/data/invalid/mavlink/2013-10-13 18-50-10.tlog
|
216
|
-
- spec/data/invalid/spektrum/1.TLM
|
217
|
-
- spec/data/mezon-1.log
|
218
|
-
- spec/data/mezon-2.log
|
219
|
-
- spec/data/mezon-3.log
|
220
|
-
- spec/data/tx-controls.log
|
209
|
+
- spec/data/mezon_data_spec.rb
|
210
|
+
- spec/data/mgps_data_spec.rb
|
211
|
+
- spec/data/mui_data_spec.rb
|
212
|
+
- spec/data/tx_data_spec.rb
|
221
213
|
- spec/file_spec.rb
|
222
|
-
- spec/
|
223
|
-
- spec/
|
224
|
-
- spec/
|
214
|
+
- spec/sample-data/1min-tx-rx.log
|
215
|
+
- spec/sample-data/gps-crash.log
|
216
|
+
- spec/sample-data/invalid/castle/long-flight.csv
|
217
|
+
- spec/sample-data/invalid/eagle_tree/multi-session-2.fdr
|
218
|
+
- spec/sample-data/invalid/empty.file
|
219
|
+
- spec/sample-data/invalid/mavlink/2013-10-13 16-58-51.tlog
|
220
|
+
- spec/sample-data/invalid/mavlink/2013-10-13 18-31-24.tlog
|
221
|
+
- spec/sample-data/invalid/mavlink/2013-10-13 18-50-10.tlog
|
222
|
+
- spec/sample-data/invalid/spektrum/1.TLM
|
223
|
+
- spec/sample-data/mezon-1.log
|
224
|
+
- spec/sample-data/mezon-2.log
|
225
|
+
- spec/sample-data/mezon-3.log
|
226
|
+
- spec/sample-data/tx-controls.log
|
225
227
|
- spec/spec_helper.rb
|
226
|
-
- spec/tx_data_spec.rb
|
data/lib/jeti/log/mgps_data.rb
DELETED
@@ -1,40 +0,0 @@
|
|
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/mui_data.rb
DELETED
data/lib/jeti/log/tx_data.rb
DELETED
data/spec/mgps_data_spec.rb
DELETED
data/spec/mui_data_spec.rb
DELETED