Table of Contents

Homework 02

Your task will be to create a simple control algorithm for the Turtlebot in a simulator. Something similar to what you can see here:

Start by downloading a template source code . There, you will find a basic suggested structure with many useful comments. The TODOs are there to guide you on what you should put into the code. It is not required that your code looks exactly as hinted in the template. If you can come up with a better solution/nicer code format, please, feel free to do it. The code however, must be easily readable and contain comments describing (almost) every line!

If you don't know how to do some of the required steps, please first try re-reading the lab 01 and 02 materials. Then, try searching for your answer at wiki.ros.org. And if everything else fails, contact us.

The second step is to download the aro_sim package, that contains the necessary files to launch the simulation. To test it out, build the package, source it and launch: $ roslaunch aro_sim onlysim.launch

After a few moments, you should see the RViz tool and Gazebo simulator with the robot and a simple maze (see image below).

Third step is to create your own package where you will put the source code and a launch file (see below). You can put the package in the same workspace as aro_sim. After that, you can start reading the description below and implementing your solution, good luck.

General Description

The robot will be spawned in a simple maze with some walls (see below, robot is the black thing just below the obstacle in the middle). You should constantly check the robot's laser scanner output to see if there are obstacles in front of the robot. If not, the robot should move ahead at full speed. If the robot is getting closer to an obstacle (first distance limit), it should slow down its forward movement speed and start turning away from the obstacle. If it comes even closer, it should stop the forward movement completely and only turn. Once there are no obstacles in front of it, it should start moving forward again.

This should continue until a 30 second time limit (from the start of the robot control node) expires. At that moment, the robot should stop and remain stopped. Also, the sun should be removed from the simulation, turning off the light.

Requirements & Constraints

Evaluation

Successful solution (worthy of the points) must:

Hints