rfbeam 0.4.9 → 0.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +57 -42
- data/lib/rfbeam/cli.rb +1 -1
- data/lib/rfbeam/kld7/cli_formatter.rb +25 -25
- 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
@@ -26,75 +26,90 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
26
26
|
|
27
27
|
The RfBeam class will return the path of any connected modules
|
28
28
|
|
29
|
-
|
29
|
+
```ruby
|
30
|
+
RfBeam.connected
|
31
|
+
=> ["/dev/ttyUSB0"]
|
32
|
+
```
|
30
33
|
|
31
|
-
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
|
32
35
|
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
+
```
|
36
65
|
|
37
|
-
## RfBeam::
|
66
|
+
## RfBeam::KLD7 API
|
38
67
|
|
39
68
|
### detection?
|
40
69
|
|
41
70
|
Returns true if the module has a valid detection.
|
42
71
|
|
43
|
-
|
44
|
-
|
72
|
+
```ruby
|
73
|
+
radar.detection?
|
74
|
+
=> true
|
75
|
+
```
|
45
76
|
|
46
77
|
### ddat
|
47
78
|
|
48
79
|
Returns an array with the current detection values
|
49
80
|
|
50
|
-
|
51
|
-
|
81
|
+
```ruby
|
82
|
+
radar.ddat
|
83
|
+
=> ["DDAT", 6, 0, 0, 0, 0, 0, 0]
|
84
|
+
```
|
52
85
|
|
53
86
|
### tdat
|
54
87
|
|
55
88
|
Returns a hash with the current tracked object values
|
56
89
|
|
57
|
-
|
58
|
-
|
90
|
+
```ruby
|
91
|
+
radar.tdat
|
92
|
+
=> ["TDAT", 4, 68, 196, 469, 6303]
|
93
|
+
```
|
59
94
|
|
60
95
|
### grps
|
61
96
|
|
62
97
|
Returns the Parameter settings, values map to setting as detailed in the device datasheet.
|
63
98
|
|
64
|
-
|
65
|
-
|
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
|
+
```
|
66
103
|
|
67
104
|
### config
|
68
105
|
|
69
106
|
Returns a formatted String of all parameter settings. The only way to read parameter settings is with config
|
70
107
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
Maximum Range: 100m
|
77
|
-
Threshold Offset: 30db
|
78
|
-
Tracking Filter Type: Long Visibility
|
79
|
-
Vibration Suppression: 16
|
80
|
-
Minimum Detection Distance: 0%
|
81
|
-
Maximum Detection Distance: 100%
|
82
|
-
Minimum Detection Angle: -10°
|
83
|
-
Maximum Detection Angle: 90°
|
84
|
-
Minimum Detection Speed: 0%
|
85
|
-
Maximum Detection Speed: 100%
|
86
|
-
Detection Direction: Both
|
87
|
-
Range Threshold: 10%
|
88
|
-
Angle Threshold: 0°
|
89
|
-
Speed Threshold: 50%
|
90
|
-
Digital Output 1: Direction
|
91
|
-
Digital Output 2: Angle
|
92
|
-
Digital Output 3: Range
|
93
|
-
Hold Time: 1s
|
94
|
-
Micro Detection Trigger: Off
|
95
|
-
Micro Detection Sensativity: 4
|
96
|
-
|
97
|
-
## Parameter API
|
108
|
+
```ruby
|
109
|
+
radar.config
|
110
|
+
```
|
111
|
+
|
112
|
+
## Radar Parameters
|
98
113
|
|
99
114
|
### Base Frequency
|
100
115
|
|
@@ -318,7 +333,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
318
333
|
|
319
334
|
## Contributing
|
320
335
|
|
321
|
-
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.
|
322
337
|
|
323
338
|
## License
|
324
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)
|
@@ -10,41 +10,41 @@ module RfBeam
|
|
10
10
|
when :tdat
|
11
11
|
tdat(data)
|
12
12
|
when :pdat
|
13
|
-
|
13
|
+
pdat(data)
|
14
14
|
when :ddat
|
15
15
|
ddat(data)
|
16
16
|
end
|
17
17
|
end
|
18
|
-
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
def tdat(data)
|
20
|
+
{ dist: data[2], speed: data[3], angle: data[4], mag: data[5] }
|
21
|
+
end
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
def pdat_table(data)
|
24
|
+
table = TTY::Table.new header: ['index', 'dist (M)', 'speed (Km/h)', 'angle (°)', 'mag (db)']
|
25
|
+
count = data[1] / 8
|
26
|
+
data.shift(2)
|
27
|
+
count.times do |index|
|
28
|
+
values = data.shift(4).map { |value| value.to_f / 100.0 }
|
29
|
+
table << [index, values].flatten
|
30
|
+
end
|
31
|
+
table
|
31
32
|
end
|
32
|
-
table
|
33
|
-
end
|
34
33
|
|
35
|
-
|
34
|
+
private
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
36
|
+
def ddat(data)
|
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")
|
42
|
+
end
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
def to_symbol(string)
|
45
|
+
modified_string = string.gsub(' ', '_').downcase
|
46
|
+
modified_string.to_sym
|
47
|
+
end
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
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
|