ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Include model in robot URDF

asked 2017-05-26 09:15:00 -0600

luketheduke gravatar image

I have downloaded a model of a kinect with functioning plugins. How can I add this model into my existing urdf? Thanks, L

edit retag flag offensive close merge delete


You likely want to be looking to xacro. This has the ability to include other URDF and/or xacro files.

jarvisschultz gravatar image jarvisschultz  ( 2017-05-26 09:41:17 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-26 10:59:53 -0600

BrettHemes gravatar image

In general you will want to make a xacro for your composite system (i.e., robots, sensors, environment, etc.). In the industrial world this is equivalent to your workcell. The ROS-Industrial guys have a training unit on creating modular xacro macros for building workcells here. Good macros will accept parent links and relative offsets for easily building configurations.

As an example, you might end up with something that looks like the following for you high-level macro that will create your desired configuration:

<?xml version="1.0" ?>
<robot name="my_robot" xmlns:xacro="">
    <xacro:include filename="$(find my_robot_support)/urdf/awesome_robot_macro.xacro"/>
    <xacro:include filename="$(find my_sensor_a_support)/urdf/sensor_a_macro.xacro"/>
    <xacro:include filename="$(find my_sensor_b_support)/urdf/sensor_b_macro.xacro"/>

    <xacro:property name="pi" value="3.141592"/>

    <!-- the robot -->
    <xacro:awesome_robot />

    <!-- my sensor A (mounted to the table) -->
    <xacro:sensor_a parent_link="$base_link" 
        x_val="0.400" y_val="0.500" z_val="0.000"
        roll="0.000" pitch="0.000" yaw="1.200"/> 

    <!-- my sensor B (mounted to the robot's tool flange) -->
    <xacro:sensor_b parent_link="$tool0" 
        x_val="0.000" y_val="0.000" z_val="0.000"
        roll="${pi/2}" pitch="0.000" yaw="${-pi}"/> 


edit flag offensive delete link more


An alternative pattern would be to create the connecting links and joints outside the xacro macros (ie: at the top-level level). That removes the need for those additional parameters and increases visibility of the connecting structures.

gvdhoorn gravatar image gvdhoorn  ( 2017-05-26 11:18:03 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-05-26 09:15:00 -0600

Seen: 1,061 times

Last updated: May 26 '17