Launching MARA simulation

Get the real MARA here

We need to launch several terminals in order to launch the gazebo simulation with ROS 2.0 compatibility, there are three main steps:

  • spawn the MARA model in Gazebo
  • publish the robot model
  • use RVIZ2 to visualize the model if needed

First thing we will do is launching the simulation with ROS 2.0 compatibility. For this, we need to source some environment variables in our terminal.

The first two lines are in charge of loading the environment variables of Gazebo and ROS 2.0. Then we need to extend the environment variable GAZEBO_MODEL_PATH with the models' install location.

Finally we launch Gazebo with the -s option, which will forward command line arguments to ROS 2.0. It will provide the spawn_entity service for spawning SDF/URFS models and lights into the simulation, and the delete_entity service for the deletion of models and lights from the simulation. We are also including --verbose to print all gazebo ros messages in order to debug possible errors.

source ~/ros2_mara_ws/install/setup.bash
source /usr/share/gazebo/
gazebo --verbose -s

You will see:

Gazebo empty simulation

Right now Gazebo is launched, but it's not simulating any robot. To spawn a model we need to execute the following python script:

source ~/ros2_mara_ws/install/setup.bash
ros2 run mara_utils_scripts

After this you will see the robot in the Gazebo world:

Gazebo simulation mara

Launch another terminal, this one to publish the transformations between links:

source ~/ros2_mara_ws/install/setup.bash
ros2 launch mara_bringup

Finally we have the option to visualize the robot in RVIZ2.

source ~/ros2_mara_ws/install/setup.bash

Gazebo simulation RVIZ2

Check this tutorial