How do we get our robot to re-correct itself when it gets too close to a wall? What our robot has to do is go through a maze without touching the walls and it keeps turning towards the wall and will not correct itself by going straight and away from the wall… It has 3 ultrasonic sensors, 1 on the left front, 1 on the right front, and 1 in between those 2, which is facing straight forward. We have it moving straight and turning when it reaches an obstical but are having trouble making it correct itself as it slowly moves toward a wall on either side. If ANYONE can help please do…
We need a response by April 6th so we can finish programming it
Follow this link to the maze http://nationalroboticschallenge.org/downloads/NRCContestRules2009.pdf
Pages: 30-35
Can you post what code you already have? One thing you might try is if you have several motors turn them all on and see which spin at the same speed. Sometimes motors will wear down and spin slower. If you have a motor like that on one side of your drive train that side will drag. You can usually correct this with code but that is a simple mechanical solution.
Does your program take sensor readings in an infinite loop (acting as a sensor watcher)? Sometimes people take a sensor reading once and forget that the sensors must be acting continuously.
A pseudeocode example of a sensor watcher could look like:
“Go forward”
While 1==1
[INDENT]Get centersensordata
Get leftsensordata
Get rightsensordata
If centersensordata < desired distance “stop, decide which way to turn, and turn”
Else if rightsensordata < desired distance “veer left slightly”
Else if leftsensordata < desired distance “veer right slightly”[/INDENT]
End while
Other possibilities (less likely, since you’re mainly having trouble with your side detection)
-
It could be that by the time your sensors “detect” a wall, you have already gone too far in a certain direction. You might want to increase the distance which triggers the turn, i.e. “detect” the wall earlier, when the robot is farther away.
-
Although your robot is moving “slowly”, perhaps it’s still moving too quickly, especially after it detects a wall nearby. You might want to slow the motors even further, especially before or during turns.
-
It could be that your turning radius is too large – no matter how slowly it turns, you can’t get turns that are tight enough to suit your needs. To change this will require major mechanical modifications, such as changing the wheel base (front-back length) & wheel width. Or you might consider a completely different type of driving base, such as a holonomic drive or swerve drive.
Good skill to you (I’ve never put much stock in luck).