-
Notifications
You must be signed in to change notification settings - Fork 429
Reorder incoming out of order joint_names in trajectory messages #53
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
Conversation
It's actually a requirement. There is no default order, so it's also impossible to be "out of order". Consumers must make sure to re-order these messages such that they align with whatever assumptions subsequent code has. |
Oh? To clarify, I'm talking about trajectory messages having their joint_names jumbled up and the corresponding trajectories moved according to joint_names. This may not align with the initialization parameters you gave to joint_trajectory_controller. There was some joint remapping functionality in ros1 joint_trajectory_controller; it was also able to handle partial joints. So in some sense this is a port. |
Yes.
Yes, I understand what you are referring to. Consumers / Subscribers / Action servers cannot assume a particular order will be used for the joint names in incoming goals / messages. There has always been the requirement to check whether whatever comes in corresponds to what the server needs.
Of course. Again: there has never been a requirement to maintain that order. So publishers/action clients should be able to use whatever order they want/need. Subscribers/servers have the responsibility to be able to process all incoming orders.
Not "some remapping functionality": that code was expressly there to address the point I'm making above.
If the current implementation of the JTC in |
|
oh ok, sounds great to me! seems like i misunderstood what you meant there. |
bmagyar
left a comment
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 the improvements!
My comments are a little intertwined, make sure to read all first, then they will make more sense :)
joint_trajectory_controller/src/joint_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
joint_trajectory_controller/include/joint_trajectory_controller/trajectory.hpp
Outdated
Show resolved
Hide resolved
joint_trajectory_controller/src/joint_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
joint_trajectory_controller/src/joint_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
joint_trajectory_controller/include/joint_trajectory_controller/joint_trajectory_controller.hpp
Outdated
Show resolved
Hide resolved
joint_trajectory_controller/test/test_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
bmagyar
left a comment
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 @ddengster for this and the swift response to the review! I'm happy for this to go in.
Karsten1987
left a comment
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 don't fully understand what's happening, and might have to give this a second look.
For the time being, please enhance this with some doxygen and general comments, as stuff like this will be extremely tricky to revisit in the future.
At the same time, I appreciate that you went ahead and got some tests in, I would prefer to have more precise unit tests for the two main functions here (mapping and sort_to_local_joint_order)
joint_trajectory_controller/include/joint_trajectory_controller/trajectory.hpp
Outdated
Show resolved
Hide resolved
joint_trajectory_controller/include/joint_trajectory_controller/trajectory.hpp
Outdated
Show resolved
Hide resolved
| std::vector<size_t> mapping_vector(t1.size()); // Return value | ||
| for (typename T::const_iterator t1_it = t1.begin(); t1_it != t1.end(); ++t1_it) { | ||
| typename T::const_iterator t2_it = std::find(t2.begin(), t2.end(), *t1_it); | ||
| if (t2.end() == t2_it) {return std::vector<size_t>();} else { |
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.
that format looks weird. Line break after the {
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.
fix formatting 8628144
joint_trajectory_controller/src/joint_trajectory_controller.cpp
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #53 +/- ##
==========================================
- Coverage 33.12% 32.92% -0.21%
==========================================
Files 12 12
Lines 1123 1215 +92
Branches 740 802 +62
==========================================
+ Hits 372 400 +28
- Misses 103 114 +11
- Partials 648 701 +53
Flags with carried forward coverage won't be shown. Click here to find out more. |
Signed-off-by: Karsten Knese <[email protected]>
…o subscriber as well
Co-authored-by: Karsten Knese <[email protected]>
Co-authored-by: Karsten Knese <[email protected]>
bmagyar
left a comment
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.
@ddengster I'm really happy how this turned out. I'm going to fix up the typos and merge
As per title. For a use case, moveit sends joint messages with names out of order, so this would be nice to have.
siphoned from PR #36