Note: This tutorial assumes that you have completed the previous tutorials: webots_ros2_msgs.
(!) Please ask about problems and questions regarding this tutorial on Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

webots_ros2_core Package

Description: Core interface package.

Keywords: Webots, Simulator, Robotics, ROS2

Tutorial Level: INTERMEDIATE

Next Tutorial: webots_ros2_examples

This package is the core package which allows to easily start Webots and create nodes to interface simulated robot in Webots with ROS2.


This package include the following node.


The webots_launcher is used to start Webots from your launch file, it has the following arguments:

  1. --world: defines the path to the simulation world file to load.

  2. --mode: defines the simulation mode (pause, realtime, run or fast) with which Webots should be started (realtime is set by default).

  3. --no-gui: if set, Webots starts with a minimal graphical user interface, this is useful to use on a server for example.

Python Modules

This package includes the following Python modules that can be used from within other nodes to easily create an interface between a simulated robot and ROS2.


This module provides the WebotsNode class that is used as a base class for all the other nodes. It creates the interface between Webots and ROS and publishes the clock topic.


This module provides the following utility functions:

  1. get_webots_home: returns the path to the Webots installation directory. None is returned if Webots is not found.

  2. get_webots_version: returns the version of Webots as a string.

  3. append_webots_lib_to_path: adds the Webots lib folder to the library path.

  4. append_webots_python_lib_to_path: adds the Webots Python API to the Python path.


This module provides the JointStatePublisher class that is used to publish joint states.


This module provides the TrajectoryFollower class that is used to provide an action server to move the joints.

Wiki: webots_ros2/Tutorials/webots_ros2_core (last edited 2020-02-14 16:41:30 by DavidMansolino)