Skip to content

Using URDF or Xacro

Benjamin Hug edited this page Mar 4, 2022 · 6 revisions

A tool that allows conversion from URDF or Xacro format is shipped with the webots_ros2 package. You can benefit from the tool to import premade robot models to Webots.

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
Clone this wiki locally