Skip to content
Yannick Goumaz edited this page Jun 26, 2023 · 8 revisions

It might happen that you want to parametrize how Webots is launched with the WebotsLauncher process or parametrize the webots_ros2_driver node.

Here is a list of all arguments you can use with some further explanations on this process and these nodes.

WebotsLauncher

Most of the arguments of the WebotsLauncher will start Webots with different command line arguments.

You can find below the list of arguments of WebotsLauncher and their impact on the command line arguments:

  • gui (bool): If False, set the --no-rendering, --stdout, --stderr and --minimize flags. Default is True.
  • mode (string): Set the --mode flag with the same value. Default is 'realtime'.
  • stream (bool): If True, set the --stream flag. Default is False.
  • port (integer): Set the Webots instance port. Default is 1234.
  • world (string): Specifies the path to the world to be used. It can be a literal string or a Substitution, like in the Examples of this repository.
  • output (string): (by default set to 'screen') and extra arguments will be used by the init function of launch.actions.ExecuteProcess.
  • ros2_supervisor (bool): If True, spawns the Ros2Supervisor custom node that communicates with a Supervisor robot in the simulation. The Ros2Supervisor node is a special node interacting with the simulation. For example, it publishes the /clock topic of the simulation or permits to spawn robots from URDF files.

driver

The driver node is launched as a standard node, thus there is not particular argument.

However there are two important parts.

The first one is to set an environment variable WEBOTS_CONTROLLER_URL equal to the name of the robot in the simulation with the additional_env argument. A prefix must be added to support all platforms. Not doing this or writing a wrong name will prevent the driver node from connecting to the robot.

additional_env={'WEBOTS_CONTROLLER_URL': controller_url_prefix() + 'Robot_Name'},

The second part allows other parameters to be defined. Beside the standard 'use_sim_time': True that can be used or a configuration file .yml, the two following parameters can be used:

  • robot_description (string): If set, the webots_ros2_driver node will parse the string to configure the ROS 2 interface. For example, this include using plugins (premade or custom ones), activating by default or renaming some topics.
  • set_robot_state_publisher (bool): If True, the robot_description parameter of a (potentially existing) robot_state_publisher node will be overridden by the content of a URDF file generated by Webots based on the robot in the simulation. This URDF may be not as complete as a URDF made by yourself. Default is False.
Clone this wiki locally