Conversion of xacro to URDF

After designing the xacro file, we can use the following command to convert it into a UDRF file:

$ rosrun xacro xacro.py pan_tilt.xacro > pan_tilt_generated.urdf

We can use the following line in the ROS launch file for converting xacro to UDRF and use it as a robot_description parameter:

  <param name="robot_description" command="$(find xacro)/xacro.py $(find mastering_ros_robot_description_pkg)/urdf/pan_tilt.xacro" />

We can view the xacro of pan and tilt by making a launch file, and it can be launched using the following command:

$ roslaunch mastering_ros_robot_description_pkg view_pan_tilt_xacro.launch

Get Mastering ROS for Robotics Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.