0% found this document useful (0 votes)
43 views

Simulation Exercises With ROS

The document describes 4 exercises involving simulation of a TurtleBot3 robot using ROS and Gazebo. In the first exercise, the student is asked to set up a simulation of the TurtleBot3 robot in the Gazebo Big House environment. The second exercise asks the student to write code for the robot to autonomously map the environment using SLAM. The third exercise has the robot navigate to goals in a text file after mapping, requiring alignment of the map and navigation systems. The final exercise describes implementing a strategy to plan a path for the robot to disinfect a room with UV lamps and ensure a minimum energy of 10mJ across the room.

Uploaded by

black
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Simulation Exercises With ROS

The document describes 4 exercises involving simulation of a TurtleBot3 robot using ROS and Gazebo. In the first exercise, the student is asked to set up a simulation of the TurtleBot3 robot in the Gazebo Big House environment. The second exercise asks the student to write code for the robot to autonomously map the environment using SLAM. The third exercise has the robot navigate to goals in a text file after mapping, requiring alignment of the map and navigation systems. The final exercise describes implementing a strategy to plan a path for the robot to disinfect a room with UV lamps and ensure a minimum energy of 10mJ across the room.

Uploaded by

black
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Simulation Exercises with ROS

Ludovico Davide
2020-2021
Exercise 1
The student is asked to setup the simulation of the TurtleBot3 burger
robot using the Gazebo simulation environment and the TurtleBot3 House
scenario.

In our simulation environment we need to simulate only the TurtleBot3 Burger


model of the robot. So every time we launch a new simulation we have to export
the model with the command:

$ export TURTLEBOT3_MODEL=burger

Once we have exported the robot's model, we can simulate the robot by using
Gazebo, which is a 3D robot simulator environment. In order to set the simulation in
the Big House Scenario we just need to use the following command:

$ roslaunch turtlebot3_big_house turtlebot3_big_house.launch

In this way we plot the Big House Scenario with the robot.
Exercise 2
The student is asked to write a code that make the robot able to move
autonomously in the environment to create a map covering the larger
possible part of the environment.

Now that we have set the simulation environment, we have to use it and create a
map autonomously. When the robot is set in an arbitrary initial position, it only
knows what its laser scanner is able to detect.

In order to make our robot able to explore autonomously the Big House
environment it has to create a map and to do this we need to use a SLAM technique.

In this exercise RViz, that is another 3D visualization tool of ROS, is used.

At first, we launch the SLAM node with the following commands:

$ source devel/setup.bash

$ export TURTLEBOT3_MODEL=burger

$ roslaunch turtlebot3_slam turtlebot3_slam.launch

Then, we need the node called move_base of the navigation stack, that is used to
move the robot:

$ source devel/setup.bash

$ export TURTLEBOT3_MODEL=burger

$ roslaunch turtlebot3_navigation move_base.launch


Now, let’s move the robot autonomously to explore unobserved areas of the map
through the explore node from the explore_lite package:

$ source devel/setup.bash

$ roslaunch explore_lite explore.launch

At the end, let’s save the map when the covered area is sufficient for our purposes:

$ source devel/setup.bash

$ rosrun map_server map_saver -f ~/map


Exercise 3
The student is asked to write a code that after the mapping of the scenario,
makes the robot able to navigate in the environment reaching a set of goals
contained in a text file. The alignement between the map and the
navigation system must be performed.

Now that we have mapped the scenario, we can use this map to make the robot
able to navigate in the environment reaching a set of goals that are contained in a
text file. But before targeting the goals the allignment between the map and the
navigation system must be performed.
The algorithm is implemented in a file called simple_navigation_goals, written in
Python, and contained in a package called simple_navigation_goals. Let’s see how to
use it through some code snippets.

As first thing, we have to launch gazebo with the virtual environment:

$ cd turtle_ws/
$ source devel/setup.bash
$ export TURTLEBOT3_MODEL=burger
$ roslaunch turtlebot3_big_house turtlebot3_big_house.launch

Then, we launch the navigation stack by using the saved map of the environment
(on Rviz):

$ cd turtle_ws/
$ source devel/setup.bash
$ export TURTLEBOT3_MODEL=burger
$ roslaunch turtlebot3_navigation turtlebot3_navigation.launch
map_file:=/home/ubuntu/turtle_ws/src/turtlebot3/turtlebot3_navigation/maps/map_big_house.yaml

The following snippet runs a node that set the correct pose for the robot and read
set of goals from a text file sending them to the navigation stack:

$ cd turtle_ws/
$ source devel/setup.bash
$ rosrun simple_navigation_goals simple_navigation_goals.py
In particular, the first problem that we met is that the robot is not localized in the
position in which is really present. The node waits for a message over the topic
/odom and then set the values read. By publishing a message over the /initialpose
topic, the robot is now correctly localized.

After this, the robot waits 5 seconds and read all the goals contained in the text file.
Each goal is defined in a row with x and y coordinates separated by a comma.
Then, the actionlib package is used. This package provides tools to create servers
that execute long-running goals that can be preempted. Actions are the best choice
for cases when a node wants to send a request to another node and will receive a
response after a relatively long time. To avoid leaving the user wondering what’s
happening and if all is going as desired, Actions implement a feedback mechanism,
which let the user receive information every now and then.
Exercise 4
At the end, suppose that in order to kill the coronavirus, the robot is equipped
with a set of UV lamps able to spread all around the robot a light power Pl = 100
μW m2 .
The UV energy 𝑬 at point (𝒙, 𝒚) and time 𝒕 can be computed as:
𝒕
𝑷𝒍
𝑬(𝒙, 𝒚, 𝒕) = * 𝟐 𝒅𝝉
𝟎 ,𝒙 − 𝒑 (𝝉 )0𝟐 + 2𝒚 − 𝒑 (𝝉 )3
𝒙 𝒚
where 𝒑𝒙 (𝒕) and 𝒑𝒚 (𝒕) represent the robot position along the 𝒙 and the 𝒚 axis
respectively at time 𝒕. Observe that any obstacle completely stops the UV power
propagation and that the light power emitted at a distance lower that 0.1 meters
from the robot is zero due to the robot encumbrance. The student is asked to
implement a strategy to define a path able to cover a selected room in the
map in order to guarantee a minimum value of 10 mJ of the UV energy over
the room to ensure the coronavirus is inactivated.

Let’s see how to implement a strategy to cover a selected room in the map in order
to guarantee a minimum value of 10 𝑚𝐽 of the UV energy over the room to ensure
the coronavirus is inactivated. The room of interest can be discretized as a grid with
resolution of 0.2 𝑚 for simplicity.

ROOM OF INTEREST
The room of interest in the algorithm is represented as a matrix and each cell
represents one square of this grid.
The matrix, at each iteration (sampling time), is updated in order to sum the current
energy in each cell to the new one. Then the algorithm search for the point of
minimum energy in the room and moves the robot toward it. This is made until each
cell in the matrix has value greater than or equal to 10.

We can observe that at the beginning the robot is located in a point outside the
room of interest so we need to move it toward a point in that room.
At the end when the room is safe the node is terminated automatically!

You might also like