HowTo Main - RethinkRobotics/sdk-docs GitHub Wiki

General How To's, Tips, Tricks, etc.

URDF & more

Getting a Copy of the URDF Dynamically

Baxter generates the URDF dynamically on initialization, based on the attached arms. In some cases, users may want to get the current URDF off the robot.
From a working Baxter RSDK environment, export the URDF from the /robot_description parameter on the ROS parameter server where it is stored, to a file of your choice (ex: baxter_urdf.xml):

$ rosparam get -p /robot_description | tail -n +2 > baxter_urdf.xml

The -p outputs the parameter using pretty print. The output urdf is piped through the tail command first to remove a dummy first line - an artifact of the pretty print.

Tip: You can check that you now have a proper URDF by running:

$ rosrun urdf_parser check_urdf baxter_urdf.xml

If this doesn't work, you can just remove the tail command and use a text editor to manually remove the first few lines before the actual xml (all the lines before <?xml version="1.0" ?>).

$ rosparam get -p /robot_description > baxter_urdf.xml
$ head baxter_urdf.xml
|  
  <?xml version="1.0" ?>  
  <!-- =================================================================================== -->  
  <!-- |    This document was autogenerated by xacro from baxterp2.urdf.xacro            | -->  
...  
$ gedit baxter_urdf.xml &
$ head baxter_urdf.xml
  <?xml version="1.0" ?>  
  <!-- =================================================================================== -->  
  <!-- |    This document was autogenerated by xacro from baxterp2.urdf.xacro            | -->  
...