Home | Tutorials | Wiki | Issues
Ask Your Question

Possible bug with contact detection, values change between collision1 and collision2

asked 2013-05-24 05:03:58 -0600

AndreiHaidu gravatar image


I am using Gazebo 1.8.0 (but also experienced this behavior with older Gazebo versions). I am subscribing to a contact sensor topic, and just printing out the contacts collision1 and collision2 names. However in some cases these values change between them.

For example in case of a collision with a table or the ground floor:

collision1 = robot hand
collision2 = table / ground floor

In case of the objects on the table (spatula, mug, oven):

collision1 = the objects
collision2 = robot hand

Here is the callback function:

void Plugin::OnContact(ConstContactsPtr &_msg)
    if(_msg->contact_size() > 0)
    std::cout << "collision1: " << _msg->contact(_msg->contact_size()-1).collision1().c_str() << std::endl;
    std::cout << "collision2: " << _msg->contact(_msg->contact_size()-1).collision2().c_str() << std::endl;

Here is an output example:

collision1: pancake_maker::pancake_maker_link::pancake_maker_collision
collision2: hit_hand::right_hand_thumb_distal_link::right_hand_thumb_distal_link_geom
collision1: hit_hand::right_hand_thumb_distal_link::right_hand_thumb_distal_link_geom
collision2: ias_kitchen::kitchen_link::kitchen_link_geom_counter_top_island_link

Cheers, Andrei

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-25 00:25:05 -0600

scpeters gravatar image

It's debatable whether it's a bug, but it does make it less convenient to parse contact sensor output. I did this exact thing in MudPlugin.cc:200. The contact data structures are generated by the physics engine and then passed on by the contact sensor without much parsing to avoid performance hits.

It may be convenient to add a variable to custom contact publishers that indicate which collision is attached to the sensor, since the check is already done in ContactManager::NewContact. Feel free to create a feature request if you think that would be useful.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2013-05-24 05:03:58 -0600

Seen: 273 times

Last updated: May 25 '13