Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualize contacts #112

Closed
chapulina opened this issue Apr 29, 2020 · 6 comments · Fixed by #234
Closed

Visualize contacts #112

chapulina opened this issue Apr 29, 2020 · 6 comments · Fixed by #234
Assignees
Labels
close the gap Features from Gazebo-classic enhancement New feature or request GUI Gazebo's graphical interface (not pure Ignition GUI) rendering Involves Ignition Rendering

Comments

@chapulina
Copy link
Contributor

chapulina commented Apr 29, 2020

Gazebo-classic has an option to enable visualization of all contacts in the world as blue spheres with a green line indicating the force's direction and magnitude. These help users debug their model's surface properties and identify contact points while stepping through simulation.

Ignition Gazebo already has a Contact system which populates the ContactSensorData component.

Here's Gazebo-classic's ContactVisual implementation.

contacts

@chapulina chapulina added enhancement New feature or request GUI Gazebo's graphical interface (not pure Ignition GUI) rendering Involves Ignition Rendering labels Apr 29, 2020
@chapulina chapulina added the close the gap Features from Gazebo-classic label May 29, 2020
@mcres
Copy link
Contributor

mcres commented Jun 26, 2020

I'll take this, as this is partially addressed in #229.

My idea is writing a GUI plugin with a checkbox that allows the user to turn on and off the visualization of the contacts. This plugin would be linked to a source file which could get the contacts in one of the following ways:

  1. Continually check for new ContactSensorData in the Update method.

  2. Subscribe to the contacts already being published by the Contact system.

  3. Modify the Contact system itself and somehow connect the GUI plugin with it (I'm thinking about getting the Contact System instance with the ECM?).

After getting the info, contacts will be visualized with the /marker service.
However, currently the contact messages only return the position, so for the moment the contacts direction would have to be some default value. Work is going on in gazebosim/gz-physics#40.

I belive no. 3 is the best option, but any feedback will be appreciated!

@mabelzhang
Copy link
Contributor

Hey @azeey, since you're the most familiar with the Contact plugin, is there a preference how we want to hook up the contact visualization to it (see suggestions 1-3 above)? Thanks!

@azeey
Copy link
Contributor

azeey commented Jun 29, 2020

Option 1 seems reasonable to me. The GUI plugin should be able to get the contact sensor data from the GUI ECM (almost a copy of the server ECM). We might have to use _contacts->SetData and _ecm.SetChanged in https://github.com/ignitionrobotics/ign-gazebo/blob/9ab1cc3f17173c57028f3c460121a36cbdb0c8d7/src/systems/physics/Physics.cc#L1722

@mcres
Copy link
Contributor

mcres commented Jul 6, 2020

@azeey Would it be currently possible to get the info about all of the contacts in the simulation without requiring the link to have a Contact sensor (i.e. looking for ContactSensorData)? Given this TODO comment, I understand that it is not.

I think that @chapulina meant getting all the contacts, but I don't know if that's possible without modifying too much the physics plugin.

@mcres
Copy link
Contributor

mcres commented Jul 7, 2020

Following the conversation with @azeey : the physics plugin fills the components::ContactSensorData for entities with both ContactSensorData and Collision components.

This means that getting information of <collision> contacts that don't have a <sensor name="contact_sensor" type="contact"> is easily achievable by creating a components::ContactSensorData in the corresponding entity, which in turn will be filled by physics.

@chapulina
Copy link
Contributor Author

Closed by #234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
close the gap Features from Gazebo-classic enhancement New feature or request GUI Gazebo's graphical interface (not pure Ignition GUI) rendering Involves Ignition Rendering
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants