Skip to content

ROS 2 Migration: Launch Scripts

Mabel Zhang edited this page May 5, 2020 · 3 revisions

Overview

The functionalities of gazebo_ros scripts in ROS1 (gazebo, gzclient, gzserver, debug, gdbrun, perf, libcommon.sh) are being offered by launch scripts gazebo.launch.py, gzserver.launch.py and gzclient.launch.py in ROS2.

Example Migration

ROS1

rosrun gazebo_ros gazebo

ROS2

ros2 launch gazebo_ros gazebo.launch.py

ROS1

rosrun gazebo_ros gzserver

ROS2

ros2 launch gazebo_ros gzserver.launch.py

ROS1

rosrun gazebo_ros gzclient

ROS2

ros2 launch gazebo_ros gzclient.launch.py

ROS1

rosrun gazebo_ros debug

ROS2

ros2 launch gazebo_ros gzserver.launch.py gdb:=true 

In ROS2, gzclient script also supports gdb

ros2 launch gazebo_ros gzclient.launch.py gdb:=true 

or

ros2 launch gazebo_ros gazebo.launch.py gdb:=true 

ROS1

rosrun gazebo_ros perf

ROS2

ros2 launch gazebo_ros gzserver.launch.py valgrind:=true 

Similar to gdb, valgrind can also be run with gazebo and gzserver

Arguments Usage

For all other arguments to be passed to gazebo, gzclient or gzserver command, launch_arguments are available in the respective scripts.

ros2 launch gazebo_ros gazebo.launch.py world:=actor.world verbose:=true

By default, the system plugins are loaded in gzserver. To load without them

ros2 launch gazebo_ros gazebo.launch.py init:=false factory:=false

By default, both gzserver and gzclient have to be terminated for the launch script to exit. server_required and gui_required tell the launch script to shut down automatically if either one of gzserver or gzclient has terminated, respectively:

ros2 launch gazebo_ros gazebo.launch.py gui_required:=true server_required:=true

extra_gazebo_args is a special argument which allows any gazebo argument to be passed as it is passed to the usual gazebo command

Example Usage

extra_gazebo_args

ros2 launch gazebo_ros gazebo.launch.py extra_gazebo_args:="--verbose --pause"