rfbeam 0.4.8 → 0.4.10
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/Gemfile.lock +1 -1
- data/README.md +63 -45
- data/lib/rfbeam/cli.rb +1 -1
- data/lib/rfbeam/kld7/cli_formatter.rb +18 -11
- data/lib/rfbeam/kld7/cli_output.rb +1 -1
- data/lib/rfbeam/kld7/constants.rb +1 -1
- data/lib/rfbeam/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d9b598dd013b48a6c19e5755f4af6a687a1fd2b82ac2aaa3d38c3a8b98db2f8
|
4
|
+
data.tar.gz: d1bf6b228eb6c0cff37ae44a178c7eb9b1e80e033894d2ae2456e2882d6ac180
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 277a4e68325e439d64db8ffc1af15b5b1aeae5be8b9f9718100d6fd9cdd7bb228274c51a856960d775f8f3ecf041616e59b039acf22b029b990d4b5488793053
|
7
|
+
data.tar.gz: 54b6209b877a2304139c8ea615d9fe0437b3393ee75385c00735ffe24279d0940d29b061cf28f6fbe47cdd7c5a2b208aecffe97a49b266f2aa8fad751cf52ae2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
# Rfbeam
|
2
2
|
|
3
|
-

|
4
3
|

|
5
4
|

|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+

|
7
|
+

|
8
|
+

|
9
|
+
|
10
|
+
RfBeam is a simple, high-level interface and CLI for the RFBeam radar modules.
|
11
|
+
The user can query/set radar parameters, raw detection data and stream data from the sensor.
|
9
12
|
|
10
13
|
At this stage it only works on Linux and Mac with the K-LD7 module.
|
11
14
|
|
@@ -23,75 +26,90 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
23
26
|
|
24
27
|
The RfBeam class will return the path of any connected modules
|
25
28
|
|
26
|
-
|
29
|
+
```ruby
|
30
|
+
RfBeam.connected
|
31
|
+
=> ["/dev/ttyUSB0"]
|
32
|
+
```
|
27
33
|
|
28
|
-
Simple pass the path and baude rate to initialise a new radar object
|
34
|
+
Simple pass the path and optional baude rate (default: 115200) to initialise a new radar object
|
29
35
|
|
30
|
-
|
31
|
-
|
32
|
-
|
36
|
+
```ruby
|
37
|
+
RfBeam::KLD7.new("/dev/ttyUSB0") do |radar|
|
38
|
+
puts radar.config
|
39
|
+
end
|
40
|
+
=>
|
41
|
+
Software Version: K-LD7_APP-RFB-0103
|
42
|
+
Base Frequency: Low
|
43
|
+
Maximum Speed: 100km/h
|
44
|
+
Maximum Range: 100m
|
45
|
+
Threshold Offset: 30db
|
46
|
+
Tracking Filter Type: Long Visibility
|
47
|
+
Vibration Suppression: 16
|
48
|
+
Minimum Detection Distance: 0%
|
49
|
+
Maximum Detection Distance: 100%
|
50
|
+
Minimum Detection Angle: -10°
|
51
|
+
Maximum Detection Angle: 90°
|
52
|
+
Minimum Detection Speed: 0%
|
53
|
+
Maximum Detection Speed: 100%
|
54
|
+
Detection Direction: Both
|
55
|
+
Range Threshold: 10%
|
56
|
+
Angle Threshold: 0°
|
57
|
+
Speed Threshold: 50%
|
58
|
+
Digital Output 1: Direction
|
59
|
+
Digital Output 2: Angle
|
60
|
+
Digital Output 3: Range
|
61
|
+
Hold Time: 1s
|
62
|
+
Micro Detection Trigger: Off
|
63
|
+
Micro Detection Sensativity: 4
|
64
|
+
```
|
33
65
|
|
34
|
-
## RfBeam::
|
66
|
+
## RfBeam::KLD7 API
|
35
67
|
|
36
68
|
### detection?
|
37
69
|
|
38
70
|
Returns true if the module has a valid detection.
|
39
71
|
|
40
|
-
|
41
|
-
|
72
|
+
```ruby
|
73
|
+
radar.detection?
|
74
|
+
=> true
|
75
|
+
```
|
42
76
|
|
43
77
|
### ddat
|
44
78
|
|
45
79
|
Returns an array with the current detection values
|
46
80
|
|
47
|
-
|
48
|
-
|
81
|
+
```ruby
|
82
|
+
radar.ddat
|
83
|
+
=> ["DDAT", 6, 0, 0, 0, 0, 0, 0]
|
84
|
+
```
|
49
85
|
|
50
86
|
### tdat
|
51
87
|
|
52
88
|
Returns a hash with the current tracked object values
|
53
89
|
|
54
|
-
|
55
|
-
|
90
|
+
```ruby
|
91
|
+
radar.tdat
|
92
|
+
=> ["TDAT", 4, 68, 196, 469, 6303]
|
93
|
+
```
|
56
94
|
|
57
95
|
### grps
|
58
96
|
|
59
97
|
Returns the Parameter settings, values map to setting as detailed in the device datasheet.
|
60
98
|
|
61
|
-
|
62
|
-
|
99
|
+
```ruby
|
100
|
+
radar.grps
|
101
|
+
=> ["RPST", 42, "K-LD7_APP-RFB-0103", 1, 1, 1, 30, 0, 2, 0, 50, -90, 90, 0, 100, 2, 10, 0, 50, 0, 1, 2, 1, 0, 4]
|
102
|
+
```
|
63
103
|
|
64
104
|
### config
|
65
105
|
|
66
106
|
Returns a formatted String of all parameter settings. The only way to read parameter settings is with config
|
67
107
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
Maximum Range: 100m
|
74
|
-
Threshold Offset: 30db
|
75
|
-
Tracking Filter Type: Long Visibility
|
76
|
-
Vibration Suppression: 16
|
77
|
-
Minimum Detection Distance: 0%
|
78
|
-
Maximum Detection Distance: 100%
|
79
|
-
Minimum Detection Angle: -10°
|
80
|
-
Maximum Detection Angle: 90°
|
81
|
-
Minimum Detection Speed: 0%
|
82
|
-
Maximum Detection Speed: 100%
|
83
|
-
Detection Direction: Both
|
84
|
-
Range Threshold: 10%
|
85
|
-
Angle Threshold: 0°
|
86
|
-
Speed Threshold: 50%
|
87
|
-
Digital Output 1: Direction
|
88
|
-
Digital Output 2: Angle
|
89
|
-
Digital Output 3: Range
|
90
|
-
Hold Time: 1s
|
91
|
-
Micro Detection Trigger: Off
|
92
|
-
Micro Detection Sensativity: 4
|
93
|
-
|
94
|
-
## Parameter API
|
108
|
+
```ruby
|
109
|
+
radar.config
|
110
|
+
```
|
111
|
+
|
112
|
+
## Radar Parameters
|
95
113
|
|
96
114
|
### Base Frequency
|
97
115
|
|
@@ -315,7 +333,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
315
333
|
|
316
334
|
## Contributing
|
317
335
|
|
318
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
336
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/robcarruthers/rfbeam.
|
319
337
|
|
320
338
|
## License
|
321
339
|
|
data/lib/rfbeam/cli.rb
CHANGED
@@ -36,7 +36,7 @@ module RfBeam
|
|
36
36
|
|
37
37
|
desc 'set_param <radar_id> <key> <value>', 'Set radar parameters, see readme for keys'
|
38
38
|
def set_param(radar_id, param, value)
|
39
|
-
return @logger.warn("Invalid param: '#{param}'") unless
|
39
|
+
return @logger.warn("Invalid param: '#{param}'") unless Kld7::RADAR_PARAMETERS.include?(param.to_sym)
|
40
40
|
|
41
41
|
r = radar(radar_id)
|
42
42
|
r.send("#{param}=", value.to_i)
|
@@ -5,6 +5,17 @@ require 'tty-table'
|
|
5
5
|
module RfBeam
|
6
6
|
module Kld7
|
7
7
|
class CliFormatter
|
8
|
+
def format(type, data)
|
9
|
+
case type
|
10
|
+
when :tdat
|
11
|
+
tdat(data)
|
12
|
+
when :pdat
|
13
|
+
pdat(data)
|
14
|
+
when :ddat
|
15
|
+
ddat(data)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
8
19
|
def tdat(data)
|
9
20
|
{ dist: data[2], speed: data[3], angle: data[4], mag: data[5] }
|
10
21
|
end
|
@@ -20,20 +31,16 @@ module RfBeam
|
|
20
31
|
table
|
21
32
|
end
|
22
33
|
|
34
|
+
private
|
35
|
+
|
23
36
|
def ddat(data)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
.join("\n")
|
30
|
-
else
|
31
|
-
'DDAT: No Detection'
|
32
|
-
end
|
37
|
+
labels = ['Detection', 'Micro Detection', 'Angle', 'Direction', 'Range', 'Speed']
|
38
|
+
labels
|
39
|
+
.map
|
40
|
+
.with_index { |label, index| "#{label}: #{DETECTION_FLAGS[to_symbol(label)][data[index + 2]]}" }
|
41
|
+
.join("\n")
|
33
42
|
end
|
34
43
|
|
35
|
-
private
|
36
|
-
|
37
44
|
def to_symbol(string)
|
38
45
|
modified_string = string.gsub(' ', '_').downcase
|
39
46
|
modified_string.to_sym
|
data/lib/rfbeam/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfbeam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Carruthers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|