-
Notifications
You must be signed in to change notification settings - Fork 769
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ros2: Only subscribe to /gazebo/performance_metrics when necessary (#…
…1205) We are currently subscribing to the /gazebo/performance_metrics topic even if there are no subscribers to the ROS topic forwarding this data. This changes gazebo_ros_init to only subscribe to the gazebo topic if there are any subscribers to the corresponding ROS topic. While advertiser callbacks are used in ROS 1 but are not yet in ROS2, here we use polling in the GazeboRosInitPrivate::PublishSimTime callback to check for subscribers since it is called for each Gazebo time step. This also helps workaround the deadlock documented in #1175 and gazebosim/gazebo-classic#2902. This also adds a macro to reduce duplication of the version checking logic. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
- Loading branch information
Showing
1 changed file
with
25 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters