PAReX Home

Phoenix Area Robotics eXperimenters

Home Club Info Web Log Meetings Events Rules Articles Links

July 20, 2003

Single-Stepping Your MazeRunner

Single-Stepping Your MazeRunner

A major part of the MazeRunner development is debugging your code. Without any special tools this simply involves starting the robot and seeing what happens. Having a display onboard or even a serial link can help, but when the robot tears down a corridor and misses 2 turns and run into a wall, you'd like to know why that happened.

Concept

In the software world you would use a debugger and single-step through your code, examining register and memory location to see what's going on. Well why not do something similar with your robot? What I did was develop a single- stepping routine where the robot would stop every time a new room (or cell) was detected. Once the robot stopped, a debug page was sent to the LCD display, showing information about the current cell, sensor readings, current heading, and running mode. After examining this information I pressed the run button and the robot continued until the next cell was detected. In this manner I could single-step an entire maze, making sure the mapping routines were working, and that the sensors were behaving as well.

Breakpoints

One of the first things you need to develop is a breakpoint to stop the robot. This could be different for each robot, depending on how you navigate the maze. Some robots move a specific distance and then scan, move, scan etc. For this approach I would break right after the room scan was done so you can see how the sensors readings look, and how your mapping algorithms work. My mapping routine is a little different in that once it's moved, it continuously scans and will continue moving until a change in the cell walls has occurred. Once that change occurs, the robot stops and displays all current information (the breakpoint).

Debug Display

Once the breakpoint occurs, you need to display some data so you see what's going on. The display I used was 4x20 so I had lot's of room for information. Here's a typical screen shot of what my display looked like.

debugscreen.jpg The top line has the current heading (North), the header for the map info ( N E S W ) and the current mode E (Exploring). The 2nd and 3rd line have the current and previous cell information that indicates if a wall if present or if the path has been traveled. The 4th line has the value of 4 of the wall sensors that were used to create the mapping information. Naturally you can put whatever you want on your display, my example is just to give you ideas. In fact that display may change over time. I originally had line 4 showing another cell reading, but changed it to sensors to work on some sensor problems. My new robot will have a 2x16 display on it, so rather then having a single debug display, I may go to multiple displays that you can scroll through to get all the needed info.

Remote Operation

If your robot has some kind of remote link like an RS-232 port or an RF link you don't need to rely on the LCD display, since you can display the debug display on a laptop or PC. This also allows you to display a lot more information then what you could fit on the LCD, plus you're not squinting and leaning over the maze walls trying to read that little display. My current robot used an RS-232 link, but it was output only. On the next robot I'll make sure it has a bi-directional port so I can also send commands to the robot. No more leaning over the maze to read the display AND press the run button, now it can all be done from a remote terminal application.

Summary

Building a robot can be very rewarding. It can also be head-banging frustrating, so any tools or methods we can use to help that development will save on aspirin. The ability to single-step my robot through the maze has been one of those methods that helped my developments. Hopefully it can help yours as well. Posted by Kelly Small at July 20, 2003 05:07 PM
Comments

Nice article Kelly. When I first saw the article heading I thought it was about stepper motors:) I plan on putting some stepping capabilities into my next maze runner.

Posted by: Mike Linnen at July 21, 2003 02:07 PM