Gazebo | Ignition | Community
Ask Your Question
0

Use collision for labeling pointcloud

asked 2023-04-24 08:14:48 -0500

felixoben gravatar image

Hello, I simulate a box with objects and gather pointcloud data with an realsense D435. Now I try to label my data so that i know whether a point is at a object or not. I spawn a point/sphere and check every point for a collision with any other object. Unfortunately the collision is not always triggered. I observed if for example the cube is moving and the point is at the moment testing this location than the collision triggers but if the cube is not moving and just standing there and the point is testing the location than no event is triggered.

Can someone tell me why and how i can change that?`

Point SDF:

<?xml version='1.0'?>
  <sdf version="1.4">
    <model name="point">
      <static>true</static>
      <self_collide>1</self_collide>
      <link name="link">
        <inertial>
          <mass>1.0</mass>
           <inertia> <!-- inertias are tricky to compute -->
            <!-- http://gazebosim.org/tutorials?tut=inertia&cat=build_robot -->
            <ixx>0.0025</ixx>       <!-- for a box: ixx = 0.083 * mass * (y*y + z*z) -->
            <ixy>0.0</ixy>         <!-- for a box: ixy = 0 -->
            <ixz>0.0</ixz>         <!-- for a box: ixz = 0 -->
            <iyy>0.0025</iyy>       <!-- for a box: iyy = 0.083 * mass * (x*x + z*z) -->
            <iyz>0.0</iyz>         <!-- for a box: iyz = 0 -->
            <izz>0.0025</izz>       <!-- for a box: izz = 0.083 * mass * (x*x + y*y) -->
          </inertia>
        </inertial>
        <collision name="point_collision">
          <geometry>
            <sphere>
              <radius>{r}</radius>
            </sphere>
          </geometry>
          <surface>
            <contact>
              <collide_without_contact>true</collide_without_contact>
            </contact>
          </surface>
        </collision>
        <visual name="visual">
          <geometry>
            <sphere>
              <radius>{r}</radius>
            </sphere>
          </geometry>
          <material><script><name>Gazebo/Yellow</name></script></material>
        </visual>
        <sensor name='my_contact' type='contact'>
          <update_rate>200.0</update_rate>
          <always_on>1</always_on>
          <contact>
            <collision>point_collision</collision>
          </contact>
        </sensor>
      </link>
    </model>
  </sdf>

Cube/Box SDF:

<?xml version='1.0'?>
<sdf version="1.4">
  <model name="MODEL_NAME">
    <pose>0 0 0.5 0 0 0</pose>
    <static>ISSTATIC</static>
    <self_collide>1</self_collide>
    <link name="link">
      <inertial>
        <mass>0.2</mass>
        <inertia> <!-- inertias are tricky to compute -->
          <!-- http://gazebosim.org/tutorials?tut=inertia&cat=build_robot -->
          <ixx>0.083</ixx>       <!-- for a box: ixx = 0.083 * mass * (y*y + z*z) -->
          <ixy>0.0</ixy>         <!-- for a box: ixy = 0 -->
          <ixz>0.0</ixz>         <!-- for a box: ixz = 0 -->
          <iyy>0.083</iyy>       <!-- for a box: iyy = 0.083 * mass * (x*x + z*z) -->
          <iyz>0.0</iyz>         <!-- for a box: iyz = 0 -->
          <izz>0.083</izz>       <!-- for a box: izz = 0.083 * mass * (x*x + y*y) -->
        </inertia>
      </inertial>
      <collision name="box_collision">
        <geometry>
          <box>
            <size>0.05 0.05 0.05</size>
          </box>
        </geometry>
        <!--<pose>{x} {y} {z} 0 0 0</pose>-->
      </collision>
      <visual name="visual">
        <geometry>
          <box>
            <size>0.05 0.05 0.05</size>
          </box>
        </geometry>
        <material><script><name>Gazebo/Blue</name></script></material>
      </visual>
      <!--
      <sensor name='my_contact' type='contact'>
        <contact>
          <collision>box_collision</collision>
        </contact>
      </sensor>
      -->
    </link>
  </model>
</sdf>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-04-26 05:33:43 -0500

felixoben gravatar image

updated 2023-04-26 05:34:02 -0500

Solution to add sensor also to box.sdf:

<?xml version='1.0'?>
<sdf version="1.4">
  <model name="MODEL_NAME">
    <pose>0 0 0.5 0 0 0</pose>
    <static>ISSTATIC</static>
    <self_collide>1</self_collide>
    <link name="link">
      <inertial>
        <mass>0.2</mass>
        <inertia> <!-- inertias are tricky to compute -->
          <!-- http://gazebosim.org/tutorials?tut=inertia&cat=build_robot -->
          <ixx>0.083</ixx>       <!-- for a box: ixx = 0.083 * mass * (y*y + z*z) -->
          <ixy>0.0</ixy>         <!-- for a box: ixy = 0 -->
          <ixz>0.0</ixz>         <!-- for a box: ixz = 0 -->
          <iyy>0.083</iyy>       <!-- for a box: iyy = 0.083 * mass * (x*x + z*z) -->
          <iyz>0.0</iyz>         <!-- for a box: iyz = 0 -->
          <izz>0.083</izz>       <!-- for a box: izz = 0.083 * mass * (x*x + y*y) -->
        </inertia>
      </inertial>
      <collision name="box_collision">
        <geometry>
          <box>
            <size>0.05 0.05 0.05</size>
          </box>
        </geometry>
        <!--<pose>{x} {y} {z} 0 0 0</pose>-->
      </collision>
      <visual name="visual">
        <geometry>
          <box>
            <size>0.05 0.05 0.05</size>
          </box>
        </geometry>
        <material><script><name>Gazebo/Blue</name></script></material>
      </visual>
      <sensor name='my_contact' type='contact'>
        <contact>
          <collision>box_collision</collision>
        </contact>
      </sensor>
    </link>
  </model>
</sdf>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-04-24 08:14:48 -0500

Seen: 27 times

Last updated: Apr 26 '23