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 template package and the simulator packages . There, you will find a package with basic structure and a script 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. You code however, should work EXACTLY as is described below.

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 archive also contains the necessary files to launch the simulation in its own package. To test it out, build the package workspace, source it and launch:
$ roslaunch aro_sim onlysim.launch If you are running a custom ROS install, you will also need:
$ sudo apt install ros-noetic-turtlebot3-simulations

After a few moments, you should see the RViz tool and Gazebo simulator with the robot and a simple maze (see image below). Since the you have not programmed a localization routine for the robot yet, precise odometry is unknown, so don't get startled by red errors in RViz. Try experimenting with choices of base frame instead to get the idea of how the visualization works!

Third step is to launch your homework package containing the source code and a launch file (see below). You have to put the package in the same workspace as aro_sim package. After that, you can start reading the description below and implementing your solution, good luck. To test your solution in simulator, build the package workspace, source it and launch:
$ roslaunch aro_robocop robocop_sim.launch

Also make sure you explore the launch files to get an idea how they work, ie. how a launch file from our homework package executes scripts through launch files belonging to a different package.

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

Submission and evaluation

Successful solution (worthy of the points) must:

Submit your whole aro_robocop package FOLDER in a single .zip file to the submission system. Do not submit aro_sim package.

Hints