Jump to: navigation , search

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

URDF & more

Getting a Copy of the URDF Dynamically

Sawyer generates the URDF dynamically on initialization, based on the attached arm. In some cases, users may want to get the current URDF off the robot. From a working Sawyer 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: sawyer_urdf.xml):

   $ rosparam get -p /robot_description | tail -n +2 > sawyer_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 sawyer_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 > sawyer_urdf.xml
   $ head sawyer_urdf.xml
   |  
     <?xml version="1.0" ?>  
   ...  
   $ gedit sawyer_urdf.xml &
   $ head sawyer_urdf.xml
     <?xml version="1.0" ?>  
   ...