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

Cleanup use of the GazeboYarpPlugins::Handler::getHandler() object to actually remove a device once is deleted #618

Merged
merged 9 commits into from
Apr 4, 2022

Conversation

traversaro
Copy link
Member

@traversaro traversaro commented Mar 31, 2022

The changes are the following:

  • The commit f3e0356 modifies gazebo_yarp_robotinterface to not increase device use counter in singleton when device is returned to robotinterface. The rationale is that the handler is not the owner of the YARP device object, that instead are owned (and eventually destroyed before the handler of the gazebo_yarp_robotinterface plugin instance) by the model/sensor plugin that created it.
    It does not make sense to have a usage count that does not reflect it the device is actually valid or not. By doing so, we make sure that the device is actually removed when the device is about to be destroyed.
  • The commit 4e2529f removed a setRobot call in gazebo_yarp_robotinterface that incremented the usage counter of the robot in the singleton, without a corresponding removeRobot.
  • All the other commits just make sure that all the plugins that call setDevice in GazeboYarpPlugins::Handler::getHandler() to register a device also call removeDevice (with the correct argument) once the device is not available anymore. Several setDevice were added recently without a corresponding removeDevice.

…device is returned to robotinterface

The handle is not the owner of the YARP device object, that instead are
owned (and eventually destroyed before the handle) by the plugin.
It does not make sense to have a usage count that does not reflect
it the device is actually valid or not.
@traversaro
Copy link
Member Author

This PR is the first step toward fixing issue 582 with the solution described in #582 (comment) .

@traversaro traversaro force-pushed the fixMissingRemoveDevice branch from f3f0fc4 to 4e2529f Compare April 2, 2022 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants