Gazebo | Ignition | Community
Ask Your Question

Contact Sensor Plugin does not Provide all information

asked 2023-07-17 09:22:05 -0500

antbre gravatar image

When trying to include a contact sensor plugin, the plugin only publishes the contact positions but does not publish contact wrenches or depth. This is also the case when you run the visualize_contacts.sdf example.

E.g. when running the example and echoing the topic via

gz topic -e -t world/visualize_contacts/model/cylinder/link/link/sensor/contact_sensor/contact

The results only show the positions and not force or depth. Is this the intended behavior? And if yes how do I optain the actual contact forces and/or contact depths?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-07-24 06:50:25 -0500

marza1 gravatar image

updated 2023-07-27 09:33:23 -0500

Hi, I have the same problem when I access this data through a custom plugin by

auto contact_sensor_data = _ecm.Component<ignition::gazebo::components::ContactSensorData>(entity_);
auto contact = contact_sensor_data->Data().contact()[0];

Then I get that

contact.position_size(); //is non-zero but
contact.wrench_size(); //and contact.normal_size() are zero

Also when echoing the messages as you did, I only get the positions. It would be nice if you find a solution to make an update on this question.

Update: If you installed the simulator using pre-built binaries (from apt for example) the force, normal and dept feature is not working properly due to an issues with dartsim itself. Take a look at this issue comment in particular You basically need to remove everything ign-gazebo related and install a particular version of dartsim (6.13) and build ignition-gazebo (gz-sim) from source to get it working. Hope it helps.

You still wont be able to get the info using gz topic -e "contact_topic" you have to implement a plugin that fetches this data. For this, please reffer to

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2023-07-17 09:22:05 -0500

Seen: 214 times

Last updated: Jul 27 '23