Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

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


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