33 GZ_REGISTER_SENSOR_PLUGIN(ContactPlugin)
47 this->
parentSensor = std::dynamic_pointer_cast<sensors::ContactSensor>(_sensor);
52 gzerr <<
"ContactPlugin requires a ContactSensor! \n";
68 msgs::Contacts contacts;
72 for(
unsigned int i = 0; i < contacts.contact_size(); ++i)
74 ROS_INFO_STREAM(
"Collision between [" << contacts.contact(i).collision1()
75 <<
"] and [" << contacts.contact(i).collision2() <<
"] \n");
77 for (
unsigned int j = 0; j < contacts.contact(i).position_size(); ++j)
79 ROS_INFO_STREAM(j <<
" Position:"
80 << contacts.contact(i).position(j).x() <<
" "
81 << contacts.contact(i).position(j).y() <<
" "
82 << contacts.contact(i).position(j).z() <<
"\n");
83 ROS_INFO_STREAM(
" Normal:"
84 << contacts.contact(i).normal(j).x() <<
" "
85 << contacts.contact(i).normal(j).y() <<
" "
86 << contacts.contact(i).normal(j).z() <<
"\n");
87 ROS_INFO_STREAM(
" Depth:"
88 << contacts.contact(i).depth(j) <<
"\n");