-
Notifications
You must be signed in to change notification settings - Fork 260
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
Regex and exclude fix for rosbag recorder #620
Conversation
Signed-off-by: Piotr Jaroszek <[email protected]>
Indeed I meant to use regex_match logic there, good catch! |
Gist: https://gist.githubusercontent.com/emersonknapp/a67fff37631acc9e22752cdafef26818/raw/ba38a7af06694891bd32974dbd9e78777c3f7955/ros2.repos |
Signed-off-by: Piotr Jaroszek <[email protected]>
What can be a bit confusing for some people (certainly was for me) is that colcon semantics of regex is different than in rosbag (and now ros2 bag). Colcon will match "rosba" to all "rosbag2" packages, so it needs to match as prefix ("osba" won't match anything), but does not need to match the whole package name string. In rosbag (and ros2 bag) only full matches are filtered ("/to" won't match "/topic", you need "/to(.)*"). |
This is unrelated to this particular fix - but it's a useful point. It's not too late to change the behavior for the feature, do you think it should work the same as colcon? If so, please consider opening a feature request ticket, I'm not opposed to having it work that way |
I don't have a strong opinion about it - either way someone will be slightly confused for a while (ros1 users in the other case) |
* Regex and exclude fix for rosbag recorder Signed-off-by: Piotr Jaroszek <[email protected]>
* Regex and exclude fix for rosbag recorder Signed-off-by: Piotr Jaroszek <[email protected]>
There is a bug in rosbag recorder when using
--regex
parameter. Currently when--regex
parameter is set and--exclude
parameter is not (which is by default), none of the topics are marked to subscribe.This is caused because of misused
regex_search
method which returns alwaystrue
when passed with "empty regex". Because of that, every topic is always dropped as soon as it is discovered.This PR changes
regex_search
withregex_match
which is more suitable for this case. Additional test case is also included.