Simulation
Gazebo Simulator
Gazebo is a 3D simulator. It makes it possible to rapidly test algorithms, design robots, perform regression testing, and train AI systems using realistic scenarios. Gazebo is integrated with ROS and supports various robots out of the box.
Gazebo is heavily used by the DARPA challenges (cf. Wikipedia). You can see videos online (example) and even load the maps and robot model that are available.
Gazebo Installation
Verify that Gazebo is installed using:
You should have at least the following packages:
Install missing packages using:
Launch your first Gazebo Simulation
If $ROS_WORKSPACE/pkg-tsim
is not installed:
Then, you can launch a preconfigured simulation:
Look at the content of this launch file here. We can see that Gazebo/ROS supports loading a world file describing the simulation environment and spawn elements such as robots. This simulation spawns a robot configured like a tbot
i.e. it is equipped with a laser range finder and a camera (kinect). The interaction with the simulation will operate through ROS topics as it would be with a real robot with real equipments.
Quiz on challenge 1
While the challenge 1 simulation is running:
Question: which topics are available i.e published by Gazebo?
Hint: use rqt_graph
to see the graph of all ROS nodes and topics (doc).
Question: In which topic are laser scans published?
Visualizing data
rviz2
is a versatile and powerful tool to display data published in topics. Launch it:
Question: How to configure
rviz2
to visualize the laser scans?
Be carreful, ensure that Global Option
/ Fixed frame
is correctly set to base_link
.
Question: why is this important? (hint: check your
tf
usingros2 run tf2_tools view_frames
)
You can also display the tf
in rviz2
directly.
Question: How to visualize camera images using
rqt
?
Controlling the Simulated Robot
Launch a simple node to control the simulated robot using keyboard:
tuto_sim
Create a launch file that starts the apropriate configration: the challenge-1
, a configured rviz2
displaying laser scans and the teleop
. We will prefer YAML format for launch file.
All the information you need are in the tutorials :
Create $ROS_WORKSPACE/pkg-tsim/tbot_sim/launch/tutosim_launch.yaml
Add this code into this file to:
Exercise: modify this launch file so that rviz
loads a saved configuration file when it starts. This configuration file should add the laser data, ...
Last updated