webots_ros2 is a package that provides the necessary interfaces to simulate a robot in the Webots open-source 3D robots simulator. It integrates with ROS2 using ROS2 messages, services and actions.
Some of the key features of Webots include:
- Cross-platform [windows, linux, mac].
- Stable physics engine.
An efficient rendering engine using Physically Based Rendering for realistic images.
- A simple and intuitive user interface.
Wide range of robot models available and ready to work.
Wide range of documented samples.
Webots is a prerequisite to use the webots_ros2 package. It can be downloaded from the Github repository or build from the sources. The installation is straightforward, but if need the installation instructions can be found here.
Alternatively, you can also get Webots from the webots_ros2_desktop ROS2 package (this package installs the webots_ros2 package and the Webots software).
Multiple Installations of Webots
If you have more than one installation of Webots, ROS2 will look for Webots at the following locations (in this order):
If the ROS2_WEBOTS_HOME environment variable is set, ROS2 will use the Webots in this folder.
If the webots_ros2_desktop ROS2 package is installed, ROS2 will use the Webots version included in this package.
If the WEBOTS_HOME environment variable is set, ROS2 will use the Webots in this folder.
If none of the previous point is set/installed ROS2 will look for Webots in the default installation paths (e.g. /usr/local/webots).
From Package Manager
sudo apt-get install ros-$ROS_DISTRO-webots-ros2
The following instructions assume that a ROS2 workspace is already available.
1 source /opt/ros/$ROS_DISTRO/setup.bash 2 3 # Retrieve the sources 4 cd /path/to/ros2_ws/src 5 git clone -b $ROS_DISTRO https://github.com/cyberbotics/webots_ros2.git 6 cd .. 7 8 # Check dependencies 9 rosdep update 10 rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO 11 12 # Building packages 13 colcon build 14 15 # Source this workspace (careful when also sourcing others) 16 source install/setup.bash
1 call C:\dev\ros2\local_setup.bat 2 3 # Install Webots from: https://www.cyberbotics.com/download 4 5 # Retrieve the sources 6 cd /path/to/catkin_ws/src 7 git clone -b $ROS_DISTRO https://github.com/cyberbotics/webots_ros2.git 8 cd .. 9 10 # Check dependencies 11 rosdep update 12 rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO 13 14 # Building packages 15 colcon build 16 17 # Source this workspace (careful when also sourcing others) 18 call install\setup.bat
The packages can now be used as regular ROS packages.
Refer to the colcon tutorial for more information on building ROS2 workspace with colcon.
See the Tutorials page for an overview of the available tutorials.
Contact us / Technical support
For questions about this package or Webots in general, get in touch with the developers on Discord.
Report a Bug
Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components.
More information: rosin-project.eu
This project has received funding from the European Union’s Horizon 2020