ROS2 Launch Error: xacro Command Fails Due to Missing URDF File

Hello everyone,

I’m encountering an issue when trying to launch a ROS2 node using the stretch_driver.launch.py file. The launch fails with an error related to a missing URDF file. Below is the full error output:

[INFO] [launch]: All log files can be found below /home/hello-robot/.ros/log/2024-08-16-13-51-28-154415-stretch-se3-3045-76651
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): executed command failed. Command: xacro /home/hello-robot/ament_ws/install/stretch_description/share/stretch_description/urdf/stretch.urdf
Captured stderr output: Traceback (most recent call last):
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 1012, in parse
    inp = f = open(filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/hello-robot/ament_ws/install/stretch_description/share/stretch_description/urdf/stretch.urdf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 1119, in _process
    doc = process_file(input_file_name, **opts)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 1096, in process_file
    doc = parse(None, input_file_name)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 1016, in parse
    raise XacroException(e.strerror + ": " + e.filename, exc=e)
xacro.XacroException: No such file or directory: /home/hello-robot/ament_ws/install/stretch_description/share/stretch_description/urdf/stretch.urdf [Errno 2] No such file or directory: '/home/hello-robot/ament_ws/install/stretch_description/share/stretch_description/urdf/stretch.urdf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/humble/bin/xacro", line 33, in <module>
    sys.exit(load_entry_point('xacro==2.0.8', 'console_scripts', 'xacro')())
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 1171, in main
    _process(input_file_name, vars(opts))
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/xacro/__init__.py", line 1124, in _process
    except xml.parsers.expat.ExpatError as e:
AttributeError: module 'xml' has no attribute 'parsers'

What I’ve Tried:

  • Update ROS2 workspace
  • Update Python Libraries
  • Update Firmware

Environment Details:

  • ROS 2 Humble
  • Ubuntu 22.04
  • SE3

Thanks in advance for any help!

The error is simply saying the urdf file doesn’t exists. You might want to go into the source folder and double check if the urdf file is actually there or not.

The stretch_ros2 package on github doesn’t have urdf. the urdf are per-robot specific, if you go through the new machine or new user setup process, the script will delete and re-create a ros2 workspace for you, clone the repos and copy the urdf into it.

1 Like