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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |