Bug navigation

Lab #2 write-up
Michael J. Chan
Ben Hulse
Peter Kasting
2/27/01


Results


Bug Algorithm 2


The bug algorithm in this section is a little sketchy. It makes a starting rotation toward its goal at the outset. Then, it runs the standard code from Project A (go straight and wall-follow). Once it encounters a point where the s-line intersects (and provided it was wall-following and a slope tolerance of 5 degrees), it calls the rotate function again to reorient itself. In order to try to avoid missing the turns and stopping point, the bug slows down within 5 inches of the targets. Some tweaks were made to make this code work with this project, so it is not as robust as in its previous form.



On the second map, the results ended up being the same, though the bug refused to heed the sline in the middle of the traversal. Instead, because of the fortuitous shape of the map, it wrapped around and finished. I believe this is because this algorithm does not check the angles and relative location while doing a hard corner turn. It is a hard-coded turning function that seems to ignore most of its surroundings.



All in all, the algorithm works even though it is a little loopy, and it misses a few cues, but at least in these cases, it turned out alright. All it needs is better checking, both in turns and while racing at break-neck speed. Sometimes, if conditions were just a little unfavorable, the simulator would skip, and the bug would go blithely onward. Thus, some greater tolerances should also be made here.

For the code, click here.