Main Content

How Gazebo Simulation for Robotics System Toolbox Works

Robotics System Toolbox™ provides a co-simulation framework that enables you to use robotics algorithms in MATLAB® and Simulink® and visualize their performance in a virtual simulation environment. This environment uses the Gazebo Simulator.

Understanding how this simulation environment works can help you troubleshoot issues and customize your models.

Communication with 3-D Simulation Environment

When you use Robotics System Toolbox to run your algorithms, MATLAB or Simulink co-simulates the algorithms in the simulation environment.

On the host computer, Simulink or MATLAB sends actuation data and set commands to the Gazebo Co-Simulation Plugin on the target Linux machine. The plugin passes this information to the Gazebo Simulator, which returns sensor data and model information through the plugin to Simulink or MATLAB on the host computer.

The diagram summarizes the communication between MATLAB or Simulink and the simulation environment.

MATLAB or Simulink communication with Gazebo Simulator

Time Synchronization

During co-simulation, you can pause Simulink and the Gazebo Simulator at any time using Pause. Gazebo pauses one time step ahead of the simulation.

Time Synchronization between Simulink and the Gazebo Simulator

The gap is due to the co-simulation time sequence:

Simulink and Gazebo co-simulation time sequence

Sensor data and actuation commands are exchanged at the correct time step. The execution steps Gazebo first, then Simulink. When paused, simulation execution is still at the time step executed by Gazebo, but Simulink remains on the previous step time until you resume the model.

Related Topics