Several species of insects use the sun to maintain a correct heading in an effort to navigate from place to place, even as they have to adjust their paths to avoid things like bug zappers and swatters. This first part of the project asks you to emulate -- at least at a coarse level -- this insect behavior by implementing two path-planning algorithms. Appropriately, the algorithms are named Bug1 and Bug2.
The algorithms
The idea behind both algorithms is that your robot knows the
direction in which it should head towards its goal,
but it does not know
anything about the obstacles that lie between its current position and
that goal. The basic idea is to start heading toward the goal
(since the correct direction is known) and see whether any obstacles
present themselves. We will call the line between the robot's initial
position and the goal the S-line.
This problem is to implement these two "Bug" algorithms using the wall-following code you wrote in the second half of Lab Project A as a starting point. As with that assignment, you can assume that the obstacles will consist of walls meeting at right angles (an indoor application). The S-line need not, however, be parallel or perpendicular to the obstacles' walls. In implementing these algorithms, there are a number of choices to make, e.g., which direction to start heading around an encountered obstacle. It doesn't matter which direction you choose, as long as you stay consistent. Another choice that comes up in Bug1 is which direction to return to the perimeter point closest to the goal. In that case, it is preferable to return along the shorter path, (though either way is acceptable for this assignment).
Maps, Initial Points, and Destination Points
To test your algorithms, there are two world maps available
in /cs/cs154/as/B. For the first map (bugmapA), the goal point is
(2750,4200); for the second map (bugmapB) it's (0,4700).
For all of the test runs, the default starting point will be
used, i.e., the position the robot takes after the zr() call.
Both of these provided maps may be more complicated than
you want to use on a first run to debug your algorithms -- feel free
to try it out on your own maps, also.
Write-Up
In your write-up of this part of the assignment, be sure to
include the following
This part of the assignment will be made into a third Nomad simulator assignment... .