Simulating with Gazebo
Gazebo is a 3D simulator, while ROS serves as the interface for the robot. Combining both results in a powerful robot simulator.
For more information about Gazebo, please refer to: Gazebo and ROS-Wiki-Gazebo.
This tutorial serves as an introduction to driving and controlling Handsfree robots on Gazebo
Gazebo was probably installed when you installed ROS.If you check the documentation of Gazebo, you will see that the following table corresponds to the default versions of Gazebo that automatically install with ROS:
- ROS Indigo: Gazebo 2.x
- ROS Kinetic: Gazebo 7.x
- ROS Lunar: Gazebo 7.x
In tutorial Installing and Configuring Your ROS Environment we have installed the dependencies for connecting ROS to Gazebo.
We can test if Gazebo is working properly by running the following command:
> roslaunch gazebo_ros empty_world.launch
If Gazebo works properly, then we will load an empty world model.
empty_world
model:
In addition, Gazebo has certain requirements for the computer graphics card, support for Nvida's graphics card is better than AMD's, if you are using the AMD's graphics card, it is usually not possible to load a complex world model.
For example:
> roslaunch gazebo_ros willowgarage_world.launch
Generally, AMD graphics cards can start the Gazebo, but Gazebo will hang on a blank screen when you try to load a complex model.
Since the models loaded in this tutorial are simple, whether you are using an NVIDIA or AMD graphics card will have no effect on the simulations.
Test the Gazebo Works
Open Gazebo and load the HandsFree's robot model by running the following command:
> roslaunch handsfree_gazebo gazebo_mini.launch
Now we can see HandsFree's Stone robot model on Gazebo.
Teleoperation of your robot
Open a new terminal and run the following command:
> roslaunch handsfree_teleop keyboard_teleop.launch
You can refer to the previous sections of the tutorial for the detailed process.
Autonomous Navigation Testing
Turn off the remote terminal and launch the autonomous navigation node
> roslaunch handsfree_gazebo move_base_amcl_mini.launch
Then we can let the robot navigate autonomously to the target point set on the RVIZ as shown in the previous tutorials.