Home | Tutorials | Wiki | Issues
Ask Your Question
1

What is the meaning of contacts returned from GetContact (contact sensor)? [closed]

asked 2013-01-15 01:17:28 -0500

Daehyung Park gravatar image

updated 2013-01-15 11:59:22 -0500

When I use Contact sensor in Gazebo 1.3, I am basically using following code.

  // Get all the contacts.
  msgs::Contacts contacts;
  contacts = this->parentSensor->GetContacts();
  for (int i = 0; i < contacts.contact_size(); ++i)
  {
    for (int j = 0; j < contacts.contact(i).position_size(); ++j)
    {
      std::cout << j << "  Position:"
                << contacts.contact(i).position(j).x() << " "
                << contacts.contact(i).position(j).y() << " "
                << contacts.contact(i).position(j).z() << "\n";
    }
  }

The 'GetContacts' function returns many contact informations (in my case, contact_size was 30~50). And each contact includes a bunch of contact positions. I have looked the position data. All contacts includes quite similar position data.

What is the difference between contacts? Is it a group of contact points by position?

I thought if there is two bodies and two contact points between bodies, the contact_size is 2 and each contact includes a bunch of positions that are located in each contact point. Am I correct?

===== Update 1 ======

I use following two objects

  1. PR2's upper arm part

    <link name='l_upper_arm_roll_link'>
      <self_collide>0</self_collide>
      <gravity>0</gravity>
      <pose>0.050000 0.188000 0.790675 0.000000 -0.000000 0.000000</pose>
      <inertial>
        <mass>6.117690</mass>
        <pose>0.210551 0.016309 -0.000561 0.000000 -0.000000 0.000000</pose>
        <inertia>
          <ixx>0.025306</ixx>
          <ixy>-0.003393</ixy>
          <ixz>0.000608</ixz>
          <iyy>0.084737</iyy>
          <iyz>-0.000200</iyz>
          <izz>0.086016</izz>
        </inertia>
      </inertial>
      <collision name='l_upper_arm_roll_link_geom'>
        <geometry>
          <mesh>
            <uri>model://pr2_arm/meshes/shoulder_v0/upper_arm_roll_L.stl</uri>
          </mesh>
        </geometry>
      </collision>
      <visual name='l_upper_arm_roll_link_geom_visual'>
        <geometry>
          <mesh>
            <uri>model://pr2_arm/meshes/shoulder_v0/upper_arm_roll.stl</uri>
          </mesh>
        </geometry>
      </visual>
      <collision name='l_upper_arm_roll_link_geom_l_upper_arm_link'>
        <geometry>
          <mesh>
            <uri>model://pr2_arm/meshes/upper_arm_v0/upper_arm.stl</uri>
          </mesh>
        </geometry>
      </collision>
      <visual name='l_upper_arm_roll_link_geom_l_upper_arm_link_visual'>
        <geometry>
          <mesh>
            <uri>model://pr2_arm/meshes/upper_arm_v0/upper_arm.dae</uri>
          </mesh>
        </geometry>
      </visual>
      <sensor name='l_upper_arm_roll_tactile_sensor' type=contact>
        <contact>
          <collision>l_upper_arm_roll_link_geom_l_upper_arm_link</collision>
          <topic>__default_topic__</topic>
        </contact>
        <plugin name="ros_tactile_plugin" filename="libros_tactile_plugin.so" />
        <always_on>1</always_on>
        <update_rate>100.0</update_rate>
        <visualize>false</visualize>
      </sensor>
      <velocity_decay/>
    </link>
    
  2. Desk

    <link name="link">
      <inertial>
        <mass>50.0</mass>
      </inertial>
      <collision name="surface">
        <pose>0 0 0.6 0 0 0</pose>
        <geometry>
          <box>
            <size>1.5 0.8 0.03</size>
          </box>
        </geometry>
        <surface>
          <friction>
            <ode>
              <mu>500.000000</mu>
              <mu2>500.000000</mu2>
              <slip1>0.000000</slip1>
              <slip2>0.000000</slip2>
            </ode>
          </friction>
          <contact>
            <ode>
              <soft_cfm>0.04</soft_cfm>
              <soft_erp>0.9</soft_erp>
              <kp>50000.0</kp>
              <kd>1.000</kd>
              <max_vel>10.000000</max_vel>
              <min_depth>0.000000</min_depth>
            </ode>
          </contact>
        </surface>
      </collision>
      <visual name="surface">
        <pose>0 0 0.6 0 0 0</pose>
        <geometry>
          <box>
            <size>1.4 0.8 0.04</size>
          </box>
        </geometry>
        <material>
          <script>
            <uri>file://media/materials/scripts/gazebo.material</uri>
            <name>Gazebo/Wood</name>
          </script>
        </material>
      </visual>
    

As we can see, one is mesh object and another one is a box. Could you kindly answer followings?

1. Each triangle of the mesh gives one contact object like 'contacts.contact(0)' when a box and the triangle collide.
2. One contact object ... (more)

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by nkoenig
close date 2013-09-19 09:51:59.122995

Comments

Please also respond to question 559, which asks a similar question and wonders what the timing information means. Thanks, Chris

cga gravatar imagecga ( 2013-01-15 08:33:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-01-15 09:34:09 -0500

nkoenig gravatar image

The number of contacts generated depends a lot on the shapes that are colliding. Two triangle meshes may produce a lot of contacts, while a box colliding with a plan will produce fewer.

The contact sensor is designed to report contacts that occur on one or more Collision objects. So, the contacts you get back are all the contacts that have occurred on the specified collision objects.

I would need to see your SDF file to offer more insight.

edit flag offensive delete link more

Comments

Thanks!! I got new knowledge about the mesh! I updated the SDF information and additional two questions. Could you kindly answer for it? If my understanding is right, I can start to group and simplify the contact sensor information.

Daehyung Park gravatar imageDaehyung Park ( 2013-01-15 12:06:08 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2013-01-15 01:17:28 -0500

Seen: 1,079 times

Last updated: Jan 15 '13