![]() The reason for the first short distance is that the robot shouldn’t bump into the wall after the turn, and the reason for the second short distance is that after the robot has turned, the sensor would see the long space it had just come from, and the robot would think it should turn again, which is not the proper thing to do. When the robot decides to turn it should either make a wide turn, or go forward a short distance before turning and after turning go forward a short distance again without checking the sensor. After the right turn the list contains Right, Straight, Right which is the direct path.It passes a space and adds Straight to the list.After the next left turn the list contains Straight, Back, Left.It recognizes a combination and changes Right, Back, Left to Back. After the left turn the list contains Straight, Right, Back, Left.The list now contains: Straight, Right, Back. With a dead end, it turns around and adds Back to the list.It recognizes a combination and changes Left, Back, Straight to Right. The list now contains: Straight, Left, Back, Straight. Passing the lane it used from the entrance, it adds Straight to the list.The list now contains: Straight, Left, Back. Then it turns left and adds Left to the list.When the robot starts driving it sees a space to the right and stores Straight in the list in the array."Straight, Back, Straight" becomes "Back."."Straight, Back, Left" becomes "Right."."Left, Back, Straight" becomes "Right."."Left, Back, Left" becomes "Straight.".The possible turns are: Left, Right, Back (at a dead-end), and Straight (which is an intersection). The final list of turns and intersections is the direct path thru the maze. It accomplishes this by storing each turn and intersection in an array, checking for specific combinations of turns and intersections as it goes, and replacing the combinations that include a dead-end. While driving thru the maze the robot must memorize the path it is travelling and eliminate dead-ends. ![]() I didn’t include this refinement in my project. A possible solution for this problem would be for the robot to switch to the right-hand wall-follower rule if it realized that it was going in a loop. Depending on the placement of the loop, the robot could keep going around and around the loop. One caution is that the method could fail if the maze has a loop in it. If none of the above are possible, this must be a dead end.If it can’t go left or straight, turn right, if possible.The idea is that the robot will keep a wall on its left side by making the following decisions as it goes thru the maze: I chose the left-hand wall-following method. If you are interested in studying them, they are described very well in the following Wikipedia article: There are several methods of navigating a maze.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |