-
Notifications
You must be signed in to change notification settings - Fork 261
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
Auto discovery of new topics #63
Auto discovery of new topics #63
Conversation
224a8a2
to
d3cd7c6
Compare
The macOS slave seems to have a connection problem. |
The macOS build fails because of Clang warnings in non rosbag2 code. |
We added the option New round of CI: |
@@ -41,9 +41,6 @@ class PublisherManager | |||
auto publisher_node = std::make_shared<rclcpp::Node>("publisher" + std::to_string(counter++)); | |||
auto publisher = publisher_node->create_publisher<T>(topic_name); | |||
|
|||
// We need to publish one message to set up the topic for discovery | |||
publisher->publish(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this just legacy or why is this code removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With auto discovery we no longer need to advertise the topic before starting rosbag in the test.
auto subscribe_to_topics = | ||
[this, topics_to_record, topic_polling_interval, is_discovery_disabled] { | ||
do { | ||
auto all_topics_and_types_to_subscribe = topics_to_record.empty() ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is pretty complicated for what it is.
wouldn't it be easier to have this function called once as a blocking call to start the recording and then asynchronously call node_->get_topics_with_types
and subscribe to the not-yet-subscribed once? I think this makes it easier to follow what's happening here.
By extracting the new topics, the call to is_every_topic_subscribed
is then not necessary anymore, because we know which topics to subscribe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By extracting the new topics, the call to
is_every_topic_subscribed
is then not necessary anymore, because we know which topics to subscribe.
I don't understand. In the --all
case we do not know what topics to expect.
rosbag2_transport/src/rosbag2_transport/rosbag2_transport_python.cpp
Outdated
Show resolved
Hide resolved
1 similar comment
- this allows new topics to be discovered also after startup. - as a consquence, ros2 bag record won't throw any exception anymore if the specified topics are not available at startup - each time the recorder subscribes to a new topic, this will be logged to console
- make option available in RecordOptions - set to 100ms for now
- use set for subscribed topics instead of vector - perform the asynchronous call only when discovery is needed
- naming of methods - emphasize similarity between first subscription and discovery loop
6c0d458
to
ee11257
Compare
…s_touch_up small touch ups
Using
ros2 bag record
: Poll regularly for new topics if not all topics have been found yet orros2 bag record
is used with the--all
option to subscribe to all topics.The polling interval is currently set to 100ms and not exposed to the user, but this can easily be amended if necessary.
CI: