Skip to content
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

Merged
merged 2 commits into from
Jan 28, 2021

Conversation

pijaro
Copy link
Collaborator

@pijaro pijaro commented Jan 27, 2021

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 always true when passed with "empty regex". Because of that, every topic is always dropped as soon as it is discovered.

This PR changes regex_search with regex_match which is more suitable for this case. Additional test case is also included.

@pijaro pijaro added the bug Something isn't working label Jan 27, 2021
@pijaro pijaro requested a review from a team as a code owner January 27, 2021 15:58
@pijaro pijaro requested review from zmichaels11 and jikawa-az and removed request for a team January 27, 2021 15:58
@adamdbrw
Copy link
Collaborator

Indeed I meant to use regex_match logic there, good catch!

@emersonknapp
Copy link
Collaborator

emersonknapp commented Jan 28, 2021

Gist: https://gist.githubusercontent.com/emersonknapp/a67fff37631acc9e22752cdafef26818/raw/ba38a7af06694891bd32974dbd9e78777c3f7955/ros2.repos
BUILD args: --packages-up-to rosbag2_transport
TEST args: --packages-select rosbag2_transport
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/7541

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: Piotr Jaroszek <[email protected]>
@adamdbrw
Copy link
Collaborator

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(.)*").

@emersonknapp
Copy link
Collaborator

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

@adamdbrw
Copy link
Collaborator

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)

@emersonknapp emersonknapp merged commit 91bf0e6 into master Jan 28, 2021
@delete-merged-branch delete-merged-branch bot deleted the rosbag_regex_exclude_fix branch January 28, 2021 22:03
emersonknapp pushed a commit that referenced this pull request Feb 2, 2021
* Regex and exclude fix for rosbag recorder

Signed-off-by: Piotr Jaroszek <[email protected]>
emersonknapp pushed a commit that referenced this pull request Feb 17, 2021
* Regex and exclude fix for rosbag recorder

Signed-off-by: Piotr Jaroszek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants