AWS DeepRacer simulation: Launch race track in Gazebo
Roadmap
- Setup
- Launch race track in Gazebo
- Car model
- Car control
- Teleoperation
Quick Overview of ROS1 concepts
- Packages: Are the software organization unit of ROS code. Each package can contain libraries, executables, scripts, or other artifacts.
- Nodes: A node is an executable that uses ROS to communicate with other nodes.
- Messages: ROS data type used when subscribing or publishing to a topic.
- Topics: Nodes can publish messages to a topic as well as subscribe to a topic to receive messages.
- Master: Name service for ROS (i.e. helps nodes find each other)
- catkin: A method for organizing and building your ROS code
- Workspace: A working directory where all packages are stored and build with catkin
Launch Gazebo using ROS
The very first step is to create a catkin workspace if it not already exists.
Create a package with name simulation
. Here we will gather all code for launching Gazebo and loading race track worlds.
After every
catkin_make
be sure to source your workspace!!!
Gazebo in ROS has 2 nodes: gzserver
and gzclient
. As you remember in ROS to launch a node(script) you should first launch ROS MASTER. In order to launch both Gazebo nodes you should:
- run roscore(ROS MASTER), gzserver and gzclient in three separate terminals
- or make a
launch
file I preferlaunch
files. They make running ROS code so much easier. Go todeep_ws/src/simulation
folder and makelaunch
directory, in which create a filegazebo.launch
. This example code launches two Gazebo nodes with theworld
argument, which now leads to empty world:
world
- is how our simulation looks, all objects, lights, shadows, etc. Empty world has nothing - only ground plane, 3-d axes and a source of light.
Now we can launch empty world in Gazebo
That was not so difficult. Now lets load a race track world.
Load a race track world
For this task you need folders meshes
, models
, worlds
and routes
from deepracer_simapp. Download them all to deep_ws/src/simulation
and create a simulation.launch
file in deep_ws/src/simulation/launch
folder. This launch file will include previous gazebo.launch
and will pass a world
argument.
Similarly run it from deep_ws
folder with
But…. wait. There is a warning:
Ok, it takes more than a few seconds and it seems to look for models in internet not in our simulation folder. Important: To avoid this you need to:
Yes, there will be another warning about folder not being a model folder etc., but it can be ignored
After path exports simulation.launch
will launch a race track world. To launch other world - just change its name in file or pass it as argument in shell.