Overview

Gazebo comes pre-installed with ROS. Gazebo is mainly used to simulate sensor data and thus all nodes that are run on the actual bot can be run on Gazebo as well. In effect, where we would have different sensor drivers publish the sensor data to different topics and have motors use cmd_vel topic data to run , the gazebo node will publish all the sensor data to different topic and use cmd_vel topic data to simulate motors in the gazebo.

Basics of Gazebo

Starting Gazebo

Gazebo can be run both independently by typing

  $gazebo 

or as a ROS node by typing

  $rosrun gazebo_ros gazebo

You most likely will never need to run gazebo independently, so it advisable to run gazebo as a ROS node initially.

Making a Basic Robot Chassis

There are two formats for making a robot chassis in Gazebo, URDF and SDF.

We tried both URDF and SDF, and found SDF to be much more easier to handle, and thus, the chassis we used for testing was made in SDF.

A tutorial can be found here, and a exhaustive SDF element list here.

Adding basic sensors

The main benefit of Gazebo is the fact it can simulate sensor data. Most sensor plugins are available in the rospackage “gazebo_plugins”. It contains the basic plugins like odometry, IMU, camera, LIDAR. The procedure for adding the plugins is here.

Making world files

A world file consists of a textured ground plane and multiple obstacles places throughout the map. It is possible to make a world file, but we used pre-existing world files of the IGVC course.

For a textured ground plane, you can use this link.

Tutorial to launch a world file using a launch file

Debugging

  • If Gazebo can’t find any models, put

export GAZEBO_RESOURCE_PATH=path/to/worlds in your bash.rc

  • Gazebo has a client which handles the GUI and a server handles the majority of the simulation. If it seems slow, you can only run gserver. This is also the reason why you may get a “there is a gazebo process running” error even if you have no GUI open. The gserver my not have shutdown. Use

$pkill gserver to get it to start working again.

Future Improvements

  • Building a custom world map of our own instead of using pre-built ones.
  • Making an accurate model of our robot and all its sensors.