How to solve grids

hi ,

am preparing for a competiton which involves line grids and the robot should move on the line grid in the path which is specified by the organizer and the rules are as follows

  1. the robot must move along the path which is priorly given to the participants… by the organizer 15 minutes before the event.
  1. time is a factor… faster the completion more points.

am using a 3pi robot for this event.
although am aware of the maze solving… technique used in 3pi…but i dont know how to start up for this event(grid solving in specified path but not a random solution to the grid in shortest or possible paths to solve the same grid)…
so my questions are how to make the robot know what we want it do like store the path in memory and execute it …
and i dont know how to carry out this operation …although some functions of maze solving can be used but how to make the robot know the grid path to be moved…

please help me with some functions and coding examples to carry out this
ill put together the rest of the code…

any help will be highly appreciated,


Does the grid have uniformly spaced intersections? Is it a maze or a complete grid? Is the grid marked by lines on the ground?

- Ryan

hello ryan,

its a line grid but but the dimensions are not told its kept a secret till the competition day and its not a maze type its a grid made of x/y black tape on a white background …
it could be a square grid
the grid would look as in the pic below and its a complete grid with no floating lines any where not even at the start
and end points…and the bot should travel on the line in the path specified by the organizer on the competition.

may be this video helps…you

thank u,

That makes it a lot more clear what is going on. You should just be able to translate the coordinates given by the contest judge into a sequence of left, right and straight turns and just use the maze solver code for completing the maze after it knows the simplified path.

- Ryan

yes i got u but i still have a doubt on how to translate the coordinates into a path like(SSLR…etc) maybe a coding example will help me a lot so that i can put the code together …may be a function or a small example code on how to translate the coordinates…

thank you,

Okay, call where you start the origin of an X, Y graph. If you are pointed in the positive Y direction when you start and you need to get to 8,5 your path would be “8SR5S”. If you started pointing the positive X direction, it would be “5SL8S”.

Do you see how to write a function that generates that kind of path?

- Ryan

sry for my inability ,

actually i didnt understand that part well enough …
lets say i want to reach 1,1 on the grid there are 2 paths from positive x and positive y so ,if i start from origin ,if the organizer states i have to go only from positive x then how to make a function to store a path…which i know but the robot doesnt know here am not using any maze solving strategy. i just want the robot to call a function which the competitor tells the simplified path.
am using arduino to code this.

thank you for all the help ryan,

Have you got the sample maze solver code working on your 3pi? Take a look at the 3pi maze solving example described in the User’s Guide. The code is available in the Pololu AVR library under the name “3pi-mazesolver.” It is divided into two parts:

  1. Explore the maze and create a simplified path from the start to the finish.
  2. Follow the simplified path.

If you skip the first step and instead set the path array to contain the path you need to go for your contest it will follow the path. You could do this by making two simple modifications to maze-solve.c:

  1. Change lines 21 and 22 to char path[100] = "SSRSS";unsigned char path_length = 5; // the length of the path
  2. Change line 117 to while (0)

After making these modifications, the 3pi should go through 2 intersections, turn right at the third intersection, then go through 2 more intersections.

- Ryan

wow this is awesome ill make it right away
thanks to you and all the members of
pololu for your immense help,