Gazibo Simulation Tutorial
This simulation was created using Ubuntu 15.10 in preparation for the LTS release of Ubuntu 16.04.
CMakeYou will need to install CMake to compile the code. Install CMake as follows:
sudo apt-get install cmake
Gazebo 7 is used to run the simulation itself.
- If you are using Ubuntu 15.10, then you will need to install Gazebo 7 using the tutorial found here. Make sure you install the development packages as well.
- If you are using Ubuntu 16.04, then you can just install Gazebo 7 using:
sudo apt-get install gazebo7 libgazebo7-dev
If you want to test the FCL collision checker you will need to install FCL. The code was developed using FCL 0.4.0, however the API's used didn't change from version 0.3.2 (the version in Ubuntu's repositories), so it should compile with that version as well. However, it is most likely not compatible with the current version of FCL in development on GitHub due to refactorings and type changes.
- If you wish to use version 0.3.2 install it using:
sudo apt-get install libfcl-dev
- If you wish to use version 0.4.0, download it from the GitHub releases area here and then use CMake to build and install it.
- Alternatively, you can fetch the source for Ubuntu's version of 0.3.2 using: and then use
apt-get source libfcl-dev
devscriptspackage to download and build version 0.4.0 with Ubuntu's patches applied.
Getting the Code
The code for the model and Gazebo plugins can be found on GitHub here. Unfortunately, the CMake script to check for the presence of FCL doesn't work, so the build script assumes it is installed. Build the code as follows:
- Download the code using
git clone "https://github.com/ASL-Robot/controller"
- If you don't want to use the FCL collision checker to monitor the simulation, comment out the related lines:
message(STATUS "Configuring FCL collision checker ...")
message(STATUS "Configuring FCL collider to Gazebo bridge ...")
- Use CMake to generate the Makefiles to build the code and then use Make to build the code.
- The build artifacts will be aggregated to a folder named "out" in the build folder. You can move this folder and rename it as you please as long as all the files in it are kept together.
Using the code
The code compiles a few different files. Here is a short description of how to use each one. Commands are assumed to be run from the "out" folder created by the build process above.
- model.config, robot.sdf, robot.world
- These files hold the model description for Gazebo to use. To run the simulation, just run: Note the
gazebo --verbose robot.world
--verboseargument. The Gazebo plugin will print responses to using the "message" priority which are only visible when Gazebo is in verbose mode.
- "robot.sdf" contains the model of the robot itself, while "model.config" and "robot.world" are used to create an empty simulation world to put the robot in.
- Note: These files are used only by Gazebo, the FCL collision checker has it's own hard-coded internal model that will need to be updated as well if you change the robot model in "robot.sdf"
- This file is the plugin that allows the client programs to manipulate the model during simulation. "robot.sdf" has a reference to this file so Gazebo can load it.
- A program meant for the user to directly manipulate the robot's simulation model by moving it's joints. It can move the joints over time, "teleport" them to a specific position, reset the robot to home position, and echo the current pose of the robot to Gazebo's log.
- A program meant for animating the robot's simulation model. It reads and parses an animation script from its input and then sends that to the control plugin to animate. This allows previewing a series of motions with delays and velocities correctly executed in simulation time.
- A program which monitors the robot's pose as published by the control plugin to check if the internal model and collision checker designed for live use on the robot would detect a collision.
- To verify it's accuracy, turn on "Contact Points" in Gazebo's View menu. This will show indicators whenever Gazebo detects the robot would collide with itself.