Can I use xacro's $(find some-ros1-package) facility to refer to xacro/urdf files in ros1 packages from within a ros2-sourced environment?

asked 2022-02-15 19:47:55 -0500

Let's say I have a xacro file (custom.urdf.xacro) that I'm writing in a new ROS 2 package:

ROS2 Package: my-ros2-package/urdf/custom.urdf.xacro:

<?xml vrsion="1.0"?>
<robot name="sample-robot" xmlns:xacro="http://ros.org/wiki/xacro">
    <xacro:include filename="$(find my-ros1-package)/urdf/basic.urdf.xacro"/>
   ...
</robot>

... And, I'd like to be able to "include" a URDF from a ros1 package (my-ros1-package/urdf/basic.urdf.xacro) into it. I understand that URDF schema hasn't changed between ROS1 and ROS2, so this should be valid from a content perspective. But, how should I get the $(find my-ros1-package)/urdf/basic.urdf.xacro reference to work inside a xacro file being expanded in a ROS2-sourced environment? I don't want to have to convert the ros1 package into a ros2 package for this.

You can assume a my-ros1-package with a urdf/basic.urdf.xacro file as below:

<?xml vrsion="1.0"?>
<robot name="sample-robot" xmlns:xacro="http://ros.org/wiki/xacro">
    <link...>
    <joint...>
   ...
</robot>

The reason this is important to me is that I have a few levels of nested urdf/xacro content defined across various ROS1 package(s), and I now have a top level ROS2 package that needs to include that hierarchy of content within its own xacro file. What would be needed to get this to work in a ROS2 sourced environment?

edit retag flag offensive close merge delete