Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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}"/>