Friday, 15 March 2019

PiWars: Planning for the Autonomous challenges

In previous PiWars I've not done so great on the autonomous side of things, so this year I'm looking to do better (Which, of course, I also said last time). For the 2019 competition there are three autonomous challenges, The Hubble Telescope Nebula ChallengeThe Canyons of Mars and Blast Off: the Straight-ish Line Speed Test.

Of these challenges the only one I've attempted before at PiWars is 'Blast Off', utilising a line following sensor to stay on course. The challenge is a little trickier this time as its no longer a straight run, I'm guessing so the competing robots can't just zoom straight ahead, but actually have to track and follow the line (Or detect the walls).

Reading through the challenges Wall-E will need to be able to detect when he's close to a wall, check for colours (four colours for the Nebula, green alien faces for Mars) and track a line on the floor. So in theory a combination of a camera (With OpenCV for processing) and a distance sensor should be able to cover these combinations.

For the camera I'll be going with one that connects to the Raspberry Pi's camera port. This should ensure maximum performance and compatibility, along with enabling all the hardware image processing that the Raspberry Pi supports.

A tiny camera!

For distance sensors the choice tends to be between ultrasonic and laser based modules. With the former being sound based, and less likely to be affected by the strong sunlight that often lights up the PiWars courses, and the later being light based and generally more accurate. Whilst I already own both, and the accuracy for these challenges doesn't have to be that precise, the ultrasonic sensors do require a lot of space to install.
A little too bulky.
As one of my aims is keeping modifications to Wall-E's chassis to a minimum I've decided to go with a laser based sensor, specifically the VL53L1X ToF sensor from Pimoroni. Its designed to work with a Raspberry Pi, so I don't have to worry about voltage conversions, and is compact enough to fit into one of the side pods in Wall-E's base.

Much smaller!
Whilst a laser conjures images of a straight line of light, the ToF sensor actually have a field of view of over 20 degrees. So when I first lined up and installed the laser in Wall-E I was constantly getting short distances reported, due to the laser light reflecting off the underside of Wall-E. This, of course, meant moving the laser down lower, so Wall-E ended up with an extra hole in his front. Perhaps I should have done a little more testing of positions before drilling holes, but it was kind of an awkward location to get to from outside.

The laser sensor installed low and out of sight.
Whilst the sensor and camera are installed and connected they won't do anything without some software to control them, which we'll get to next time!