Wiki

Page

User

hydro:Only showing information from the released package extracted on September 16, 2015 at 10:00 AM. No API documentation available. Please see this page for information on how to submit your repository to our index.

Documentation

The urdfdom_py package provides the urdf_parser_py Python module providing both functions to parse an URDF model from a file or the parameter server and Python classes mapping the URDF information to a Python structure.

The display_urdf script allows the user to display the parsing result. It can be used either with a path to an URDF file (i.e. rosrun urdf_parser_py display_urdf /tmp/robot.urdf) or without any argument. In this case, it connects to the parameter server to retrieve the robot configuration.

History

urdf_parser_py presently has its own package page, which redirects here.

Python API

Here is a brief example showing the different ways to load/parse a URDF model.

1# Load the urdf_parser_py manifest, you use your own package 2# name on the condition but in this case, you need to depend on 3# urdf_parser_py. 4importroslib; roslib.load_manifest('urdfdom_py') 5importrospy 6 7# Import the module 8 9fromurdf_parser_py.urdfimportURDF 10 11# 1. Parse a string containing the robot description in URDF. 12# Pro: no need to have a roscore running. 13# Cons: n/a 14# Note: it is rare to receive the robot model as a string. 15robot = URDF.from_xml_string("<robot name='myrobot'></robot>") 16 17# - OR - 18 19# 2. Load the module from a file. 20# Pro: no need to have a roscore running. 21# Cons: using hardcoded file location is not portable. 22robot = URDF.from_xml_file() 23 24# - OR - 25 26# 3. Load the module from the parameter server. 27# Pro: automatic, no arguments are needed, consistent 28# with other ROS nodes. 29# Cons: need roscore to be running and the parameter to 30# to be set beforehand (through a roslaunch file for 31# instance). 32robot = URDF.from_parameter_server() 33 34# Print the robot 35print(robot)

Once you have retrieved the robot object, please consult the package Python API to know how to browse the structure.