-
Notifications
You must be signed in to change notification settings - Fork 331
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
add a demo of content filter listener #557
Conversation
Signed-off-by: Chen Lihui <[email protected]>
As we know, the content filter has operations as below, I expected that the keyword Is there a limitation in the DDS? |
Signed-off-by: Chen Lihui <[email protected]>
@iuhilnehc-ynos On Fast DDS it should work as expected. See the test cases here RTI Connext, according to this comment, does not support |
Thanks for your information. Sorry, I didn't notice it before.
After confirming, it works fine with |
and comment that rmw_connextdds not supported currently Signed-off-by: Chen Lihui <[email protected]>
Signed-off-by: Chen Lihui <[email protected]>
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.
LGTM!
Could you add a test here?
@wjwwood @clalancette any objection to merge this now? |
Once this demo is merged, i will link this demo to Humble Release Note. (see ros2/ros2_documentation#2396) |
I don't mind it getting merged this late, following your logic, but @clalancette should give his thoughts. I didn't review the demo code yet. |
Could we modify the example to work with both? |
Signed-off-by: Chen Lihui <[email protected]>
Sorry, I don't know how to add a test for this listener_content_filter, it seems the current I expect that running with What I mean is if the test in the above patch can be passed by rmw_cyclonedds_cpp, it seems there is no reason to add it. |
// 'Hello World: 10'. | ||
rclcpp::SubscriptionOptions sub_options; | ||
sub_options.content_filter_options.filter_expression = "data = %0"; | ||
sub_options.content_filter_options.expression_parameters = {"'Hello World: 10'"}; |
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.
Maybe the number (currently 10
) could be configurable by the user.
Maybe that makes the demo more interesting (?).
Feel free to ignore the comment though.
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 actually agree with this comment. probably string chatter example is interesting enough to show this feature. how about filtering specific range of data? that would be one of the most common case?
Yes, that's not going to work because the test is waiting for the output in the file to be printed
You'll need to adapt the test, or adapt the file so it doesn't match the output if "Content filter is not enabled since it's not supported" was logged before (I'm not sure if that's possible). Please don't share a patch, they are hard to understand without being applied to the code to have more context. |
Signed-off-by: Chen Lihui <[email protected]>
@iuhilnehc-ynos all comments are addressed, right? can you confirm? so that we can ask final review to @ivanpauno @wjwwood |
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.
Just curious why not put this kind of thing in ros2/examples
instead?
Signed-off-by: Chen Lihui <[email protected]>
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.
LGTM with @wjwwood approval
@wjwwood friendly ping. |
} else { | ||
RCLCPP_INFO( | ||
this->get_logger(), | ||
"subscribed to topic \"%s\" with filter expression \"data = 'Hello World: 10'\"", |
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.
This is really fragile, since if someone updated the expression and forgot to update this is would be wrong. Violates DRY.
Can we print out the filter expression and parameters from the content_filter_options
directly instead?
// Create a subscription to the topic which can be matched with one or more compatible ROS | ||
// publishers. | ||
// Note that not all publishers on the same topic with the same type will be compatible: | ||
// they must have compatible Quality of Service policies. |
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 comment block needed?
w.r.t. putting it in examples. I think having something here in demos is fine so long as we have a corresponding page about it or the executable is used in some documentation or tutorial. For example, the intra-process demos have this page which shows how to run it, what you should expect to see when you run it, and how it demonstrates that the intra-process feature is working: If we had something similar then this executable makes sense to me. Otherwise, I'd still say examples makes more sense. And I don't think you need a talker equivalent if it is put in examples, the purpose there is to show how to use the API, and it's not part of a tutorial or demo document that tells you to run it and observe some effect. I hope that distinction makes sense. |
@wjwwood @ivanpauno i just created ros2/examples#341. how about the following, sounds like a plan?
|
I'd flip this around so that:
We could set up a new example that uses floats or something like you said, but that would be for the demo/tutorial combo and not the minimal example. |
Signed-off-by: Chen Lihui <[email protected]>
can we address this? current code looks good to us, just adjusting data type for using float to simulate the situation to filtering the sensing data. for doing that, we need to add publisher as well. how about following?
i believe demonstrating with expected common use case would be much easier to get the picture of this feature for user. |
Signed-off-by: Chen Lihui <[email protected]>
@ros-pull-request-builder retest this please |
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.
implementation looks good to me.
demo_nodes_cpp/CMakeLists.txt
Outdated
src/topics/temperature_publisher.cpp | ||
src/topics/temperature_subscriber.cpp |
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.
src/topics/temperature_publisher.cpp | |
src/topics/temperature_subscriber.cpp | |
src/topics/content_filtering_publisher.cpp | |
src/topics/content_filtering_subscriber.cpp |
sorry i was not clear on this, i think files, classes and components can be general names for content filtering, so that user can tell these are related to content filtering.
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.
Example looks really nice!
Thanks for the work!
Do you guys have demo documentation to go with this? Something along the lines of this document: https://docs.ros.org/en/rolling/Tutorials/Intra-Process-Communication.html |
@wjwwood i will be back with PR for that, let me have a couple of days. |
Sure, no problem, I would just hold this until that is ready. |
Signed-off-by: Chen Lihui <[email protected]>
@wjwwood @ivanpauno @iuhilnehc-ynos i just opened ros2/ros2_documentation#2441, could you guys take a look at to give me some feedback? |
either @wjwwood or @clalancette can you merge this with ros2/ros2_documentation#2441 at the same time? |
It seems that CI wasn't run after the last changes, running it: |
@ivanpauno thanks! all green, can you merge this? |
@clalancette can you merge this? i already did ros2/ros2_documentation#2441 |
this is only required to backport humble package. |
@Mergifyio backport humble |
* add a demo of content filter listener Signed-off-by: Chen Lihui <[email protected]> * add warn message if content filter is not supported by DDS Signed-off-by: Chen Lihui <[email protected]> * keep `like` to make the demo simple and comment that rmw_connextdds not supported currently Signed-off-by: Chen Lihui <[email protected]> * remove the macro as it will be removed in the rclcpp Signed-off-by: Chen Lihui <[email protected]> * use = instead of like Signed-off-by: Chen Lihui <[email protected]> * address reviews Signed-off-by: Chen Lihui <[email protected]> * not make this configurable from the cli Signed-off-by: Chen Lihui <[email protected]> * remove comment and update log output Signed-off-by: Chen Lihui <[email protected]> * use temperature instead of chatter Signed-off-by: Chen Lihui <[email protected]> * rename Signed-off-by: Chen Lihui <[email protected]> (cherry picked from commit a1bc6dc)
✅ Backports have been created
|
* add a demo of content filter listener Signed-off-by: Chen Lihui <[email protected]> * add warn message if content filter is not supported by DDS Signed-off-by: Chen Lihui <[email protected]> * keep `like` to make the demo simple and comment that rmw_connextdds not supported currently Signed-off-by: Chen Lihui <[email protected]> * remove the macro as it will be removed in the rclcpp Signed-off-by: Chen Lihui <[email protected]> * use = instead of like Signed-off-by: Chen Lihui <[email protected]> * address reviews Signed-off-by: Chen Lihui <[email protected]> * not make this configurable from the cli Signed-off-by: Chen Lihui <[email protected]> * remove comment and update log output Signed-off-by: Chen Lihui <[email protected]> * use temperature instead of chatter Signed-off-by: Chen Lihui <[email protected]> * rename Signed-off-by: Chen Lihui <[email protected]> (cherry picked from commit a1bc6dc) Co-authored-by: Chen Lihui <[email protected]>
Signed-off-by: Chen Lihui [email protected]