latest tweets:

Jump to content.

Maze-Solving Robot

March 13th, 2008

Botball is an annual robotics competition.  I am part of the Botball club at my high school, and I thought I would share a little project that I just finished.

My goal was to have a generic robot with a camera on it that all of the club members could write code for.  First the task was to make the robot bounce around in an arena marked off with red tape, then the goal was to make the robot follow a line (curvy, with sharp edges, with dead ends, whatever), then it was to make the robot solve a maze.  It was a lot of fun, and a great learning experience.

One look at the robot shows that I definitely care about software way more than hardware.
Side View
front view 

It may not look like much, but surely you know that personality is more important than appearance, and besides this little guy has spunk.  If I were to continue this project, though, the next step would be to make him less fat.

Here’s the maze.  In theory the robot can solve any maze of this style.  (Yes, the end of the maze is a mouse pad. :-P )
Maze Picture

Here is the robot solving the maze.  Keep in mind that the robot can be placed in any part of the maze with the end anywhere else in the maze.Â

I found by experimentation that the longest time it can take the robot to solve this maze, given any start and any end, is 1 minute and 54 seconds.

If there’s one bit of advice that I think new Botball members need to know, it’s to be patient.  The first version of my maze-solving code was really just code that made the robot follow lines.  A later version would only solve a maze if it never encountered a dead end, and there’s always the version of the code that makes the robot flail about sporadically.  So be patient, and don’t try to tackle the whole project at once.  Get little pieces to work, and use that to build off of.  I in no way assert to be the authority on robotics, but I have learned a thing or two. :-)

Oh, also precise names.  Don’t go calling methods “dog” or “cat”.

Download the code here.

Here I made a video explaining in general terms how the robot stays on track when following a wall:

So you may want the code to mess around with, and if you do then you’re in luck!  Not only is there a link to download the code at the bottom of this post, but I also recorded two videos of me explaining it, or attempting to anyway. :-P   Warning: It may be a little boring!

In this video I explain the defines, whose values you can change to make the robot behave differently:

In this video I explain how the rest of the code works:

(Note:  I found an error in the deadEndInSight method.  I fixed it incorrectly on video, but it should be right in the download below.)

Maze-Solving Robot

March 6th, 2008

For the past couple of weeks I have been trying to get a little robot to solve a maze, were the walls are marked off with red tape.  I came up with the basic design for the robot, but some others worked on it too.  (Thanks a LOT to Tim for coming up with the best solution for the back wheel.)  The robot is just two wheels with a camera on the front.  The “brain” is a Game Boy Advance with a big XBC for a game cartridge.

The code, though, that’s all me, baby!

This is the first day when it has actually worked.  I’m still going to tidy up the code, take out some debug statements, and tweak some values to make the thing go faster and more smoothly.  This is all very fun for me. :-)

 Edit, March 15, 2008:

I finished the project and made this post.