cycle_analyst_logger 0.3.4 → 0.3.5
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/.gitignore +2 -1
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.rdoc +10 -2
- data/Rakefile +0 -0
- data/cycle_analyst_logger.gemspec +0 -0
- data/cycle_analyst_logger.rdoc +5 -1
- data/lib/cycle_analyst_logger.rb +0 -0
- data/lib/cycle_analyst_logger/cli.rb +0 -0
- data/lib/cycle_analyst_logger/cycle_analyst.rb +20 -6
- data/lib/cycle_analyst_logger/gli_patch.rb +0 -0
- data/lib/cycle_analyst_logger/gps.rb +0 -0
- data/lib/cycle_analyst_logger/gpx.rb +0 -0
- data/lib/cycle_analyst_logger/version.rb +1 -1
- data/resources/99-cycle_analyst.rules +0 -0
- data/todo.txt +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1367340367d973de5b63973f2af651b5a907d048
|
4
|
+
data.tar.gz: 6c14e4394c0e0eb83294253cfdb6bac485d33dd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f56db0c688121fcf5380f92a72aa43aed397f0ef8ce68637a7e833ae0062a482d770fb74e7478578fbd67e5fd3522cca96729b71dc0a60a8a2ec13cf7203835
|
7
|
+
data.tar.gz: 162e630601963320a6d64203f91ee9b5516cc6171d47019d00b7c97abb77455bee3c3624aab70a3a4b1e78270e45af916620aa953d16bd7f62e44ff32e30b118
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.rdoc
CHANGED
@@ -8,9 +8,16 @@
|
|
8
8
|
== SYNOPSIS
|
9
9
|
cycle_analyst_logger [global options] command [command options] [arguments...]
|
10
10
|
cycle_analyst_logger [global options] log [tty] [baudrate] [enable_phaserunner] [tty] [baudrate]
|
11
|
+
cycle_analyst_logger [global options] to_ca_file log_filename
|
11
12
|
|
12
13
|
== Notes
|
13
|
-
|
14
|
+
|
15
|
+
* Only tested with {Navspark-BD GPS}[http://navspark.mybigcommerce.com/navspark-bd-arduino-compatible-development-board-with-gps-beidou/]
|
16
|
+
* Does not yet apply scaling factors to the Phaserunner data
|
17
|
+
* Log output file is CSV with CA, Phaserunner and GPS Data per line
|
18
|
+
* Also outputs the raw NMEA GPS file so that it can be read into {Grin Trip Analyzer}[http://www.ebikes.ca/tools/trip-analyzer.html]
|
19
|
+
* The +to_ca_file+ command converts the default log output file to a CALog file suitable for inputing to {Grin Trip Analyzer}[http://www.ebikes.ca/tools/trip-analyzer.html]
|
20
|
+
* Sometimes the Trip Analyzer barfs on the NMEA file
|
14
21
|
|
15
22
|
== GLOBAL OPTIONS
|
16
23
|
-t, --tty_ca=arg - Cycle Analyst Serial (USB) device (default: /dev/cycle_analyst)
|
@@ -29,6 +36,7 @@ Only tested with {Navspark-BD GPS}[http://navspark.mybigcommerce.com/navspark-bd
|
|
29
36
|
== COMMANDS
|
30
37
|
help - Shows a list of commands or help for one command
|
31
38
|
log - Capture the logging output of the Cycle Analyst and optionally Phaserunner to a file
|
39
|
+
to_ca_file - Transform logs to CA format
|
32
40
|
|
33
41
|
=== Attributes that are Logged
|
34
42
|
|
@@ -75,7 +83,7 @@ Only tested with {Navspark-BD GPS}[http://navspark.mybigcommerce.com/navspark-bd
|
|
75
83
|
|
76
84
|
== Udev set up
|
77
85
|
|
78
|
-
A
|
86
|
+
A sample udev rules file is in +resources/99-cycle_analyst.rules+. It is based on
|
79
87
|
the information from {Persistent names for usb-serial
|
80
88
|
devices}[http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/]
|
81
89
|
|
data/Rakefile
CHANGED
File without changes
|
File without changes
|
data/cycle_analyst_logger.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
== cycle_analyst_logger - Store the streaming data log output of a Grin Cycle Analyst V3 and optionally a Phaserunner
|
2
2
|
|
3
|
-
v0.3.
|
3
|
+
v0.3.5
|
4
4
|
|
5
5
|
=== Global Options
|
6
6
|
=== -b|--baud_ca arg
|
@@ -98,3 +98,7 @@ Disable writing raw nmea to its own file
|
|
98
98
|
|
99
99
|
|
100
100
|
|
101
|
+
==== Command: <tt>to_ca_file log_filename</tt>
|
102
|
+
Transform logs to CA format
|
103
|
+
|
104
|
+
|
data/lib/cycle_analyst_logger.rb
CHANGED
File without changes
|
File without changes
|
@@ -2,6 +2,12 @@ require 'time'
|
|
2
2
|
require 'serialport'
|
3
3
|
require 'phaserunner'
|
4
4
|
|
5
|
+
class String
|
6
|
+
def is_number?
|
7
|
+
true if Float(self) rescue false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
module CycleAnalystLogger
|
6
12
|
class CycleAnalyst
|
7
13
|
# Cycle Analyst serial port Baudrate
|
@@ -128,7 +134,6 @@ module CycleAnalystLogger
|
|
128
134
|
)
|
129
135
|
|
130
136
|
output += phaserunner.bulk_log_data if enable_phaserunner
|
131
|
-
#puts "gps_data: #{gps.log_data.inspect}"
|
132
137
|
output += gps.log_data if enable_gps
|
133
138
|
|
134
139
|
output_line = output.flatten.join(',')
|
@@ -148,6 +153,16 @@ module CycleAnalystLogger
|
|
148
153
|
end
|
149
154
|
end
|
150
155
|
|
156
|
+
# Very basic test that the record is valid
|
157
|
+
def self.validate_log_record(log_record)
|
158
|
+
return false unless valid_timestamp log_record[0]
|
159
|
+
log_record.each.with_index do |element, idx|
|
160
|
+
next if [0,14,29,38].any? { |i| idx == i } #Skip Timestamps and CA Limit value
|
161
|
+
return false unless element.is_number? || element.empty?
|
162
|
+
end
|
163
|
+
true
|
164
|
+
end
|
165
|
+
|
151
166
|
def self.log_to_ca_file(log_filename)
|
152
167
|
output_filename = log_filename.sub(
|
153
168
|
/cycle_analyst\.(\d\d\d\d\-\d\d\-\d\d_\d\d\-\d\d\-\d\d).csv/,
|
@@ -156,16 +171,15 @@ module CycleAnalystLogger
|
|
156
171
|
out_fd = File.open(output_filename, 'w')
|
157
172
|
|
158
173
|
File.readlines(log_filename).each.with_index do |log_line, idx|
|
159
|
-
log_record = log_line.split(',')
|
174
|
+
log_record = log_line.strip.split(',')
|
160
175
|
if idx == 0
|
161
176
|
out_fd.puts CA_STD_HEADER.join("\t")
|
162
177
|
next
|
163
178
|
end
|
164
179
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
out_fd.puts log_record[1..CA_STD_HEADER.length].join("\t")
|
180
|
+
log_end = CA_STD_HEADER.length
|
181
|
+
log_segment = log_record[1..log_end]
|
182
|
+
out_fd.puts log_segment.join("\t") if validate_log_record(log_record)
|
169
183
|
end
|
170
184
|
end
|
171
185
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/todo.txt
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cycle_analyst_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert J. Berger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|