<!-- urdf/robot.urdf.xacro -->
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- Should be able to compose with local `.xacros` -->
<xacro:include filename="$(find my_robot)/urdf/macros.xacro"/>
<!-- Should be able to bring `.xacros` installed in the system (via `realsense2_description` for this example)-->
<xacro:include filename="$(find realsense2_description)/urdf/_d435i.urdf.xacro"/>
<!-- Should be able to retrieve xacro args-->
<xacro:arg name="sim" default="true" />
</robot>
# BUILD.bazel
load("@bazel_ros2_rules//lib:ament_index.bzl", "ament_index_share_files")
load("@bazel_ros2_rules//lib:xacro.bzl", "ros_xacro")
# Registers custom ROS package "my_robot" with its share files.
ament_index_share_files(
name = "my_robot_index",
package_name = "my_robot",
srcs = glob(["urdf/**"]),
)
ros_xacro(
name = "robot.urdf",
src = "urdf/robot.urdf.xacro",
ros_packages = [
":my_robot_index", # custom package via ament_index_share_files
"@ros2//:realsense2_description_share", # system package share files
],
xacro_args = ["sim:=true"],
)
It would be good to have a
xacrorule that allows generatingURDF/SDFartifacts.Given the following xacro
Example API