Gazebo | Ignition | Community
Ask Your Question
0

contact sensor has no member named contacts

asked 2016-08-29 05:01:10 -0500

updated 2016-08-29 17:36:37 -0500

I was following this tutorial , but as i try to build the code i get theis error msg:

/usr/include/boost/asio/detail/impl/socket_ops.ipp:266:5: note:   ‘boost::asio::detail::socket_ops::bind’
 int bind(socket_type s, const socket_addr_type* addr,
     ^
/home/rob/Documents/gazebo_contact_tutorial/ContactPlugin.cc: In member function ‘virtual void gazebo::ContactPlugin::OnUpdate()’:
/home/rob/Documents/gazebo_contact_tutorial/ContactPlugin.cc:43:34: error: ‘class gazebo::sensors::ContactSensor’ has no member named ‘Contacts’
   contacts = this->parentSensor->Contacts();

How can i remove this error? I am using ros indigo with gazebo 2.2.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2016-08-29 11:24:49 -0500

chapulina gravatar image

updated 2016-08-29 22:19:00 -0500

For Gazebo 7+, it should be Contacts() with upper case, instead of lower case.

contacts = this->parentSensor->Contacts();

For previous versions:

contacts = this->parentSensor->GetContacts();

Be sure to check the Gazebo version on the tutorial's top-right corner.

edit flag offensive delete link more

Comments

yes i have trieed that. First it was like that, but i changed in to lower case, but no use.

hari1234 gravatar imagehari1234 ( 2016-08-29 15:48:01 -0500 )edit

But with the correct function you're probably getting a different error message, right?

chapulina gravatar imagechapulina ( 2016-08-29 16:42:47 -0500 )edit

no same error: .. has no member named Contacts, i looks at the class ContactSensor reference, i can see that this class has member function called Contacts, but when i try to access it it shows error.

hari1234 gravatar imagehari1234 ( 2016-08-29 17:09:40 -0500 )edit

ahh ok, now I see you're using Gazebo 2.2. You should choose the correct Gazebo version on the top right, the function used to be `GetContacts()`

chapulina gravatar imagechapulina ( 2016-08-29 22:17:28 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-08-29 05:01:10 -0500

Seen: 603 times

Last updated: Aug 29 '16