Page 279 - The Definitive Guide to Building Java Robots
P. 279
Preston_5564C07.fm Page 260 Monday, September 26, 2005 5:38 AM
260 CHAPTER 7 ■ NAVIGATION
navigation. Finally, dynamic obstacles are those that usually get out of the robot’s way if given
enough time, so in this case the robot just needs to be patient and then resume its movement.
Currently, I have only talked about one type of obstacle: the static, useful kind. Now I’ll
show you how to create a class to handle the useless semi-static and useless dynamic kind of
obstacles while our robot is navigating.
In Figure 7-10, the original path of the robot was from point a to point b. However, in
Figure 7-10 an obstacle lies in the path between a and b. So in order for the robot to get to its
goal (point b), it must calculate an alternate path around the obstacle.
Figure 7-10. Obstacle detection and path planning
To calculate point D, take a point perpendicular to the right or the left of the obstacle. To
choose right or left depends on what side has the most space in front of the robot. If it’s to the
right, the angle will be the heading 45 degrees, while the path to the left of the angle will be the
heading –45 degrees.