Robotics StackExchange | Archived questions

Links with multiple visual tags not showing properly in RVIZ

I’m currently building a URDF for a project, and found the need for adding multiple visual elements (or tags) to a single link. When testing the URDF in RVIZ only the last/bottom of the visual element (from the link with multiple visual elements) show. I have tried to use the command “URDF-preview” from the VS code extension called “ROS”, resulting in only the first/top element showing.

<?xml version"1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" nam="Shotcrete_4200">

    <link name="world"/>
    <joint name="ptSlewing_joint" type="fixed">
        <parent link="world"/>
        <child link="lower_slewing_link"/>
        <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
    </joint>

    <xacro:macro name="slewing_link" params="prefix radius hight z">
        <link name="${prefix}_slewing_link">
            <visual>
                <origin xyz="0.0 0.0 ${z}" rpy="0.0 0.0 0.0"/>
                <geometry>
                    <cylinder radius="${radius}" length="${hight}"/>
                </geometry>  
                <material name="grey"/>
            </visual>
            <collision>
                <origin xyz="0.0 0.0 ${z}" rpy="0.0 0.0 0.0"/>
                <geometry>
                    <cylinder radius="${radius}" length="${hight}"/>
                </geometry>
            </collision>
            <inertial> <!-- Random inertia for gazebo testing --> 
                <origin xyz="0.0 0.0 ${z}" rpy="0.0 0.0 0.0"/>
                <mass value="1"/>
                <inertia ixx="0.1" ixy="0.0" ixz="0.0" iyy="0.1" iyz="0.0" izz="0.1"/>
            </inertial>
        </link>
        <gazebo reference="${prefix}_slewing_link">
            <material>Gazebo/Grey</material>
        </gazebo>
    </xacro:macro>

    <!-- Slweing joints and links -->
    <xacro:property name="slewing_radius" value="1"/>
    <xacro:property name="lower_slewing_hight" value="0.2"/>
    <xacro:property name="slewing_radius" value="1"/>
    <xacro:property name="upper_slewing_hight" value="0.2"/>
    <xacro:slewing_link prefix="lower" radius="${slewing_radius}" hight="${lower_slewing_hight}" z="${lower_slewing_hight/2}"/>
    <xacro:slewing_link prefix="upper" radius="${slewing_radius}" hight="${upper_slewing_hight}"     z="${upper_slewing_hight/2}"/>

    <joint name="slewing_joint" type="revolute">
        <parent link="lower_slewing_link"/>
        <child link="upper_slewing_link"/>
        <origin xyz="0.0 0.0 ${lower_slewing_hight}" rpy="0.0 0.0 0.0"/>
        <axis xyz="0.0 0.0 1.0"/>
        <limit lower="-3.14" upper="3.14" effort="100" velocity="100"/>
    </joint>

    <!-- Base -->
    <xacro:property name="base_hight" value="0.8"/>
    <xacro:property name="base_length" value="0.8"/>
    <xacro:property name="base_width" value="1.8"/>
    <link name="base_link">
        <visual>
            <origin xyz="0.0 0.0 ${base_hight/2}" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="${base_width} ${base_length} ${base_hight}"/>
            </geometry>
            <material name="red"/>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 ${base_hight/2}" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="${base_width} ${base_length} ${base_hight}"/>
            </geometry>
        </collision>
        <inertial> <!-- Random inertia for gazebo testing --> 
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="1"/>
            <inertia ixx="0.1" ixy="0.0" ixz="0.0" iyy="0.1" iyz="0.0" izz="0.1"/>  
        </inertial>
    </link>
    <gazebo reference="base_link">
        <material>Gazebo/Red</material>
    </gazebo>

    <joint name="base_joint" type="fixed">
        <parent link="upper_slewing_link"/>
        <child link="base_link"/>
        <origin xyz="0.0 0.0 ${upper_slewing_hight}" rpy="0.0 0.0 0.0"/>
    </joint>

    <!-- Outer Telescope -->
    <xacro:property name="outer_telescope_hight" value="0.8"/>
    <xacro:property name="outer_telescope_length" value="0.8"/>
    <xacro:property name="outer_telescope_width" value="1.8"/>
    <link name="outer_telescope_link">
        <visual name="v1">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <material name="blue"/>
            <geometry>
                <box size="${outer_telescope_width} ${outer_telescope_length} ${outer_telescope_hight}"/>
            </geometry>
        </visual>
        <collision name="c1">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="${outer_telescope_width} ${outer_telescope_length} ${outer_telescope_hight}"/>
            </geometry>
        </collision>
        <visual name='v2'>
            <origin xyz="5.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <material name="green"/>
            <geometry>
                <box size="0.0 0.0 0.0"/>
            </geometry>
        </visual>
        <collision name='c2'>
            <origin xyz="5.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.0 0.0 0.0"/>
            </geometry>
        </collision>
        <inertial> <!-- Random inertia for gazebo testing --> 
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="1"/>
            <inertia ixx="0.1" ixy="0.0" ixz="0.0" iyy="0.1" iyz="0.0" izz="0.1"/>  
        </inertial>
    </link>
    <gazebo reference="outer_telescope_link">
        <material>Gazebo/Blue</material>
    </gazebo>
    <joint name="outer_telescope_joint" type="revolute">
        <parent link="base_link"/>
        <child link="outer_telescope_link"/>
        <origin xyz="-0.235 0.0 ${0.700}" rpy="0.0 0.0 0.0"/>
        <axis xyz="0.0 0.0 1.0"/>
        <limit lower="-3.14" upper="3.14" effort="100" velocity="100"/>
    </joint>

Asked by Hennifre on 2023-01-25 11:55:29 UTC

Comments

Answers