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

Only subscribe to /gazebo/performance_metrics when necessary #1202

Merged

Conversation

scpeters
Copy link
Member

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>
@scpeters scpeters changed the title Fix performance metrics noetic Only subscribe to /gazebo/performance_metrics when necessary Dec 12, 2020
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.

LGTM

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

I haven't tried running it but it looks like a reasonable workaround 👍

@scpeters scpeters merged commit 33664a2 into ros-simulation:noetic-devel Dec 15, 2020
@scpeters scpeters deleted the fix_performance_metrics_noetic branch December 15, 2020 01:13
scpeters added a commit that referenced this pull request Dec 22, 2020
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.

This also adds a GAZEBO_ROS_HAS_PERFORMANCE_METRICS
macro that reduces duplication of the version checking logic for
performance metrics in gazebo and adds fixes some doc-string and
typos in existing code

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
scpeters added a commit that referenced this pull request Dec 23, 2020
Backport of #1202 to kinetic-level.

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.

This also adds a GAZEBO_ROS_HAS_PERFORMANCE_METRICS
macro that reduces duplication of the version checking logic for
performance metrics in gazebo and adds fixes some doc-string and
typos in existing code

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
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