Some Debugging Frustration

My first robot, MARV-1 (Mike’s Autonomous Robotic Vehicle #1), is doing fine at avoiding obstacles, but it gets easily confused and sometimes gets literally spinning in circles.

I need to try to trace the cause of the endless spinning. My hypothesis is that I have the tolerance parameter for turns set too tight, so with the lack of precision in the heading, it can get in a mode where it’s never getting close enough to the desired heading to stop turning.

UPDATE: My hypothesis was incorrect. The problem was that while I normalize the robot’s heading to always be between -Pi and +Pi radians, I wasn’t normalizing the new target heading of (heading – Pi/4 radians) to turn away from the obstacle. So if that every was less than -Pi, the heading could never be close to the target heading, and the robot kept spinning.

I may also try to modify the marking on the gears so that I get a pulse every 1/8th of a wheel rotation rather than every 1/4.

UPDATE: This worked, and does seem to improve navigation, but errors still build up quickly on the heading, and hence position, as they tend to do with only dead reckoning for navigation.

I also need to modify the obstacle avoidance routine. Right now, when MARV-1 detects an obstacle it backs up, rotates right about 45 degrees, and then tries to move forward about 2 feet before recalculating a new heading and distance to the next waypoint. When MARV-1 is pointed to the right of the waypoint, this results in it turning away even further. I think I’ll try to have it turn in whatever direction is closer to the heading to the next waypoint.

Leave a Reply

Your email address will not be published. Required fields are marked *