Contact Sensor Plugin does not Provide all information
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?
Asked by antbre on 2023-07-17 09:22:05 UTC
Answers
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 https://github.com/gazebosim/gz-sim/issues/1662#issuecomment-1485840870. 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 https://answers.gazebosim.org/question/28275/update-friction-during-runtime/
Asked by marza1 on 2023-07-24 06:50:25 UTC
Comments