Transparency in Gazebo with XACRO

I tried to display transparent boxes in Gazebo with XACRO. The box_color is rendered properly in RVIZ, however Gazebo/GreyTransparent is only Grey, not transparent in Gazebo.

Is it actually possible to make it transparent in Gazebo with XACRO?

<xacro:macro name="box" params="name parent trans rot">
    <xacro:macro name="box">
        <origin rpy="0 0 0" xyz="0 1.9 1.6"/>
        <geometry>
            <box size="3.00 0.100 3.200"/>
        </geometry>
    </xacro:macro>

    <xacro:macro name="box_color">
        <material name="box_color">
            <color rgba=".6 .2 .4 0.5"/>
        </material>
    </xacro:macro>

    <link name="${name}">

        <visual>
            <transparency>1</transparency>
            <xacro:box/>
            <xacro:box_color/>
        </visual>
        <collision>
            <xacro:box/>
        </collision>

        <xacro:cylinder_inertial radius="0.4" length="0.1" mass="1">
          <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
        </xacro:cylinder_inertial>

    </link>

    <gazebo reference="${name}">
        <material>Gazebo/GreyTransparent</material>
        <selfCollide> False </selfCollide>
    </gazebo>

    <!-- JOINT -->
    <joint name="${name}_joint" type="fixed">
        <parent link="${parent}"/>
        <child link="${name}"/>
        <origin rpy="${rot}" xyz="${trans}"/>
    </joint>
    <gazebo reference="${name}_joint">
        <stopCfm>0.8</stopCfm>
        <stopErp>0.5</stopErp>
        <provideFeedback>true</provideFeedback>
        <implicitSpringDamper>true</implicitSpringDamper>
        <fudgeFactor>0.0</fudgeFactor>
    </gazebo>
</xacro:macro>
1 Like