Home | Tutorials | Wiki | Issues
Ask Your Question
0

contact sensor is not working in Gazebo8 ,Gazebo9 and Gazebo10

asked 2018-02-10 04:01:29 -0500

longwoo gravatar image

updated 2018-02-27 03:24:49 -0500

Carlos Agüero gravatar image
  • In gazebo8 ,gazebo9 and gazebo10 (install from source), the contact atrribute in ContactSensor class is Not work. When I get a ContactSensor by contacts =this->ContactSensor->Contacts(), Then the results of contacts.contact_size(),contacts.contact(0).position_size() and other related values are all zero or empty.

  • But method like this->ContactSensor->IsActive(), this->ContactSensor->GetCollisionName(0) , this->ContactSensor->UpdateRate() and this->ContactSensor->Id() is work. Why?

  • By the way, gazebo4 and gazebo7 is OK.


Problem Solved.It was the name of the collision cause the problem.I had named my contact link in xacro file like this

<link name="simple"> ... <collision name="simple_collision"> ... </link> and use it like this <gazebo reference="simple"> ... <contact> <collision>simple_collision</collision> <topic>/simple_contact</topic> </contact> ... </gazebo> It would Not work in this case. I should Not add a <collision name="simple_collision"> in xacro file. Just use <collision> in xacro file, it will gives you linkname+_collisionautomaticlly.

edit retag flag offensive close merge delete

Comments

It would help if you shared some minimum example which someone can compile to reproduce the error

chapulina gravatar imagechapulina ( 2018-02-25 21:26:38 -0500 )edit

Thank you. You really give me a good idea to debug my code. And I solved it by simplify the model into a box. And find that it was the name of collusion cause the problem.

longwoo gravatar imagelongwoo ( 2018-02-26 02:54:45 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2018-02-26 02:06:44 -0500

mark_vision gravatar image

If your contact sensor is attached to a link connected to another link via a fixed joint, then the problem could be related with a name change in how the merged collision volume is called:

https://bitbucket.org/osrf/sdformat/p...

Check the name of the collision you want to attach your sensor to by generating the SDF file from your Xacro, or check the collision properties directly from Gazebo.

edit flag offensive delete link more

Comments

Thank you. It was the name of the collision cause the problem.

longwoo gravatar imagelongwoo ( 2018-02-26 02:58:42 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-02-10 04:01:29 -0500

Seen: 136 times

Last updated: Feb 27