Converting xacro to URDF
As already stated, xacro
files can be converted into urdf
files every time. After designing the xacro file, we can use the following command to convert it into a URDF file:
rosrun xacro pan_tilt.xacro > pan_tilt_generated.urdf
We can use the following line in the ROS launch file to convert xacro into URDF and use it as a robot_description
parameter:
<param name="robot_description" command="$(find xacro)/xacro $(find mastering_ros_robot_description_pkg)/urdf/pan_tilt.xacro" />
We can view the xacro of the pan-and-tilt robot 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
After running this command, we should see the same output of the visualization as the URDF file. Now we are ready to do something more complicated. The pan-and-tilt robot only has two joints and so only two degrees of freedom. In the...