Gazebo | Ignition | Community
Ask Your Question
0

How to access contact Information form via the EntityComponentManager?

asked 2023-07-17 12:53:35 -0600

antbre gravatar image

updated 2023-07-18 06:45:35 -0600

I want to create a plugin that publishes the contact forces a specific link experiences along a particular local axis to a specific topic in order to simulate something similar to a pressure sensor. My idea was to collect all current collisions the particular link is in, sum up all the forces and project it onto the particular local axis. However, I already struggle to get the desired contact information. I started by creating a plugin that inherits from the following three interfaces:

public ISystemConfigure
public ISystemPreUpdate
public ISystemPostUpdate

Where I then go on to load all the required sdf parameters in the Configure function and check for time leaps in the PreUpdate. I'm also able to create and publish dummy force messages in the PostUpdate function, however, I can't seem to figure out how to access the true contact forces the link is experiencing. The function is defined as:

void PostUpdate(const UpdateInfo &_info, const EntityComponentManager &_ecm)

I.e., I somehow have access to the contact information via the ecm. Ideally, there'd be something like

std::vector<Contact> gz::physics::GetLinkContactsById(ecm.GetIDByName(link_name))

So what would be the best practice to get the contact information within the PostUpdate step? Are there any examples that are doing this already?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-08-10 10:08:16 -0600

jrtg gravatar image

updated 2023-08-10 11:40:24 -0600

Have a look at the touch plugin, and the waste bin system that I recently wrote.

It shows how to retrieve collisions with a ContactSensorData component and how to retrieve the ContactSensorData info.

The data type is a contacts message which holds zero, one or more contact messages.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-07-17 12:53:35 -0600

Seen: 249 times

Last updated: Aug 10 '23