cycle_analyst_logger 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +80 -12
- data/cycle_analyst_logger.rdoc +31 -12
- data/lib/cycle_analyst_logger/cli.rb +3 -18
- data/lib/cycle_analyst_logger/gps.rb +1 -1
- data/lib/cycle_analyst_logger/version.rb +1 -1
- data/resources/99-cycle_analyst.rules +3 -0
- data/resources/cycle_analyst_logger.service +13 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3011f180df601db59efd523a1ee9ccb6ffd6521
|
4
|
+
data.tar.gz: f53a937549e43c562ad8c0e1a594235f9946cf83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96c66ff2178ae54788ab15ec4221fe4fda695b777426316f1c80d7c592f1c8a9f8a5cb90595e0062c7d181239c537f0ffd5f6690dc94c7e6737cfef5cc13002f
|
7
|
+
data.tar.gz: 69cc29521879ff250579f6b1ff3e9db483c3d550d5686bf4b73a4a40443009953f936285ce9d5d4c79188ede57b3b453264ada57d1070e5ccf89a1f911f58578
|
data/README.rdoc
CHANGED
@@ -3,28 +3,32 @@
|
|
3
3
|
{<img src="https://badge.fury.io/rb/cycle_analyst_logger.svg" alt="Gem Version" />}[https://badge.fury.io/rb/cycle_analyst_logger]
|
4
4
|
|
5
5
|
== NAME
|
6
|
-
cycle_analyst_logger - Store the streaming data log output of a Grin Cycle Analyst V3 and optionally a Phaserunner
|
6
|
+
cycle_analyst_logger - Store the streaming data log output of a Grin Cycle Analyst V3 and optionally a Phaserunner and GPS
|
7
7
|
|
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
|
-
|
11
|
+
|
12
|
+
== Notes
|
13
|
+
Only tested with {Navspark-BD GPS}[http://navspark.mybigcommerce.com/navspark-bd-arduino-compatible-development-board-with-gps-beidou/]
|
12
14
|
|
13
15
|
== GLOBAL OPTIONS
|
14
|
-
-t, --tty_ca=arg
|
15
|
-
-b, --baud_ca=arg
|
16
|
-
--
|
17
|
-
--
|
18
|
-
--
|
19
|
-
|
20
|
-
--
|
21
|
-
|
22
|
-
--
|
16
|
+
-t, --tty_ca=arg - Cycle Analyst Serial (USB) device (default: /dev/cycle_analyst)
|
17
|
+
-b, --baud_ca=arg - Cycle Analyst Serial port baudrate (default: 9600)
|
18
|
+
--tty_pr=arg - Phaserunner Serial (USB) device (default: /dev/phaserunner)
|
19
|
+
--baud_pr=arg - Phaserunner Serial port baudrate (default: 115200)
|
20
|
+
--tty_gps=arg - Gps Serial (USB) device (default: /dev/gps)
|
21
|
+
--baud_gps=arg - Gps Serial port baudrate (default: 115200)
|
22
|
+
-l, --loop_count=arg - How many lines to read (default: forever)
|
23
|
+
--version - Display the program version
|
24
|
+
--[no-]enable_phaserunner - Get PhaseRunner Logs also (default: enabled)
|
25
|
+
--[no-]enable_gps - Get Gps Logs also (default: enabled)
|
26
|
+
-q, --[no-]quiet - Do not output to stdout
|
27
|
+
--help - Show this message
|
23
28
|
|
24
29
|
== COMMANDS
|
25
30
|
help - Shows a list of commands or help for one command
|
26
31
|
log - Capture the logging output of the Cycle Analyst and optionally Phaserunner to a file
|
27
|
-
location_from_gmx, loc - Merge geo info from GMX file and log lines from log file
|
28
32
|
|
29
33
|
=== Attributes that are Logged
|
30
34
|
|
@@ -58,7 +62,71 @@
|
|
58
62
|
* Phaserunner Last Fault ()
|
59
63
|
* Phaserunner Warnings ()
|
60
64
|
* Phaserunner Motor Input Power (W)
|
65
|
+
* GPS Time
|
66
|
+
* GPS Latitude
|
67
|
+
* GPS Longitude
|
68
|
+
* GPS Altitude
|
69
|
+
* GPS Speed
|
70
|
+
* GPS Fix Quality
|
71
|
+
* GPS Satellites
|
72
|
+
* GPS Geoid Height
|
73
|
+
* GPS Horizontal Dilution
|
74
|
+
* GPS FAA Mode
|
75
|
+
|
76
|
+
== Udev set up
|
77
|
+
|
78
|
+
A sampe udev rules file is in +resources/99-cycle_analyst.rules+. It is based on
|
79
|
+
the information from {Persistent names for usb-serial
|
80
|
+
devices}[http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/]
|
81
|
+
|
82
|
+
This one assumes we have the TTL to USB Cable based on the FTDI chipset like the
|
83
|
+
{USB Cables from Grin Tech}[http://www.ebikes.ca/ca-usb.html] We have one for
|
84
|
+
the Cycle Analyst (CA) and one for the Phaserunner. If you always use the same
|
85
|
+
cable with the CA and the other cable always for the Phaserunner (Label them).
|
86
|
+
Then you can get away with using the serial numbers that the UDEV system sees to
|
87
|
+
automatically link whatever USB port the cable is plugged into to the right
|
88
|
+
+/dev+ name.
|
89
|
+
|
90
|
+
The Navspark-BD GPS I used has a built in PL2303 chipset and doesn't seem to
|
91
|
+
have a serial number like the FTDI chipsets does. So the setup assumes there is
|
92
|
+
only one PL2303 USB and its the GPS.
|
93
|
+
|
94
|
+
== Systemd startup
|
95
|
+
|
96
|
+
There is a working systemd service unit file
|
97
|
+
+resources/cycle_analyst_logger.service+. You can copy it into
|
98
|
+
+/lib/systemd/system+ and do a
|
99
|
+
|
100
|
+
+systemctl daemon-reload+ to load it into systemd
|
101
|
+
|
102
|
+
* If you want it to start when the system is booted say:
|
103
|
+
|
104
|
+
+systemctl enable cycle_analyst_logger.service+
|
105
|
+
|
106
|
+
* To disable:
|
107
|
+
|
108
|
+
+systemctl disable cycle_analyst_logger.service+
|
109
|
+
|
110
|
+
* To start it manually (have to do this also the first time you do an enable and
|
111
|
+
want it to run then):
|
112
|
+
|
113
|
+
+systemctl start cycle_analyst_logger.service+
|
114
|
+
|
115
|
+
* You can check the status:
|
116
|
+
|
117
|
+
+systemctl status cycle_analyst_logger.service+
|
118
|
+
|
119
|
+
* To see the logs:
|
120
|
+
|
121
|
+
+journalctl -u cycle_analyst_logger.service+
|
122
|
+
|
123
|
+
This file assumed that rvm was installed in my home directory and an rvm wrapper
|
124
|
+
was created so it the service unit file could just exec it. I am currently using
|
125
|
+
Ruby 2.4.1.
|
126
|
+
|
127
|
+
The command used to create the wrapper was run as my normal user:
|
61
128
|
|
129
|
+
+rvm alias create cycle_analyst_logger 2.4.1+
|
62
130
|
|
63
131
|
== License and Copyright
|
64
132
|
|
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
|
+
v0.3.3
|
4
4
|
|
5
5
|
=== Global Options
|
6
6
|
=== -b|--baud_ca arg
|
@@ -10,18 +10,18 @@ Cycle Analyst Serial port baudrate
|
|
10
10
|
[Default Value] 9600
|
11
11
|
|
12
12
|
|
13
|
-
=== --
|
13
|
+
=== --baud_gps arg
|
14
14
|
|
15
|
-
|
15
|
+
Gps Serial port baudrate
|
16
16
|
|
17
17
|
[Default Value] 115200
|
18
18
|
|
19
19
|
|
20
|
-
=== --
|
20
|
+
=== --baud_pr arg
|
21
21
|
|
22
|
-
|
22
|
+
Phaserunner Serial port baudrate
|
23
23
|
|
24
|
-
[Default Value]
|
24
|
+
[Default Value] 115200
|
25
25
|
|
26
26
|
|
27
27
|
=== -l|--loop_count arg
|
@@ -35,14 +35,31 @@ How many lines to read
|
|
35
35
|
|
36
36
|
Cycle Analyst Serial (USB) device
|
37
37
|
|
38
|
-
[Default Value] /dev/
|
38
|
+
[Default Value] /dev/cycle_analyst
|
39
|
+
|
40
|
+
|
41
|
+
=== --tty_gps arg
|
42
|
+
|
43
|
+
Gps Serial (USB) device
|
44
|
+
|
45
|
+
[Default Value] /dev/gps
|
39
46
|
|
40
47
|
|
41
48
|
=== --tty_pr arg
|
42
49
|
|
43
50
|
Phaserunner Serial (USB) device
|
44
51
|
|
45
|
-
[Default Value] /dev/
|
52
|
+
[Default Value] /dev/phaserunner
|
53
|
+
|
54
|
+
|
55
|
+
=== --[no-]enable_gps
|
56
|
+
Get Gps Logs also
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
=== --[no-]enable_phaserunner
|
61
|
+
Get PhaseRunner Logs also
|
62
|
+
|
46
63
|
|
47
64
|
|
48
65
|
=== --help
|
@@ -71,11 +88,13 @@ List commands one per line, to assist with shell completion
|
|
71
88
|
|
72
89
|
|
73
90
|
|
74
|
-
==== Command: <tt>
|
75
|
-
|
91
|
+
==== Command: <tt>log </tt>
|
92
|
+
Log the Cycle Analyst and optionally GPS and Phaserunner to a file
|
76
93
|
|
77
94
|
|
78
|
-
|
79
|
-
|
95
|
+
===== Options
|
96
|
+
===== --[no-]disable_nmea_out
|
97
|
+
Disable writing raw nmea to its own file
|
98
|
+
|
80
99
|
|
81
100
|
|
@@ -25,7 +25,7 @@ module CycleAnalystLogger
|
|
25
25
|
sort_help :manually
|
26
26
|
|
27
27
|
desc 'Cycle Analyst Serial (USB) device'
|
28
|
-
default_value '/dev/
|
28
|
+
default_value '/dev/cycle_analyst'
|
29
29
|
arg 'tty', :optional
|
30
30
|
flag [:t, :tty_ca]
|
31
31
|
|
@@ -39,7 +39,7 @@ module CycleAnalystLogger
|
|
39
39
|
switch [:enable_phaserunner]
|
40
40
|
|
41
41
|
desc 'Phaserunner Serial (USB) device'
|
42
|
-
default_value '/dev/
|
42
|
+
default_value '/dev/phaserunner'
|
43
43
|
arg 'tty', :optional
|
44
44
|
flag [:tty_pr]
|
45
45
|
|
@@ -53,7 +53,7 @@ module CycleAnalystLogger
|
|
53
53
|
switch [:enable_gps]
|
54
54
|
|
55
55
|
desc 'Gps Serial (USB) device'
|
56
|
-
default_value '/dev/
|
56
|
+
default_value '/dev/gps'
|
57
57
|
arg 'tty', :optional
|
58
58
|
flag [:tty_gps]
|
59
59
|
|
@@ -80,21 +80,6 @@ module CycleAnalystLogger
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
desc 'Merge geo info from GMX file and log lines from log file'
|
84
|
-
arg :gpx_filename
|
85
|
-
arg :log_filename
|
86
|
-
arg :output_filename, :optional
|
87
|
-
command [:location_from_gmx, :loc] do |location_from_gmx|
|
88
|
-
location_from_gmx.action do |global_options, options, args|
|
89
|
-
gpx_filename = args[0]
|
90
|
-
log_filename = args[1]
|
91
|
-
output_filename = args[2]
|
92
|
-
|
93
|
-
gpx = Gpx.new(gpx_filename)
|
94
|
-
gpx.merge_location(log_filename, output_filename)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
83
|
pre do |global,command,options,args|
|
99
84
|
# Pre logic here
|
100
85
|
# Return true to proceed; false to abort and not call the
|
@@ -0,0 +1,3 @@
|
|
1
|
+
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", ATTRS{serial}=="DB00KZ46", SYMLINK+="phaserunner"
|
2
|
+
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", ATTRS{serial}=="DB00KLD2", SYMLINK+="cycle_analyst"
|
3
|
+
SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="gps"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=starts cycle_analyst_logger
|
3
|
+
After=network.target
|
4
|
+
After=syslog.target
|
5
|
+
|
6
|
+
[Service]
|
7
|
+
WorkingDirectory=/home/rberger/work/trike/logs
|
8
|
+
ExecStart=/home/rberger/.rvm/wrappers/ruby-2.4.1/cycle_analyst_logger -q log
|
9
|
+
Restart=always
|
10
|
+
RestartSec=30
|
11
|
+
|
12
|
+
[Install]
|
13
|
+
WantedBy=multi-user.target
|
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.3
|
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-01
|
11
|
+
date: 2018-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -216,6 +216,8 @@ files:
|
|
216
216
|
- lib/cycle_analyst_logger/gps.rb
|
217
217
|
- lib/cycle_analyst_logger/gpx.rb
|
218
218
|
- lib/cycle_analyst_logger/version.rb
|
219
|
+
- resources/99-cycle_analyst.rules
|
220
|
+
- resources/cycle_analyst_logger.service
|
219
221
|
- todo.txt
|
220
222
|
homepage: https://github.com/rberger/cycle_analyst_logger
|
221
223
|
licenses:
|