Using URDF or Xacro - cyberbotics/webots_ros2 GitHub Wiki
⚠️THE SUPPORT FOR URDF AND XACRO IS DEPRECATED! IT WILL BE REMOVED IN VERSION 2024.0.0.⚠️
Introduction
PROTO files should be used in favor of URDF and Xacro files. They can be added to the world file directly or imported at runtime using the Ros2Supervisor node.
In case you need to import your existing URDF or Xacro files, a conversion tool from URDF or Xacro format is available: urdf2webots.
URDF Import
In this example, we will convert the UR5e robot model available to /webots_ros2_ur_e_description/urdf/ur5e_robot.urdf
to PROTO file that is compatible to Webots:
ros2 run webots_ros2_importer urdf2proto \
--input=$(ros2 pkg prefix webots_ros2_ur_e_description --share)/urdf/ur5e_robot.urdf \
--disable-mesh-optimization \
--output=ur5e_robot.proto
Your PROTO file ur5e_robot.proto
should be available and you can include it in the Webots project by placing it under /protos
of your ROS2 package.
Xacro Import
Similar to URDF, you can use xacro2proto
convert to Xacro files to Webots compatible PROTO files.
ros2 run webots_ros2_importer xacro2proto \
--input=path_to_xacro.xacro \
--disable-mesh-optimization \
--output=path_to_proto.proto