3pi maze program - is turning too far left & then messing up

I’m having trouble with the maze solver program example. I’m cleaning the wheels, but in certain spots, when it needs to turn left, it turns just a little too far for some reason, and then moves forward an inch or so, and then starts spinning, turning, etc. back & forth, & is totally messed up. The line following works fine - no problems - but it’s the maze program that’s having this specific issue. Any idea why? It turns right perfectly - it’s just when turning left. And only in a couple of places on the maze (usually, but not always, at the same couple of places.)

I am cleaning the wheels with Isopropyl Alcohol before the run.

When you make the maze, is it okay to have the tape overlap, or are you supposed to have each piece of tape perfectly butt up against the next piece, without overlapping and creating a bump? I’m wondering if the sensors could be thrown off by the bumps, as the tape is shiny. I’ve read the entire forum, and have not found anything that I can think might be causing this issue, or seen anyone else mention this, unless I missed it somewhere.

I am using the sample maze solving program, with no modifications at all.

Any help will be greatly appreciated.

Thanks so much!

Hi.

I am sorry that you are having trouble getting your 3pi to solve mazes. I am not sure, but I do not think that the overlapping tape would cause that kind of problem. What material is your maze made of? Could you post a picture of it? Have you checked to make sure that each of the 3pi’s sensors are working? An easy way to do that is to use the sensors demo from the 3pi demo program, and verify that the bar graph shown for each sensor changes as you would expect when it is scanned over one of the lines in your maze.

-Claire

The stock sample maze solving program did not work for me either. The only way I have gotten it to work is by making modifications to the program.

Thanks Claire for getting back with me.

I have carefully checked the sensors as you recommended - all 5 are working great.

Here is a photo of the maze.

I will really appreciate any other suggestions you might have. I have studied the 3pi movements even more carefully, and what’s happening (only when it turns to the left) is it turns a little TOO FAR, and when it starts moving, once in a while it does not correct it’s path to get back going perfectly straight on the line. Then in about an inch or two, it starts turning & moving very erratically.

Thanks for any help you can give me.

(And thanks mr.roboto for your comment. That’s very interesting. I don’t know the language yet, and hope I don’t have to learn it to get this to work, but that may have to happen.)


Thanks for posting the picture. The 3pi’s line following and maze solving programs are only meant to be examples that can be adjusted and built upon, so I would not expect them to work perfectly for every situation without any modifications. In addition, the 3pi is meant to be a user programmable platform, so to get the most out of it you will have to do some programming.

Since your robot is turning too far to the left, a simple adjustment to the code you could try is to slightly reduce the delay in the “turn left” section of turn.c. That should cause the robot to not turn quite as far.

/*
 * Code to perform various types of turns.  The delays here had to be
 * calibrated for the 3pi's motors.
 */

#include <pololu/3pi.h>

// Turns according to the parameter dir, which should be 'L', 'R', 'S'
// (straight), or 'B' (back).
void turn(char dir)
{
	switch(dir)
	{
	case 'L':
		// Turn left.
		set_motors(-80,80);
		delay_ms(200);
		break;
	case 'R':
		// Turn right.
		set_motors(80,-80);
		delay_ms(200);
		break;
	case 'B':
		// Turn around.
		set_motors(80,-80);
		delay_ms(400);
		break;
	case 'S':
		// Don't do anything!
		break;
	}
}

-Claire

Thanks Claire,
I’ll give that a try. I appreciate your suggestion. You are right, of course, I just haven’t taken the time to learn the language yet.