# Practical Exercises

### Exercise 1

The first exercise, once you have got the simulator running, is to:
1. Produce a control program that takes the robot on a random walk.
2. Extend the random walk program so that the robot uses some set of sensors to avoid crashing into obstacles.
3. Extend the obstacle avoiding program to become a wall-following programe
For the last part, remember the example of "emergent wall-following" from the class on behavior-based robotics?

### Exercise 2

Now extend the wall-following program that you wrote for Exercise 1 to use the Bug 2 algorithm.

Player/Stage provides you with the correct position of the robot in its environment. Use this to tell where the robot is.

The alogrithm is briefly described in Chapter 6 of the textbook, and more completely described in the original papers on the subject which you can find on the page for the navigation lecture.

### Exercise 3

This exercise has three parts.

First, figure out how to connect your simulated robot to the particle filter localization provided in Player/Stage. Experiment with its behavior in a variety of maps using the obstacle avoidance/wall following code that you wrote for Exercise 1.

You should be able to display the set of particles on the map so that you can get a sense of how this evolves over time.

Second, compute the average position error of your simulated robot as it moves through the world doing obstacle avoidance.

Third, make the implementation of the bug algorithm that you wrote for Exercise 2 work with the results of localization. What is the average error when running Bug2?

### Exercise 4

This exercise has three parts.

First, implement a road-map based approach to navigation, and use it to have your robot navigate through a map that you create. As in the previus exercise, use the particle filter when your algorithm needs to know where the robot is.

Second, extend your implementation to use odometry information (provided by Player/Stage) to compute how far the robot actually travels on a trip from start to goal.

Third, compare the distance that the robot travels using the roadmap approach with the distance it travels using the Bug 2 algorithm, (you will have to retro-fit the odometry information into your solution to Exercise 3 to do this).