How to visualise collision in rviz
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>
<joint name="Link2_to_Link2_Virtual" type="revolute">
<origin xyz="0.01 -0.13 0.13" rpy="0.0 0.0 0.0"/>
<parent link="Link2"/>
<child link="Link2_Virtual"/>
<axis xyz="1.0 0.0 0.0"/>
<limit lower="-3.14" upper="3.14" effort="1000.0" velocity="0.5"/>
<mimic joint="Link1_to_Link2" multiplier="-1" offset="0" />
</joint>
<link name="Link3">
<visual>
<origin xyz="0.0 0.0 0.0" rpy="-1.57 0.0 0.0"/>
<geometry>
<mesh filename="package://oar_viz/meshes/Link3.stl" scale="0.01 0.01 0.01"/>
</geometry>
</visual>
</link>
<joint name="Link2v_to_Link3" type="revolute">
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<parent link="Link2_Virtual"/>
<child link="Link3"/>
<axis xyz="1.0 0.0 0.0"/>
<limit lower="-0.77" upper="0.45" effort="1000.0" velocity="0.5"/>
</joint>
<link name="Link4">
<visual>
<origin xyz="0.0 0.0 0.0" rpy="0.08 0.0 0.0"/>
<geometry>
<mesh filename="package://oar_viz/meshes/Link4.stl" scale="0.01 0.01 0.01"/>
</geometry>
</visual>
</link>
<joint name="Link3_to_Link4" type="revolute">
<origin xyz="0.0 -0.185 0.055" rpy="0.0 0.0 0.0"/>
<parent link="Link3"/>
<child link="Link4"/>
<axis xyz="1.0 0.0 0.0"/>
<limit lower="-3.14" upper="3.14" effort="1000.0" velocity="0.5"/>
<mimic joint="Link2v_to_Link3" multiplier="-1" offset="0" />
</joint>
</robot>
Asked by Shankrith on 2020-12-11 11:26:14 UTC
Answers
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.
Asked by LucasGV on 2021-05-09 13:12:23 UTC
Comments