Pi Wars

Overthinking Ultrasonics

In Programming the ultrasonics to work with mecanum wheels for the autonomous ‘The Canyons of Mars’ challenge (a maze), we overthought the process. The mecanum wheels – by allowing the robot to strafe – simplified the code significantly as we no longer needed to calculate turn angles at the corners. Thus, we invested more time into making the logic behind the Ultrasonic sensors as fast and efficient as possible. It was a mistake.

What we had forgotten to take into account was that, even though the mecanum wheels increased our manoeuvrability, they would still be limited by the inaccuracies and slowness of ultrasonic sensors. This meant our early experiments resulted in the robot strafing too early due to a (annoyingly rather common) anomalous spike in the readings from time to time – the Ultrasonic script was too efficient for its own good, being far too sensitive and resulting in minor blips in the ultrasonic readings leading to the robot quite literally going in circles.

Thankfully, after using print statements everywhere to debug our script step by step, we eventually managed to calibrate the sensitivity in such a way that it only took a turn when the values had stabilized – i.e. stopping at each corner to give the sensors time to catch up etc.

Next year we will definitely be investing in infrared proximity sensors (far more accurate) to allow fast and smooth movements around autonomous challenges.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.