-
Notifications
You must be signed in to change notification settings - Fork 115
TF prefix helper added #533
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
base: master
Are you sure you want to change the base?
Conversation
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.
Thanks for your contribution. Looks fine in general, please consider my notes below.
Could you also open a PR in ros2_controllers using this method, and change temporarily the entry of control_toolbox in ros2_controllers.rolling.repos to your branch?
|
I made the changes. If looks good, I will continue with the ros2_controllers. |
645ee4b to
1e39750
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #533 +/- ##
==========================================
+ Coverage 83.02% 83.15% +0.12%
==========================================
Files 29 31 +2
Lines 1968 1989 +21
Branches 110 115 +5
==========================================
+ Hits 1634 1654 +20
Misses 268 268
- Partials 66 67 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| * @return The prefixed frame name if prefix is not empty, otherwise the original frame name | ||
| */ | ||
| inline std::string apply_tf_prefix( | ||
| bool tf_prefix_enabled, std::string prefix, const std::string & node_ns, |
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.
| bool tf_prefix_enabled, std::string prefix, const std::string & node_ns, | |
| bool tf_prefix_enabled, const std::string & prefix, const std::string & node_ns, |
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.
And I'm unsure if it is better removing tf_prefix_enabled as an argument, but just use a pattern like tf_prefix_enabled ? apply_tf_prefix(...) : frame; on the calling site? something like apply_tf_prefix(false) feels a bit strange for me. what do you think?
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.
Yes that makes better sense to remove that. I'll do so
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 have a question about the slash normalization design. With the latest version of helper utilized in the controllers(diff, omni, mecanum), their tests succeeds. Currently, it only removes the leading and add one trailing slash to tf prefix. But what about cases when user put multiple slashes or leading slash in the namespace?
I got the test cases for these, is this expected behaviour?
EXPECT_EQ(control_toolbox::apply_tf_prefix("robot2//", "/ns", "odom"), "robot2//odom");
EXPECT_EQ(control_toolbox::apply_tf_prefix("robot", "/ns", "/odom"), "robot//odom");I can also make it ensure there is only one in between:
EXPECT_EQ(control_toolbox::apply_tf_prefix("robot2//", "/ns", "odom"), "robot2/odom");
EXPECT_EQ(control_toolbox::apply_tf_prefix("robot", "/ns", "/odom"), "robot/odom");
EXPECT_EQ(control_toolbox::apply_tf_prefix("robot/", "/ns", "/odom"), "robot/odom");So, shall i change the design or leave as it is?
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
To send us a pull request, please:
colcon testandpre-commit run(requires you to install pre-commit bypip3 install pre-commit)PR related to the issue