In this Milestone, you are going to learn about Gazebo, a physics engine that allows you to simulate your robots moving through a virtual 3D environment, and hence test your algorithms.
After completing this milestone, you will be able to
- Create and demonstrate in the Gazebo simulation environment a robot controlled through ROS.
- Examine elements of that robot through the Rviz visualization tool.
Ensure you have installed ROS before starting this Milestone (which you will have done if you completed M1). The instructions below assume you have installed ROS Melodic, but may work in other versions.
Just like ROS, Gazebo is native to Ubuntu Linux and thus best supported there. The installation on Ubuntu is fairly straightforward. Things to keep in mind are:
- Make sure you install Gazebo related packages that match your ROS version (in our case ROS Melodic).
A compatible version of Gazebo should have been installed as part of the desktop_full
metapackage through chocolatey; for example, the ros-melodic-desktop_full
metapackage includes the gazebo-9
package.
- That said, there are still some gotchas. See notes from my own experience on my Dell XPS 14 running Windows 10 which you may find useful.
If you have managed to install ROS on MacOS by following Milestone 1, it may also be also possible to install Gazebo on MacOS as well. Follow the installation guide here.
Once you have Gazebo installed successfully, you need to learn how to use Gazebo to run your simulations.
-
Work through the Beginner tutorials listed on the left side of the Gazebo Tutorials page:
- Overview and Installation. You have already completed the installation, so all you need to do is read the "What is Gazebo?" text.
- Understanding the GUI. For Windows users the
gazebo
command is not defined. Instead you can use the commandto get Gazebo started in an empty world. (It also creates a ROS master, but you won't use that in these early tutorials.)roslaunch gazebo_ros empty_world.launch
- Model Editor. We won't use this basic robot -- in fact, no big deal if you cannot get it to move -- but this tutorial gives you a visual idea of what is going on in URDF below.
-
The
tf2
package manages transformation (coordinate) frames in ROS. Work through the first tutorial: Introduction totf2
. Although you are not required in this milestone to complete any more of the availabletf2
tutorials, missing or buggy transform trees are a very common source of problems in ROS so you may want to explore further. -
URDF is the language we will use to represent our virtual robots. Work through at least the Learning URDF Step by Step tutorials (items 2.1 to 2.5 on that tutorial page).
-
The Gazebo website also has its own distinct versions of Using a URDF in Gazebo and ROS Control which may help clarify and illustrate the syntax.
-
This Demo Project provides an additional example.
-
Using the examples from the above tutorials, create your own example robot. It should:
- Have at least three disinct types of links (such as cylinder, sphere, box, ...) with visual and collision components.
- Have at least three joints, at least one of which is not attached directly to the top level of the link tree.
- Use an Xacro property and/or macro.
- Have a launch file which brings up Gazebo (so the robot can be seen moving) and Rviz (so that the elements of the RobotModel can be examined).
- Include some method for controlling the motion of the robot interactively while the simulation is running. This could be through a RobotSteering panel (from Using a URDF in Gazebo), keyboard control (from Understanding ROS Topics) or perhaps using a joystick that you have lying around the house (you'll need to Google for that one).
- Be different from the robots of all other students in CPSC 515.
To demonstrate that you have completed this Milestone, you need to be able to show (through a screen share) that you can:
- Launch Gazebo and Rviz with your robot model launch file.
- Show in Gazebo that your robot responds to specified commands through your chosen control interface.
- Show in Rviz elements of your robot model.
- Show requested elements of your URDF file, such as links, joints or Xacro elements.
- Answer questions about elements of your URDF file.
The assessment will be time limited, so make sure your local machine is properly set up in advance, you have sufficient terminal windows open, and you have your URDF file open in an editor. You may use written sources (including internet searches) to answer the questions, but the time limitations will not permit extensive searching and reading. It will be possible to answer the questions in a sentence or two.