Collision avoidance is critical for real-world outdoor robots. Detection systems such as parking sensors are a possible candidate, but have limited range, and may not detect small, soft (ie sound absorbing) or pathologically shaped objects well.
Professional lidar systems such as those used in autonomous cars are many thousands of dollars, whereas the Lidar Lite (at $US150) and Benewake's TF Mini Lidar (at $US40) are cheap alternatives, but they need sweepers to make them detect in multiple directions. Sweepers such as the scanse are promising, but very expensive, and probably delicate.
So what can the impoverished hobbyist do at home?
The Sweeper V1 is just a LidarLite-V1 mounted on a stepper motor so it can swivel around. The Arduino repeatedly reads the lidar distance, sends the reading via serial port (USB actually) to the host, steps the motor by one position and repeats. If the reading fails (object too distant, object too black, looking into mirror etc) then the read call to the lidar seems to time-out, delaying the sweeper. Readings on the Lidar are from 1cm to 4000cm (up to 40m), and are sent as two-byte values.
Distance readings may need to be converted into Cartesian coordinates, depending on the logic of the navigator.
This is the easiest way to use the LidarLite for navigation - just mount the LidarLite so that it sweeps to left to right. To be useful in production it will need some way to synchronise. This could be a hard limit on the rotation, or could, in principle, synchronise to an object on the robot.
If this is used, eventually the continually twisting cables will make them break.
With still more work, a bearing and a belt-drive can provide an elegant and robust solution. This can be mounted on an outdoor robot, and survive a minor collision. If the dome gets scratched, then it can be replaced for a few dollars (it is a 4 inch security camera dome from eBay).
The bearing here is a bicycle bearing, which is small and robust.
Note, the four wires going between the Nano and the LidarLite go through a slip ring.
With a CNC, more things are possible - like printing your own gears.
A cheaper lidar also opens other possibilities - like scrapping the dome, and taking the risk of damaging and just replacing the (relative cheap) lidar in a collision.
Note, the four wires going between the Nano and the lidar go through a slip ring, but the RX wire is not actually connected to anything.
A preliminary test on a sheet of clear perspex (much cheaper than chomping through the lid of a $15 hobby box).
Arduino Nano in the foreground, the EasyDriver behind it. [Note this is a much thicker stepper motor than the one used in the final build].
And with the EasyDriver in the foreground. The BigEasyDriver is great for higher torque, but the smaller EasyDriver was great for this project.
Box | Jaycar | This case has an extra-high lid, and everything is actually mounted in the lid, not the base. | |
Stepper Motor | Interweb / bottom drawer | Salvaged from an old printer, but 17HS3430 (photographed) would work. | |
EasyDriver | Sparkfun | Stepper Motor Driver. The EasyDriver can run directly on 24V | |
Bearing | EBay / bike shop | A bicycle bearing is a good size for this. 'Press bearings' look like good candidates, but are trickier to work with. | |
Arduino Nano | EBay | Arduinos are better than Raspberry Pis at talking to 5V peripherals (like the EasyDriver), and doing repetitive grunt work to take the load of the Pi. | |
Slip Ring | EBay | Must have at least 4 wires for I2C connection to LidarLite. | |
Photo Interrupter | EBay / Jaycar | To synchronise the LidarLiteSweeper (ie to determine the direction). | |
Timing belt pulley | EBay / AliExpress | Goes on the shaft of the stepper motor. | |
Timing belt pulley | EBay / AliExpress | Big enough to fit the slip-ring into. | |
Timing Belt | EBay / AliExpress | Engages the two pulleys. |
Box | Jaycar | 115x90x55 WxDxH, and flanges on the base for mounting. | |
Stepper Motor | Interweb / bottom drawer | Short Body Nema 17 Stepper Motor Bipolar 1A 13Ncm/18.4oz.in 42x42x20mm 4-wires. This is thin stepper - rotating a turret doesn't require much torque. | |
EasyDriver | Sparkfun | Stepper Motor Driver. The EasyDriver can run directly on 24V | |
Bearing | EBay / bike shop | A bicycle bearing is a good size for this. 'Press bearings' look like good candidates, but are trickier to work with. | |
Arduino Nano | EBay | Arduinos are better than Raspberry Pis at talking to 5V peripherals (like the EasyDriver), and doing repetitive grunt work to take the load of the Pi. | |
Slip Ring | EBay | Must have at least 4 wires for I2C connection to LidarLite. | |
Photo Interrupter | EBay / Jaycar | To synchronise the LidarLiteSweeper (ie to determine the direction). | |
CNC parts | CNC Parts | Various parts made with a CNC. |
These stepper models have 200 steps per rotation (ie 1.8 degrees per step).
The spread of the lidar beam is about 2 degrees, so 1.8 degrees per step on the face of it seems a pretty good match. If it did one reading every 1.8 degrees, adjacent steps have a very small overlap, so even relatively small objects shouldn't be missed - especially the water taps in the yard, which can explode and cover equipment with salty (ie highly corrosive) bore water if struck by a heavy enough object (yes, it's happened).
While the LidarLite versions 2 and 3 claim to do 500 readings per second, the LidarLite V1 used in this project only does around 100 per second. With 200 steps per revolution, that's one complete scan every 2 seconds. This is good for a non-time-critical application like SLAM, but not so good for a collision avoidance on a fast rover.
The LidarLite sweeper code was written to move once per reading - and put up with the slow updates.
On the other hand, the TF Mini Lidar sweeper code was written to rotate at a constant rate, and return a value to the host whenever the lidar returned a reading. This will rotate as fast as required: better at avoiding large obstacles at higher speed, but risks miss small objects on the way (like water taps in the garden).
Building the lidar sweeper was a great deal of work. From 2017-01, Kickstarter Scanse can supply something faster, but possibly more fragile for $US349. This is tempting, but perhaps not the best option for the experimental hobby roboticist trying to convince the wife that 'this really is a cheap hobby, Dear'.
Remember that robots should crash sometimes (if they aren't crashing, your are not stretching the software capability envelope hard hard enough!). If the lidar is made of self-fabricated parts, they can be replaced when parts break. If even one part of the Scanse breaks, how can it be repaired?
If you are serious about running the robot around (and crashing it) - it makes sense to build one yourself out of replaceable parts.