Rosanswers logo

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

Originally posted by luketheduke on ROS Answers with karma: 285 on 2017-05-26

Post score: 0

Original comments

Comment by jarvisschultz on 2017-05-26:
You likely want to be looking to xacro. This has the ability to include other URDF and/or xacro files.


1 Answer 1


Rosanswers logo

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="http://ros.org/wiki/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}"/> 



Originally posted by BrettHemes with karma: 525 on 2017-05-26

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by gvdhoorn on 2017-05-26:
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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.