Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Turns in a maze compounds angle errors


I have a zumo 32u4 robot, and I want to use it to solve a maze - ideally a micromouse maze.

I have removed the front blade and the front sensor array. Instead, I added 3 sensors (1 to detect distance in front, 1 to detect distance to the right and another one to detect distance to the left).

My question is how do I make my robot go relatively straight and make good turns ?
relatively straight to me would be to go in a straight line without bumping into the walls. This should not be an issue, as I can use the left and right sensor continously to detect the distance and if it gets too close, then move away.

Consider the following scenario:

The robot is an interserction and needs to turn right. If it is centered and perfectly looking straight ahead, then no issues, I can make the robot turn by rotating the motors for a certain amount of time.

However, it is the other scenario, which has me stumped. The robot is still at an intersection, but now it is not pefectly looking straight ahead - the robot is turned towards the right by 30 degrees. Now if I try to make a 90 degree turn on it, I would have turned too much. I really needed to turn 60 degrees. and of course vice-versa, i.e. if the robot is facing -30 degrees, then I need to the robot to turn 120 degrees.

All these errors in the turning angles add up very quickly, as you navigate the maze.

One thought of mine is that I should have multiple front sensors to detect if I am perfect straight - I am pretty sure I am missing something very basic here.

help me guys !



I suspect there are a lot of ways you could try solving that issue. Using two forward facing sensors, as you mentioned, to estimate the angle of the wall in front of the robot is a good idea. In addition, using the distance from the walls on the right and left to help the robot straighten out on longer stretches could be helpful. You might also be able to keep track of the direction the robot is facing with the IMU (mainly the gyro) or the encoders (though slip might make the encoders impractical).