ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to visualise collision in rviz

asked 2020-12-11 10:26:14 -0500

Shankrith gravatar image

updated 2021-05-09 18:49:46 -0500

jayess gravatar image

I have created a urdf for a robotic arm using stl meshes for visual tag. Now I want to specify the collision tag. Is there a way to specify different material for the collision and visual tag so that I can check if the collision geometry properly bounds each link. I tried specifying different materials but they all appear the same in rviz. The urdf is as follows

<?xml version="1.0" ?>

<robot name="wsr" xmlns:xacro="http://www.ros.org/wiki/xacro">

<material name="White">
    <color rgba="1 1 1 1"/>
</material>
<material name="Blue">
    <color rgba="0.0 0.0 0.8 1.0"/>
</material>
<link name="base_link">
    <visual>
        <origin xyz="0.0 0.01 0.0" rpy="0.0 0.0 0.0"/>
        <geometry>
            <mesh filename="package://oar_viz/meshes/1-Bottom.stl" scale="0.001 0.001 0.001"/>
        </geometry>
        <material name="White">

        </material>
    </visual>
    <collision>
        <origin xyz="0.0 0.0 0.005" rpy="0.0 0.0 0.0"/>
        <geometry>
            <cylinder radius="0.04" length="0.02"/>
        </geometry>
    </collision>
    <collision>
        <origin xyz="0.0 0.0 -0.01" rpy="0.0 0.0 0.0"/>
        <geometry>
            <cylinder radius="0.07" length="0.02"/>
        </geometry>
    </collision>
</link>

<link name="Link1">
    <visual>
        <origin xyz="0.0 0.0 0.008" rpy="1.57 0.0 0.15"/>
        <geometry>
            <mesh filename="package://oar_viz/meshes/Link1.stl" scale="0.01 0.01 0.01"/>
        </geometry>
        <material name="White">

        </material>
    </visual>
    <collision>
        <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
        <geometry>
            <box size="0.04 0.04 0.05"/>
        </geometry>
        <material name="Blue">

        </material>
    </collision>
</link>

<joint name="base_link_to_Link1" type="revolute">
    <axis xyz="0.0 0.0 1.0"/>
    <limit lower="-3.14" upper="3.14" effort="1000.0" velocity="0.5"/>
    <parent link="base_link"/>
    <child link="Link1"/>
    <origin xyz="0.0 0.0 0.01" rpy="0.0 0.0 0.0"/>
</joint>

<link name="Link2">
    <visual>
        <origin xyz="0.004 0.0 0.0" rpy="-2.355 0.0 0.0"/>
        <geometry>
            <mesh filename="package://oar_viz/meshes/Link2.stl" scale="0.01 0.01 0.01"/>
        </geometry>
    </visual>
</link>

<joint name="Link1_to_Link2" type="revolute">
    <origin xyz="-0.023 -0.042 0.055" rpy="0.0 0.0 0.0"/>
    <parent link="Link1"/>
    <child link="Link2"/>
    <axis xyz="1.0 0.0 0.0"/>
    <limit lower="-0.80" upper="0.35" effort="1000.0" velocity="0.5"/>
</joint>

<link name="Link2_Virtual">
    <visual>
        <origin xyz="0.0 0.0 0.0" rpy="0.0 1.57 0.0"/>
        <geometry>
            <cylinder radius="0.01" length="0.001"/>
        </geometry>
    </visual>
</link> ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-05-09 13:12:23 -0500

LucasGV gravatar image

In rviz, go to the RobotModel display and open it, the second and third options are: Visual Enabled Collision Enable uncheck the visual and check the collision so rviz shows the collision geometry.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2020-12-11 10:26:14 -0500

Seen: 1,261 times

Last updated: May 09 '21