How to Create a URDF File of the WidowX 250 by Interbotix – ROS 2

In this tutorial, I’ll show you how to use ROS 2 and RViz to visualize the WidowX 250 Robot Arm 6DOF by Trossen Robotics (Interbotix).

widowx-250-trossen-robotics

Prerequisites

  • (Optional) You have completed this tutorial in which I build a URDF file from scratch for the myCobot 280 by Elephant Robotics.

Useful Links

Below are some helpful reference links in case you want to learn more about this robotic arm.

Install the interbotix_xsarm_descriptions Package

The first thing we need to do is to install the interbotix_xsarm_descriptions package. You can see the official GitHub repository here, but we will use the apt package manager to install everything as shown below.

cd ~/ros2_ws/src
git clone -b ${ROS_DISTRO} https://github.com/Interbotix/interbotix_ros_manipulators.git
rm -rf interbotix_ros_manipulators/interbotix_ros_xsarms/examples/

I removed the examples package above since it has build dependencies we don’t need right now.

cd ~/ros2_ws/
colcon build
source ~/.bashrc

If you have build issues, do this:

cd ~/ros2_ws/
rm -rf build/ install/ log/
colcon build
source ~/.bashrc

Check to see if the interbotix_xsarm_descriptions is installed.

ros2 pkg list

Visualize the URDF File

To visualize the URDF file, open a terminal window, and make sure the urdf_tutorial ROS 2 package is installed.

sudo apt-get install ros-${ROS_DISTRO}-urdf-tutorial

Now visualize the URDF.

ros2 launch urdf_tutorial display.launch.py model:=/home/ubuntu/ros2_ws/src/interbotix_ros_manipulators/interbotix_ros_xsarms/interbotix_xsarm_descriptions/urdf/wx250s.urdf.xacro

Under Global Options on the upper left panel of RViz, change the Fixed Frame from base_link to wx250s/base_link.

widowx-250-rviz-1

You can untick the TF option to see the URDF more clearly.

You can use the Joint State Publisher GUI pop-up window to move the links around.

If you want to see the URDF file, go the following link (all of this block is a single command):

cd ~/ros2_ws/src/interbotix_ros_manipulators/interbotix_ros_xsarms/interbotix_xsarm_descriptions/urdf/wx250s.urdf.xacro

That’s it!

How to Create a URDF File of the Gen3 Lite by Kinova – ROS 2

In this tutorial, I’ll show you how to use ROS 2 and RViz to visualize the Gen3 Lite Robot by Kinova Robotics.

gen-3-lite-kinova

Prerequisites

  • (Optional) You have completed this tutorial in which I build a URDF file from scratch for the myCobot 280 by Elephant Robotics.

Useful Links

Here is my GitHub repository for this robotic arm. All the files we will create in this tutorial are also stored there.

Below are some helpful reference links in case you want to learn more about this robotic arm.

Install the kortex_description Package

The first thing we need to do is to install the kortex_description package. You can see the official GitHub repository here, but we will use the apt package manager to install everything as shown below.

sudo apt-get update
sudo apt-get install ros-$ROS_DISTRO-kortex-description

Create a Package

Create a new package called kinova_robot_arm.

In this package, we will create a basic version of the Gen 3 Lite robotic arm made by Kinova Robotics.

Open a new terminal window, and create a new folder named kinova_robot_arm.

cd ~/ros2_ws/src
mkdir kinova_robot_arm
cd kinova_robot_arm

Now create the package where we will store our URDF file.

ros2 pkg create --build-type ament_cmake --license BSD-3-Clause kinova_robot_arm_description
cd kinova_robot_arm_description
mkdir urdf
gedit package.xml

Make your package.xml file look like this:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>kinova_robot_arm_description</name>
  <version>0.0.0</version>
  <description>Xacro and URDF files for the Gen3 Lite Robotic arm by Kinova Robotics.</description>
  <maintainer email="automaticaddison@todo.com">Addison Sears-Collins</maintainer>
  <license>BSD-3-Clause</license>

  <buildtool_depend>ament_cmake</buildtool_depend>
  
  <exec_depend>kortex_description</exec_depend>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>
gedit CMakeLists.txt

Make sure CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 3.8)
project(kinova_robot_arm_description)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(kortex_description REQUIRED)

# Copy necessary files to designated locations in the project
install (
  DIRECTORY urdf
  DESTINATION share/${PROJECT_NAME}
)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

Create a metapackage.

cd  ~/ros2_ws/src/kinova_robot_arm/

I discuss the purpose of a metapackage in this post.

ros2 pkg create --build-type ament_cmake --license BSD-3-Clause kinova_robot_arm
cd ur_robotiq
rm -rf src/ include/
gedit package.xml

Make your package.xml file look like this:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>kinova_robot_arm</name>
  <version>0.0.0</version>
  <description>Automatic Addison support for the Gen3 Lite Robotic arm by Kinova Robotics (metapackage).</description>
  <maintainer email="automaticaddison@todo.com">Addison Sears-Collins</maintainer>
  <license>BSD-3-Clause</license>

  <buildtool_depend>ament_cmake</buildtool_depend>
  
  <exec_depend>kinova_robot_arm_description</exec_depend>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>
gedit CMakeLists.txt

Make sure CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 3.8)
project(kinova_robot_arm)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

Add a README.md:

gedit README.md

I also recommend adding placeholder README.md files to the kinova_robot_arm folder as well as the kinova_robot_arm_description folder.

Now let’s build our new package:

cd ~/ros2_ws

Run this command to install any missing dependencies for your package.

rosdep install --from-paths src --ignore-src -r -y 

Now build the package.

colcon build 

Let’s see if our new package is recognized by ROS 2.

Either open a new terminal window or source the bashrc file like this:

source ~/.bashrc
ros2 pkg list

You can see the newly created package right there at the top.

Create the URDF Files

Create a new urdf folder.

mkdir -p ~/ros2_ws/src/kinova_robot_arm/kinova_robot_arm_description/urdf/
cd kinova_robot_arm

(if you are using Visual Studio Code, type the following…otherwise just create the XACRO file below)

code . 

Create new files inside the ~/ros2_ws/src/kinova_robot_arm/kinova_robot_arm_description/urdf/ folder called:

Now let’s build our new package:

cd ~/ros2_ws
colcon build 
source ~/.bashrc

Visualize the URDF Files

Let’s see the URDF files in RViz first.

All of this is a single command below.

ros2 launch urdf_tutorial display.launch.py model:=/home/ubuntu/ros2_ws/src/kinova_robot_arm/kinova_robot_arm_description/urdf/gen3_lite_gen3_lite_2f.xacro

Under Global Options on the upper left panel of RViz, change the Fixed Frame from base_link to world.

By convention, the red axis is the x-axis, the green axis in the y-axis, and the blue axis is the z-axis.

1-robotic-arm-gen3-lite

You can use the Joint State Publisher GUI pop-up window to move the links around.

Open a new terminal window, and type the following command.

cd ~/Downloads/
ros2 run tf2_tools view_frames

To see the coordinate frames, type:

evince your_file_name.pdf

To close RViz, press CTRL + C.

How to Create a URDF File of the UR3e Robotic Arm – ROS 2

In this tutorial, I will show you how to create a URDF file (Unified Robot Description Format) file of the UR3e robotic arm, the smallest collaborative robotic arm made by Universal Robots.

ur3e-robot-1

Companies like Universal Robots have excellent ROS 2 support and make regular updates to their GitHub. Universal Robots are the market leaders for collaborative robotic arms.

We will visualize the model we will create in RViz, a 3D visualization tool for ROS 2.

At the end of the UR3e robotic arm, we will add a gripper. Specifically, we will attach the Robotiq 2F-85 adaptive gripper.

Prerequisites

  • (Optional) You have completed this tutorial in which I build a URDF file from scratch for the myCobot 280 by Elephant Robotics.

Useful Links

Here is my GitHub repository for this robotic arm. All the files we will create in this tutorial are also stored there.

Below are some helpful reference links in case you want to learn more about this robotic arm.

Install the ur_description Package

The first thing we need to do is to install their package named ur_description.

sudo apt-get update
sudo apt-get install ros-${ROS_DISTRO}-ur-description

Try the quick launch to see the UR3e robotic arm in RViz.

ros2 launch ur_description view_ur.launch.py ur_type:=ur3e
1-ur3e-robotic-arm-rviz

Let’s check out the UR5e robotic arm.

ros2 launch ur_description view_ur.launch.py ur_type:=ur5e
2-ur5e-robotic-arm-rviz

Install the robotiq-description Package for ROS 2

Let’s install the Robotiq gripper packages for ROS 2.

sudo apt install ros-$ROS_DISTRO-robotiq-description
cd ~/ros2_ws/

Try the quick launch to see the 2F-85 adaptive gripper in RViz.

ros2 launch robotiq_description view_gripper.launch.py
3-robotiq-gripper

Create a Package

Create a new package called ur_robotiq.

In this package, we will combine a UR robotic arms (specifically UR3e) made by Universal Robots with a 2F-85 adaptive gripper made by Robotiq.

Open a new terminal window, and create a new folder named ur_robotiq.

cd ~/ros2_ws/src
mkdir ur_robotiq
cd ur_robotiq

Now create the package where we will store our URDF file.

ros2 pkg create --build-type ament_cmake --license BSD-3-Clause ur_robotiq_description
cd ur_robotiq_description
mkdir urdf
gedit package.xml

Make your package.xml file look like this:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>ur_robotiq_description</name>
  <version>0.0.0</version>
  <description>Combines URxe robotic arms made by Universal Robots with a Robotiq gripper.</description>
  <maintainer email="automaticaddison@todo.todo">Addison Sears-Collins</maintainer>
  <license>BSD-3-Clause</license>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <exec_depend>robotiq_description</exec_depend>
  <exec_depend>ur_description</exec_depend>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>
gedit CMakeLists.txt

Make sure CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 3.8)
project(ur_robotiq_description)

# Check if the compiler being used is GNU's C++ compiler (g++) or Clang.
# Add compiler flags for all targets that will be defined later in the 
# CMakeLists file. These flags enable extra warnings to help catch
# potential issues in the code.
# Add options to the compilation process
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# Locate and configure packages required by the project.
find_package(ament_cmake REQUIRED)
find_package(robotiq_description REQUIRED)
find_package(ur_description REQUIRED)

# Copy necessary files to designated locations in the project
install (
  DIRECTORY urdf
  DESTINATION share/${PROJECT_NAME}
)

# Automates the process of setting up linting for the package, which
# is the process of running tools that analyze the code for potential
# errors, style issues, and other discrepancies that do not adhere to
# specified coding standards or best practices.
if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

Create a metapackage.

cd  ~/ros2_ws/src/ur_robotiq/

I discuss the purpose of a metapackage in this post.

ros2 pkg create --build-type ament_cmake --license BSD-3-Clause ur_robotiq
cd ur_robotiq
rm -rf src/ include/
gedit package.xml

Make your package.xml file look like this:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>ur_robotiq</name>
  <version>0.0.0</version>
  <description>Combines URxe robotic arms made by Universal Robots with a Robotiq gripper (metapackage).</description>
  <maintainer email="automaticaddison@todo.todo">Addison Sears-Collins</maintainer>
  <license>BSD-3-Clause</license>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <exec_depend>ur_robotiq_description</exec_depend>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>
gedit CMakeLists.txt

Make sure CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 3.8)
project(ur_robotiq)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

Add this README.md:

gedit README.md

I also recommend adding placeholder README.md files to the ur_robotiq folder as well as the ur_robotiq_description folder.

Now let’s build our new package:

cd ~/ros2_ws

Run this command to install any missing dependencies for your package.

rosdep install --from-paths src --ignore-src -r -y 

Now build the package.

colcon build 

Let’s see if our new package is recognized by ROS 2.

Either open a new terminal window or source the bashrc file like this:

source ~/.bashrc
ros2 pkg list

You can see the newly created package right there at the top.

Create the URDF Files

Create a new urdf folder.

mkdir -p ~/ros2_ws/src/ur_robotiq/ur_robotiq_description/urdf/
cd ur_robotiq

(if you are using Visual Studio Code, type the following…otherwise just create the XACRO file below)

code . 

Create new files inside the ~/ros2_ws/src/ur_robotiq/ur_robotiq_description/urdf/ folder called:

Now let’s build our new package:

cd ~/ros2_ws
colcon build 
source ~/.bashrc

Visualize the URDF Files

Let’s see the URDF files in RViz first.

All of this is a single command below.

ros2 launch urdf_tutorial display.launch.py model:=/home/ubuntu/ros2_ws/src/ur_robotiq/ur_robotiq_description/urdf/ur3e_urdf.xacro

Under Global Options on the upper left panel of RViz, change the Fixed Frame from base_link to world.

By convention, the red axis is the x-axis, the green axis in the y-axis, and the blue axis is the z-axis.

4-visualize-ur3e

You can use the Joint State Publisher GUI pop-up window to move the links around.

Open a new terminal window, and type the following command.

cd ~/Downloads/
ros2 run tf2_tools view_frames

To see the coordinate frames, type:

evince your_file_name.pdf

To close RViz, press CTRL + C.

Now let’s see the Robotiq 2F-85 adaptive gripper.

Make sure this line is set to true in robotiq_2f_85_urdf.xacro.

    <!-- If visualizing just the gripper with no arm, set the true, otherwise, set to false -->
    <xacro:property name="gripper_only" value="true"/>
cd ~/ros2_ws
colcon build 
source ~/.bashrc
ros2 launch urdf_tutorial display.launch.py model:=/home/ubuntu/ros2_ws/src/ur_robotiq/ur_robotiq_description/urdf/robotiq_2f_85_urdf.xacro

Under Global Options on the upper left panel of RViz, change the Fixed Frame from base_link to world.

5-robotiq-gripper

Now let’s see the gripper attached to the robotic arm.

Make sure this line is set to false in robotiq_2f_85_urdf.xacro.

    <!-- If visualizing just the gripper with no arm, set the true, otherwise, set to false -->
    <xacro:property name="gripper_only" value="false"/>
cd ~/ros2_ws
colcon build 
source ~/.bashrc
ros2 launch urdf_tutorial display.launch.py model:=/home/ubuntu/ros2_ws/src/ur_robotiq/ur_robotiq_description/urdf/ur3e_robotiq_2f_85_urdf.xacro

Under Global Options on the upper left panel of RViz, change the Fixed Frame from base_link to world.

6-ur3e-arm-robotiq-2f-85-gripper

That’s it. Keep building!