My roomba has this problem from time to time. It's because the front wheel accumulates goo and stops rotating. The sensor that detects the wheel rotation then thinks the wheel is not rotating, and the robot moves erratically to free itself from the wall that it thinks is in its way.
Clean out the goo, and the robot is fine again.
The Roomba detects this problem and emits a failure code of 9 beeps. I contacted iRobot about the problem, and their response was to ship me a fresh Roomba (without the battery + charging station) right away. Here are some pictures of the battery transplant:
http://dl.dropbox.com/u/1149620/roombasurgery/index.html
From the troubleshooting instructions that iRobot gives you upon encountering the 9-beep code, I suspect that there's probably just a faulty or possibly dirty (likely very inexpensive) sensor on the front bumper of the robot. I wonder if there's a similar fix to jwz's Roomba where I could patch for the bad sensor somehow (the roomba appears to have more than one way to detect it's stopped moving), and perhaps accept a slightly "dumber" but otherwise working Roomba.