pibeacon: 21 - RD-Lidar sensor

Posted on
Sun Nov 17, 2019 6:43 pm
kw123 offline
User avatar
Posts: 6824
Joined: May 12, 2013
Location: Dallas, TX

pibeacon: 21 - RD-Lidar sensor

The plugin supports RD-Lidar sensors.
These sensors have a rotating laser that measures distance through the reflected light. One value every ~1º (called dots her)
The distance measured is in one plane.
The readout is through a serial port / USB

YOU need to add the RD-lidar sensor type = Slamtec RPLIDAR A2 2D 360, the type A1 also works
Connect a GOOD usb micro cable between RPI (should be 3 or better) and the RDlidar sensor.
Add the external power supply for the A2 - it needs 1.5Amps to start.

Create an indigo piBeacon - rdlidar device, leave the parameters at the default values, you can play around with them when it works.

There are 4 sections in indigo device edit:
1. general sensor setup:
- Motor frequency = number of full 360º measurements per second 3 Hz seems to work well;
- # of dots to combine into one. -- Experience shows that 2 dots combined into one reduces noise and low quality signal measurement that result in a zero value.
- # of repeat measurement to set empty room values (value@angle)
- send pixel data to plugin.. only needed when you want to make an image
- min delta between sending data to indigo, save guard to oversell indigo
- update indigo at least every x Sec.. (opposite of the one above)
2. trigger parameters:
- how many contiguous (N) dots must be different by Z from previous dots (last x measurements) at the same angle
- same for current vs the "empty" room calibration dots.
3. image parameters: (xmin/max, # of points, you can rotate the image, colors of dots, legend on/off, frame on/off, create image for every dataset or only for "events" etc
4. other: save measurement into indigo properties(not used yet)and which state to show in Status/ Sensor value

You can request an "empty" room calibration through an action or menu.
The calibration will do several measurements (360º full scans) and store the average info (for each dot) on the RPI SSD, re-read at startup of the RPI.

Event definitions;
1. Presence in room: One or more sections of values of dots (contiguous data points) are lower (=shorter distance to the sensor) than those from the empty room = something > Z is closer to the sensor. If you sit in the room there should be a permanent difference to the empty room. No movement needed.
2. re-calibration needed: a section is further away from the sensor than in the empty room. As that indicates a change in the room structure a recalibration is "suggested"
3. approaching: in current measurement a section of dots are CLOSER to the sensor than in the last measurement. That indicates a quick change (< 1 second) = active movement
4. leaving: in current measurement a section of dots are FURTHER AWAY from the sensor than in the last measurement, Also indicates a movement < 1 second.
... #3 and #4 can happen at the same time while walking across the room or waving with your hands.

You could trigger on values > 0 to indicate movement or presence.

The triggers are depending on the device settings:
-- N#: of contiguous dots to form a "section".
--Z: The delta of the values current-previous and current-Empty_room must be > Z to qualify for a moved section.
Those 2 parameters (N,Z) define the tigger thresholds for both empty and current vs last.
Once a delta value of the dots (current-last) < Z the segment stops.
The values shown in the device states are the number of dots in the section(s) that qualify(delta > Z) .
Screen Shot 2019-11-24 at 16.36.04.png
Screen Shot 2019-11-24 at 16.36.04.png (52.08 KiB) Viewed 458 times


The areas with no change have red/green/blue lines close to each other -no distinct different pattern is visible:
One section is further away, the other is closer: moved a chair by 2 meters
As show there can be several segments for each type (here 3).
Where the green line is further away there is an object closer to the sensor (current & last) the opposite where the green line is closer.
The red < show where movement is detected , moved closer a > would indicate a move away = leaving
Screen Shot 2019-11-24 at 16.51.20.png
Screen Shot 2019-11-24 at 16.51.20.png (282.49 KiB) Viewed 458 times

when the sensor is rotated after calibration. You can clearly see the green line is rotated by ~ 20 degrees compared to the current values - or visa versa
Screen Shot 2019-11-24 at 19.30.58.png
Screen Shot 2019-11-24 at 19.30.58.png (367.09 KiB) Viewed 455 times

Karl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest