Gazebo | Ignition | Community
Ask Your Question
2

I dont understand the CONTACT SENSOR data.

asked 2013-02-18 13:44:29 -0500

Jey_316 gravatar image

updated 2013-02-18 15:50:06 -0500

AndreiHaidu gravatar image

Hi I am doing the gazebo tutorial called: "Sensors Contact Sensors: How to create and get data from contact sensors."

Then I followed the instructions, where I have a box with the contact sensor TAG:

<sensor name='my_contact' type='contact'>
          <contact>
            <collision>box_collision</collision>
          </contact>
        </sensor>

This box is over the ground plane.

ANd i can see the sensor information with the instruction: gztopic echo /gazebo/default/box/link/my_contact

BUt i dont understand what does it mean.

-what does this information mean?

contact {
  collision1: "box::link::box_collision"
  collision2: "ground_plane::link::collision"

position {
    x: -0.500000000462553
    y: 0.49999999823938179
    z: -1.3116396857526524e-11
  }
  position {
    x: 0.499999999537447
    y: 0.49999999830396458
    z: -1.3116396855009743e-11
  }
  normal {
    x: 0
    y: 0
    z: 1
  }
  normal {
    x: 0
    y: 0
    z: 1
  }
  depth: 1.3116396857526524e-11
  depth: 1.3116396855009743e-11
  wrench {
    body_1_name: "box::link::box_collision"
    body_2_name: "ground_plane::link::collision"
    body_1_force {
      x: 0.18159452738357906
      y: -0.58800230161463551
      z: 2.9400153496814356
    }
    body_2_force {
      x: 0
      y: 0
      z: 0
    }
    body_1_torque {
      x: 1.1760044494554212
      y: 1.3792103044659421
      z: 0.2032039939184285
    }
    body_2_torque {
      x: 0
      y: 0
      z: 0
    }
  }
  wrench {
    body_1_name: "box::link::box_collision"
    body_2_name: "ground_plane::link::collision"
    body_1_force {
      x: -0.18159452730762679
      y: -0.5880023016380882
      z: 2.9400153496814232
    }
    body_2_force {
      x: 0
      y: 0
      z: 0
    }
    body_1_torque {
      x: 1.1760044496335631
      y: -1.3792103043140376
      z: -0.20320399391842819
    }
    body_2_torque {
      x: 0
      y: 0
      z: 0
    }
  }
  time {
    sec: 29
    nsec: 599000000
  }
}

...

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2013-02-20 11:06:28 -0500

hsu gravatar image

updated 2013-02-22 15:50:49 -0500

ticketed, and added pull request. Please review and comment in issue.

To answer question in comment by @Jey_316:

  1. Is the body_1_force, proportional to the force of the contact between the two objects?
    • body_1_force is the contact force exerted by the contact joint on center of gravity of the collision1 Link. And similarly, corresponding body_2_force will be the force exerted on collision2 at the center of gravity of the corresponding link. With the exception that if one of the bodies is static (e.g. groundplane, then zero force / torques are returned).
  2. How do i know if there is not contact between the objects?
    • the contact array in contacts.proto will be empty
edit flag offensive delete link more

Comments

OK thank you, so: 1. Is the short answer of the first question "yes"? 2. when you say CG, do you mean "center of gravity"?

Jey_316 gravatar imageJey_316 ( 2013-02-22 15:22:50 -0500 )edit

@Jey_316 I updated answer, hopefully it helps

hsu gravatar imagehsu ( 2013-02-22 15:52:01 -0500 )edit

Ok thanks how do i choose you as the best answer?

Jey_316 gravatar imageJey_316 ( 2013-02-27 16:37:09 -0500 )edit

@Jey_316 just click the check sign under the answer votes at top left of the answer.

bit-pirate gravatar imagebit-pirate ( 2013-02-28 01:26:44 -0500 )edit
0

answered 2013-02-18 16:08:48 -0500

AndreiHaidu gravatar image

updated 2013-02-19 00:50:05 -0500

Hi,

I am not sure about all the information (feel free to correct me), but most of them are kind of obvious:

contact {
  collision1: "box::link::box_collision"
  collision2: "ground_plane::link::collision"

Are the two "collision objects" in collision. Here info about <collision>.

position {
    x: -0.500000000462553
    y: 0.49999999823938179
    z: -1.3116396857526524e-11
  }
  position {
    x: 0.499999999537447
    y: 0.49999999830396458
    z: -1.3116396855009743e-11
  }

The position of the contact point of the two collision objects, do not know why they are different though.

  depth: 1.3116396857526524e-11
  depth: 1.3116396855009743e-11

The penetration depth of the collision objects.

  wrench {
    body_1_name: "box::link::box_collision"
    body_2_name: "ground_plane::link::collision"
    body_1_force {
      x: 0.18159452738357906
      y: -0.58800230161463551
      z: 2.9400153496814356
    }
    body_2_force {
      x: 0
      y: 0
      z: 0
    }
    body_1_torque {
      x: 1.1760044494554212
      y: 1.3792103044659421
      z: 0.2032039939184285
    }
    body_2_torque {
      x: 0
      y: 0
      z: 0
    }
  }

Forces applied on the links in order to correct the penetration depth. As you can see there are no forces applied on the ground floor because it is a static model.

  time {
    sec: 29
    nsec: 599000000
  }

The simulation timestamp.

UDPATE: From Contact class and contact.proto msg you can get all the information you need:

collision1 Name of the first collision object.
collision2 Name of the second collision object.
depths Array of contact depths.
normals Array of force normals.
positions Array of force positions.
time Time at which the contact occured
wrench Array of forces for the contact.

edit flag offensive delete link more

Comments

Thank you for the answer. But, when you say "Penetration depth". Do you mean: "is the depth in a material to which electromagnetic radiation can penetrate. "? or Do you mean a different definition?

Jey_316 gravatar imageJey_316 ( 2013-02-18 18:22:34 -0500 )edit

I was thinking more like, the distance that one collision entered the other after the contact occurred.

AndreiHaidu gravatar imageAndreiHaidu ( 2013-02-19 00:35:19 -0500 )edit

Print out the timing data and try making sense of it. For example, the nanosecond clock advances by a millisecond on what appears to be each solver iteration, while the whole process (many solver iterations) is supposed to take place in 1ms. See http://answers.gazebosim.org/question/559/contact-sensor-6-axis-forcetorque-sensing/

cga gravatar imagecga ( 2013-02-19 08:11:58 -0500 )edit
1

Are the forces reference to the contact point, the link origin, or the link center of mass?

cga gravatar imagecga ( 2013-02-19 08:12:45 -0500 )edit

Seems that penetration depth is some sort of post factum info. I presume that collision check is in discrete time, so if time step is not small enough a fast moving object may "jump through a wall".

Boris gravatar imageBoris ( 2013-02-19 18:38:13 -0500 )edit

@cga, according to gazebo_ros_bumper plugin sources all the forces are given w.r.t. inertial frame. However it would be better to create a new question on this.

Boris gravatar imageBoris ( 2013-02-20 10:04:39 -0500 )edit

I dont understand what the forces mean. 1.Is the body one force, proportional to the force of the contact between the two objects? 2. How do i know if there is not contact between the objects?

Jey_316 gravatar imageJey_316 ( 2013-02-20 11:35:05 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2013-02-18 13:44:29 -0500

Seen: 1,537 times

Last updated: Feb 22 '13