This repository was archived by the owner on May 31, 2025. It is now read-only.
rosbag play: added option wait-for-subscriber#959
Merged
dirk-thomas merged 4 commits intoros:kinetic-develfrom Jan 17, 2017
Merged
rosbag play: added option wait-for-subscriber#959dirk-thomas merged 4 commits intoros:kinetic-develfrom
dirk-thomas merged 4 commits intoros:kinetic-develfrom
Conversation
dirk-thomas
reviewed
Jan 13, 2017
tools/rosbag/src/play.cpp
Outdated
| ("pause-topics", po::value< std::vector<std::string> >()->multitoken(), "topics to pause playback on") | ||
| ("bags", po::value< std::vector<std::string> >(), "bag files to play back from"); | ||
| ("bags", po::value< std::vector<std::string> >(), "bag files to play back from") | ||
| ("wait-for-subscribers", "wait for subscribers before publishing"); |
Member
There was a problem hiding this comment.
Maybe update the text to wait for at least one subscriber on each topic before publishing to make the condition clearer to the user.
Same for the Python help text.
| foreach(const value_type& pub, publishers_) { | ||
| all_topics_subscribed &= pub.second.getNumSubscribers() > 0; | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Is this loop busy waiting? If yes, something less resource intensive might be good.
mikepurvis
reviewed
Jan 13, 2017
tools/rosbag/src/player.cpp
Outdated
| std::cout << "Waiting for subscribers." << std::endl; | ||
| while (!all_topics_subscribed) { | ||
| all_topics_subscribed = true; | ||
| typedef std::pair<std::string, ros::Publisher> value_type; |
Member
There was a problem hiding this comment.
Might be cleaner to typedef std::map<std::string, ros::Publisher> PublisherMap in the header, and then here you can use PublisherMap::value_type directly in the for loop without needing this duplicated definition.
Member
|
Thank you for the contribution! |
ggallagher01
pushed a commit
to clearpathrobotics/ros_comm
that referenced
this pull request
Jan 26, 2017
* rosbag play: added option wait-for-subscriber * rosbag play: improved help-text of wait-for-subscribers-option * rosbag play: added typedef PublisherMap * rosbag play: mitigated busy waiting by introducing delay
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added an option
--wait-for-subscriber. If this option is chosen,rosbag playwill wait before publishing until every topic has at least one subscriber. This is pretty useful in tests usingrostestif one wants to make sure that no message is dropped because of missing subscribers.