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

Backport #1202 to melodic-devel: fix performance metrics #1203

Merged

Conversation

scpeters
Copy link
Member

Backport of #1202 to melodic-devel:

We are currently subscribing to the /gazebo/performance_metrics topic even if there are no subscribers to the ROS topic forwarding this data. The link_states and model_states topics currently use an advertise mechanism with callbacks when a subscriber connects or disconnects, so I've used that same pattern for the performance_metrics topic.

This also helps workaround the deadlock documented in #1175 and gazebosim/gazebo-classic#2902.

I've also added the GAZEBO_ROS_HAS_PERFORMANCE_METRICS macro to de-duplicate the gazebo version checking logic and made some minor doc-string and spelling fixes.

This reduces duplication of the version checking logic for
performance metrics in gazebo.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
We are currently subscribing to the /gazebo/performance_metrics topic
even if there are no subscribers to the ROS topic forwarding this data.
The link_states and model_states topics currently use an advertise
mechanism with callbacks when a subscriber connects or disconnects,
so I've used that same pattern for the performance_metrics topic.
This also helps workaround the deadlock documented in ros-simulation#1175 and
gazebosim/gazebo-classic#2902.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Copy link
Collaborator

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change LGTM, though I'm not sure if we care about maintaining ABI compatibility in this case. @chapulina ?

@@ -376,6 +391,7 @@ class GazeboRosApiPlugin : public SystemPlugin
ros::Publisher pub_performance_metrics_;
int pub_link_states_connection_count_;
int pub_model_states_connection_count_;
int pub_performance_metrics_connection_count_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a new member is not ABI compatible.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to revert that change from noetic-devel too?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think about it before. Noetic is an interesting case since it is the last ROS 1 release; maybe an exception can be made.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms of the impact of an ABI break: because this is a plugin, I think breaking its ABI will only cause a problems for binaries of a plugin that links against GazeboRosApiPlugin. I don't know of any plugins that do this.

In terms of working around the ABI break: because this is a SystemPlugin, I think there will only ever be one instance open at a time. So I think we could safely make this a static variable. I'll check with @iche033 to see if he concurs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it a static variable in 043e5dd, which I think will work. I can port this fix to noetic-devel if merge it here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't been strict about ABI compatibility in ROS 1, right @j-rivero ?

Especially with this plugin, I don't think many users may be extending it, probably we shouldn't be installing the header... I wouldn't block on the ABI here...

I think there will only ever be one instance open at a time.

Yeah I think that's the usual use case for this plugin, even though I think technically it can be added more than once, but that could cause other issues with duplicate topics and services...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it sounds like we could merge this either way I think

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're okay with ABI breaks, it might be nice to keep the change the same as the one on noetic-devel for consistency.

I don't mind either way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'll revert 043e5dd to maintain consistency with noetic

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
This reverts commit 043e5dd.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters
Copy link
Member Author

I think the CI test failures are unrelated. I'm going to merge

@scpeters scpeters merged commit 6ce46e3 into ros-simulation:melodic-devel Dec 22, 2020
@scpeters scpeters deleted the fix_performance_metrics_melodic branch December 22, 2020 04:07
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.

None yet

3 participants