Skip to content

Conversation

@ddengster
Copy link
Contributor

@ddengster ddengster commented Jun 3, 2020

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

@gavanderhoorn
Copy link
Contributor

For a use case, moveit sends joint messages with names out of order, so this would be nice to have.

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.

@ddengster
Copy link
Contributor Author

ddengster commented Jun 3, 2020

It's actually a requirement.

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.

@ddengster ddengster changed the title Remap incoming out of order joint messages Remap incoming out of order joint_names in trajectory messages Jun 3, 2020
@gavanderhoorn
Copy link
Contributor

gavanderhoorn commented Jun 3, 2020

Oh?

Yes.

To clarify, I'm talking about trajectory messages having their joint_names jumbled up and the corresponding trajectories moved according to joint_names.

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.

This may not align with the initialization parameters you gave to joint_trajectory_controller.

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.

There was some joint remapping functionality in ros1 joint_trajectory_controller;

Not "some remapping functionality": that code was expressly there to address the point I'm making above.

it was also able to handle partial joints. So in some sense this is a port.

If the current implementation of the JTC in ros2_control cannot deal with orders other than the one in the configuration .yaml, that would be a regression.

@ddengster
Copy link
Contributor Author

oh ok, sounds great to me! seems like i misunderstood what you meant there.

Copy link
Member

@bmagyar bmagyar left a 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 :)

@ddengster ddengster requested a review from bmagyar June 4, 2020 05:05
Copy link
Member

@bmagyar bmagyar left a 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.

@bmagyar bmagyar requested a review from Karsten1987 June 5, 2020 08:59
Copy link
Contributor

@Karsten1987 Karsten1987 left a 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)

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 {
Copy link
Contributor

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 {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix formatting 8628144

@ddengster ddengster changed the title Remap incoming out of order joint_names in trajectory messages Reorder incoming out of order joint_names in trajectory messages Jun 8, 2020
@codecov-commenter
Copy link

codecov-commenter commented Jun 9, 2020

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 32.92%. Comparing base (98b9a51) to head (507cb0e).
Report is 655 commits behind head on master.

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     
Flag Coverage Δ
unittests 32.92% <ø> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 4 files with indirect coverage changes

v-lopez pushed a commit to pal-robotics-forks/ros2_controllers that referenced this pull request Jun 10, 2020
Copy link
Member

@bmagyar bmagyar left a 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

@bmagyar bmagyar merged commit 7c52bec into ros-controls:master Jun 14, 2020
@bmagyar bmagyar mentioned this pull request Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants