rfbeam 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -2
- data/README.md +71 -15
- data/lib/rfbeam/kld7/device_data.rb +26 -0
- data/lib/rfbeam/kld7/parameters.rb +57 -0
- data/lib/rfbeam/version.rb +1 -1
- data/lib/rfbeam.rb +12 -11
- data/node_modules/.yarn-integrity +3 -3
- data/node_modules/@prettier/plugin-ruby/node_modules/.bin/prettier +1 -1
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/LICENSE +5945 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/README.md +109 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/bin-prettier.js +62 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/cli.js +15136 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/doc.js +1473 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-angular.mjs +2 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-babel.mjs +29 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-espree.mjs +26 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-flow.mjs +35 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-glimmer.mjs +27 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-graphql.mjs +15 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-html.mjs +36 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-markdown.mjs +76 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-meriyah.mjs +19 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-postcss.mjs +76 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-typescript.mjs +257 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/parser-yaml.mjs +150 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/esm/standalone.mjs +116 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/index.js +37885 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/package.json +21 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-angular.js +2 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-babel.js +29 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-espree.js +26 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-flow.js +35 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-glimmer.js +27 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-graphql.js +15 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-html.js +36 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-markdown.js +76 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-meriyah.js +19 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-postcss.js +76 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-typescript.js +257 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/parser-yaml.js +150 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/standalone.js +116 -0
- data/node_modules/@prettier/plugin-ruby/node_modules/prettier/third-party.js +8978 -0
- data/node_modules/prettier/LICENSE +85 -60
- data/node_modules/prettier/README.md +3 -3
- data/node_modules/prettier/bin-prettier.js +3 -1
- data/node_modules/prettier/cli.js +414 -186
- data/node_modules/prettier/esm/parser-angular.mjs +1 -1
- data/node_modules/prettier/esm/parser-babel.mjs +21 -21
- data/node_modules/prettier/esm/parser-espree.mjs +20 -20
- data/node_modules/prettier/esm/parser-flow.mjs +26 -26
- data/node_modules/prettier/esm/parser-glimmer.mjs +4 -4
- data/node_modules/prettier/esm/parser-graphql.mjs +1 -1
- data/node_modules/prettier/esm/parser-html.mjs +16 -16
- data/node_modules/prettier/esm/parser-markdown.mjs +48 -48
- data/node_modules/prettier/esm/parser-meriyah.mjs +14 -14
- data/node_modules/prettier/esm/parser-postcss.mjs +57 -57
- data/node_modules/prettier/esm/parser-typescript.mjs +40 -248
- data/node_modules/prettier/esm/parser-yaml.mjs +13 -13
- data/node_modules/prettier/esm/standalone.mjs +77 -77
- data/node_modules/prettier/index.js +693 -342
- data/node_modules/prettier/package.json +1 -1
- data/node_modules/prettier/parser-babel.js +21 -21
- data/node_modules/prettier/parser-espree.js +20 -20
- data/node_modules/prettier/parser-flow.js +26 -26
- data/node_modules/prettier/parser-glimmer.js +3 -3
- data/node_modules/prettier/parser-html.js +20 -20
- data/node_modules/prettier/parser-markdown.js +47 -47
- data/node_modules/prettier/parser-meriyah.js +13 -13
- data/node_modules/prettier/parser-postcss.js +56 -56
- data/node_modules/prettier/parser-typescript.js +40 -248
- data/node_modules/prettier/parser-yaml.js +13 -13
- data/node_modules/prettier/standalone.js +73 -73
- data/node_modules/prettier/third-party.js +5 -5
- data/package.json +1 -1
- data/yarn.lock +6 -1
- metadata +37 -3
- data/rfbeam-0.2.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3701d190afa17ff597b95c3828f53ced876634450c2a8185ef6204e003de988
|
4
|
+
data.tar.gz: ad3393070257497505ece77149306e91e2cf42bbdbce896912c03d78ff230a3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e3e93de85a88b87f113f58f28d8ec43378b12576f0ce4676cbe62713d718dd4f690c7e9070619801417b60fcd36afe58d229f31f72a652f95515df43b16248e
|
7
|
+
data.tar.gz: 968916b79ace6eb9fe531c0d3386fec3ea27725d87cc2fa0f74a893f2a0829e2ac296aee418e5bfaf37d47f7b4680ba4d3d227a70002220899547647b296eabc
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rfbeam (0.
|
4
|
+
rfbeam (0.3.0)
|
5
5
|
activesupport (~> 6.1.0)
|
6
6
|
rubyserial (~> 0.6.0)
|
7
7
|
thor (~> 1.2.1)
|
@@ -51,6 +51,7 @@ GEM
|
|
51
51
|
zeitwerk (2.6.6)
|
52
52
|
|
53
53
|
PLATFORMS
|
54
|
+
aarch64-linux
|
54
55
|
arm64-darwin-21
|
55
56
|
|
56
57
|
DEPENDENCIES
|
@@ -60,4 +61,4 @@ DEPENDENCIES
|
|
60
61
|
rubocop (~> 1.21)
|
61
62
|
|
62
63
|
BUNDLED WITH
|
63
|
-
2.
|
64
|
+
2.4.10
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# Rfbeam
|
2
2
|
|
3
|
-
|
3
|
+
RfBeam is a simple, high-level interface to the RFBeam radar modules.
|
4
|
+
The user can read and set the radar parameters and fetch raw or processed data frames from the sensor.
|
4
5
|
|
5
|
-
|
6
|
+
At this stage it only works on Linux and Mac with the K-LD7 module.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -16,19 +17,74 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
16
17
|
|
17
18
|
## Usage
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
20
|
+
The RfBeam class will return the path of any connected modules
|
21
|
+
|
22
|
+
RfBeam.connected
|
23
|
+
|
24
|
+
Simple pass the path and baude rate to initialise a new radar object
|
25
|
+
|
26
|
+
RfBeam::K_ld7.new("/dev/ttyUSB0", 115200) do |radar|
|
27
|
+
puts radar.config
|
28
|
+
end
|
29
|
+
|
30
|
+
## RfBeam::K_ld7 API
|
31
|
+
|
32
|
+
### detection?
|
33
|
+
|
34
|
+
Returns true if the module has a valid detection.
|
35
|
+
|
36
|
+
radar.detection?
|
37
|
+
=> true
|
38
|
+
|
39
|
+
### ddat
|
40
|
+
|
41
|
+
Returns an array with the current detection values
|
42
|
+
|
43
|
+
radar.ddat
|
44
|
+
=> ["DDAT", 6, 0, 0, 0, 0, 0, 0]
|
45
|
+
|
46
|
+
### tdat
|
47
|
+
|
48
|
+
Returns a hash with the current tracked object values
|
49
|
+
|
50
|
+
radar.tdat
|
51
|
+
=> {:dist=>68, :speed=>196, :angle=>469, :mag=>6303}
|
52
|
+
|
53
|
+
### grps
|
54
|
+
|
55
|
+
Returns the Parameter settings, values map to setting as detailed in the device datasheet.
|
56
|
+
|
57
|
+
radar.grps
|
58
|
+
=> ["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]
|
59
|
+
|
60
|
+
### config
|
61
|
+
|
62
|
+
Returns a formatted String of all parameter settings
|
63
|
+
|
64
|
+
radar.config
|
65
|
+
|
66
|
+
Software Version: K-LD7_APP-RFB-0103
|
67
|
+
Base Frequency: Middle
|
68
|
+
Max Speed: 25km/h
|
69
|
+
Max Range: 10m
|
70
|
+
Threshold offset: 30db
|
71
|
+
Tracking Filter Type: standard
|
72
|
+
Vibration Suppression: 2 , (0-16, 0 = No Suppression, 16 = High Suppression)
|
73
|
+
Minimum Detection Distance: 0 , (0 - 100% of range setting)
|
74
|
+
Maximum Detection Distance: 50 , (0 - 100% of range setting)
|
75
|
+
Minimum Detection Angle: -90° , (-90° - 90°)
|
76
|
+
Maximum Detection Angle: 90° , (0 - 100% of range setting)
|
77
|
+
Maximum Detection Speed: 0 , (0 - 100% of speed setting)
|
78
|
+
Maximum Detection Speed: 100 , (0 - 100% of speed setting)
|
79
|
+
Detection Direction: 2Range Threshold: 10%, (0 - 100% of range setting)
|
80
|
+
Angle Threshold: 0°, (-90° - 90°)
|
81
|
+
Speed Threshold: 50%, (0 - 100% of speed setting)
|
82
|
+
Digital output 1: Direction
|
83
|
+
Digital output 2: Angle
|
84
|
+
Digital output 3: Range
|
85
|
+
Hold time: 1sec
|
86
|
+
Micro Detection Retrigger: Off
|
87
|
+
Micro Detection Sensitivity: 4 (0 - 9, 0 = Min, 9 = Max)
|
32
88
|
|
33
89
|
## Development
|
34
90
|
|
@@ -29,5 +29,31 @@ module RfBeam
|
|
29
29
|
range: %w[Far Near],
|
30
30
|
speed: %w[Low High],
|
31
31
|
}
|
32
|
+
|
33
|
+
# GRPS - Parameter structture, used to map return values to readable strings
|
34
|
+
PARAMETER_STRUCTURE = {
|
35
|
+
base_frequency: ['Low', 'Middle', 'High'],
|
36
|
+
max_speed: ['12.5km/h', '25km/h', '50km/h', '100km/h'],
|
37
|
+
max_range: %w[5m 10m 30m 100m],
|
38
|
+
threshold_offset: '10db - 60db',
|
39
|
+
tracking_filter_type: ['standard', 'Fast Detection', 'Long Visibility'],
|
40
|
+
vibration_suppression: '0-16, 0 = No Suppression, 16 = High Suppression',
|
41
|
+
min_detection_distance: '0 - 100% of range setting',
|
42
|
+
max_detection_distance: '0 - 100% of range setting',
|
43
|
+
min_detection_angle: '-90° - 90°',
|
44
|
+
max_detection_angle: '-90° - 90°',
|
45
|
+
min_detection_speed: '0 - 100% of speed setting',
|
46
|
+
max_detection_speed: '0 - 100% of speed setting',
|
47
|
+
detection_direction: %w[receding approaching both],
|
48
|
+
range_threshold: '0 - 100% of range setting',
|
49
|
+
angle_threshold: '-90° - 90°',
|
50
|
+
speed_threshold: '0 - 100% of speed setting',
|
51
|
+
digital_output_1: %w[Direction Angle Range Speed Micro],
|
52
|
+
digital_output_2: %w[Direction Angle Range Speed Micro],
|
53
|
+
digital_output_3: %w[Direction Angle Range Speed Micro],
|
54
|
+
hold_time: '1 - 7200s',
|
55
|
+
micro_detection_trigger: %w[Off Retrigger],
|
56
|
+
micro_detection_sensitivity: '0 - 9, 0 = Min, 9 = Max'
|
57
|
+
}
|
32
58
|
end
|
33
59
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module RfBeam
|
2
|
+
module KLD7
|
3
|
+
def detection?
|
4
|
+
data = ddat
|
5
|
+
(data[2] == 1)
|
6
|
+
end
|
7
|
+
|
8
|
+
def grps
|
9
|
+
command = ['GRPS', 0]
|
10
|
+
write command.pack('a4L')
|
11
|
+
check_response
|
12
|
+
resp = read(50).unpack('a4LA19C8c2C4cCCCCSCC')
|
13
|
+
resp
|
14
|
+
end
|
15
|
+
|
16
|
+
def config
|
17
|
+
puts formatted_grps(grps)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def formatted_grps(data)
|
23
|
+
output = "\n"
|
24
|
+
output << "Software Version: #{data[2]}\n"
|
25
|
+
output << "Base Frequency: #{PARAMETER_STRUCTURE[:base_frequency][data[3]]}\n"
|
26
|
+
output << "Max Speed: #{PARAMETER_STRUCTURE[:max_speed][data[4]]}\n"
|
27
|
+
output << "Max Range: #{PARAMETER_STRUCTURE[:max_range][data[5]]}\n"
|
28
|
+
output << "Threshold offset: #{data[6]}db\n"
|
29
|
+
output << "Tracking Filter Type: #{PARAMETER_STRUCTURE[:tracking_filter_type][data[7]]}\n"
|
30
|
+
output << "Vibration Suppression: #{data[8]} , (#{PARAMETER_STRUCTURE[:vibration_suppression]})\n"
|
31
|
+
output << "Minimum Detection Distance: #{data[9]} , (#{PARAMETER_STRUCTURE[:min_detection_distance]})\n"
|
32
|
+
output << "Maximum Detection Distance: #{data[10]} , (#{PARAMETER_STRUCTURE[:max_detection_distance]})\n"
|
33
|
+
output << "Minimum Detection Angle: #{data[11]}° , (#{PARAMETER_STRUCTURE[:min_detection_angle]})\n"
|
34
|
+
output << "Maximum Detection Angle: #{data[12]}° , (#{PARAMETER_STRUCTURE[:max_detection_distance]})\n"
|
35
|
+
output << "Maximum Detection Speed: #{data[13]} , (#{PARAMETER_STRUCTURE[:min_detection_speed]})\n"
|
36
|
+
output << "Maximum Detection Speed: #{data[14]} , (#{PARAMETER_STRUCTURE[:max_detection_speed]})\n"
|
37
|
+
output << "Detection Direction: #{data[15]}"
|
38
|
+
output << "Range Threshold: #{data[16]}%, (#{PARAMETER_STRUCTURE[:range_threshold]})\n"
|
39
|
+
output << "Angle Threshold: #{data[17]}°, (#{PARAMETER_STRUCTURE[:angle_threshold]})\n"
|
40
|
+
output << "Speed Threshold: #{data[18]}%, (#{PARAMETER_STRUCTURE[:speed_threshold]})\n"
|
41
|
+
output << "Digital output 1: #{PARAMETER_STRUCTURE[:digital_output_1][data[19]]}\n"
|
42
|
+
output << "Digital output 2: #{PARAMETER_STRUCTURE[:digital_output_2][data[20]]}\n"
|
43
|
+
output << "Digital output 3: #{PARAMETER_STRUCTURE[:digital_output_3][data[21]]}\n"
|
44
|
+
output << "Hold time: #{data[22]}sec\n"
|
45
|
+
output << "Micro Detection Retrigger: #{PARAMETER_STRUCTURE[:micro_detection_trigger][data[23]]}\n"
|
46
|
+
output << "Micro Detection Sensitivity: #{data[24]} (#{PARAMETER_STRUCTURE[:micro_detection_sensitivity]})"
|
47
|
+
|
48
|
+
output
|
49
|
+
end
|
50
|
+
|
51
|
+
def request_parameter_data
|
52
|
+
command = ['GRPS', 0]
|
53
|
+
write command.pack('a4L')
|
54
|
+
check_response
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/rfbeam/version.rb
CHANGED
data/lib/rfbeam.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'rfbeam/kld7/commands'
|
4
4
|
require 'rfbeam/kld7/detection'
|
5
|
+
require 'rfbeam/kld7/parameters'
|
5
6
|
require 'rfbeam/kld7/device_data'
|
6
7
|
require_relative 'rfbeam/version'
|
7
8
|
|
@@ -13,16 +14,16 @@ module RfBeam
|
|
13
14
|
include RfBeam::KLD7
|
14
15
|
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
def self.connected
|
18
|
+
path_str, dir =
|
19
|
+
if RubySerial::ON_LINUX
|
20
|
+
%w[ttyUSB /dev/]
|
21
|
+
elsif RubySerial::ON_WINDOWS
|
22
|
+
['TODO: Implement find device for Windows', 'You lazy bugger']
|
23
|
+
else
|
24
|
+
%w[tty.usbserial /dev/]
|
25
|
+
end
|
26
|
+
|
27
|
+
Dir.glob("#{dir}#{path_str}*")
|
27
28
|
end
|
28
29
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"systemParams": "
|
2
|
+
"systemParams": "linux-arm64-108",
|
3
3
|
"modulesFolders": [
|
4
4
|
"node_modules"
|
5
5
|
],
|
@@ -7,12 +7,12 @@
|
|
7
7
|
"linkedModules": [],
|
8
8
|
"topLevelPatterns": [
|
9
9
|
"@prettier/plugin-ruby@^3.2.2",
|
10
|
-
"prettier@^2.8.
|
10
|
+
"prettier@^2.8.7"
|
11
11
|
],
|
12
12
|
"lockfileEntries": {
|
13
13
|
"@prettier/plugin-ruby@^3.2.2": "https://registry.yarnpkg.com/@prettier/plugin-ruby/-/plugin-ruby-3.2.2.tgz#43c9d85349032f74d34c4f57e6a77487d5c5bdc1",
|
14
14
|
"prettier@>=2.3.0": "https://registry.yarnpkg.com/prettier/-/prettier-2.8.0.tgz#c7df58393c9ba77d6fba3921ae01faf994fb9dc9",
|
15
|
-
"prettier@^2.8.
|
15
|
+
"prettier@^2.8.7": "https://registry.yarnpkg.com/prettier/-/prettier-2.8.7.tgz#bb79fc8729308549d28fe3a98fce73d2c0656450"
|
16
16
|
},
|
17
17
|
"files": [],
|
18
18
|
"artifacts": {}
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
../prettier/bin-prettier.js
|