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

F#182 partial trajectory mod #185

Conversation

beatrizleon
Copy link
Contributor

Enables the control of partial trajectories. In order to do this, a trajectory now is composed of a vector of vectors of segments (one vector of segments per each joint), so each joint can a vector with different number of segments.

The changes of code are the minimum I could modify to make it work. If the changes are accepted, we can improve it. Specially, the definition of a segment, as it is only per joint, it does not need a permutation vector, and all its related methods.

All test are passing, but I had to modify some of them to the new implementation. If it is accepted, we can think of new test needed specifically to test partial trajectories.

@adolfo-rt
Copy link
Member

I did a first pass reading the PR. I'll do a second, more detailed one soon and come back with any comments that might arise. I'd also like to do some experimental testing.

Thanks for putting this together.

@beatrizleon
Copy link
Contributor Author

Thanks @adolfo-rt for reviewing it. I found an error in my branch when a new trajectory was send with an empty vector of accelerations. It is fixed now.

template <class Trajectory>
bool IsNotEmpty(typename Trajectory::value_type trajPerJoint)
{
return trajPerJoint.size()>0;
Copy link
Member

Choose a reason for hiding this comment

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

return !trajPerJoint.empty();

@adolfo-rt
Copy link
Member

@beatrizleon Update: I'm in the middle of a detailed code review. I'm about halfway done, and I'd like to give some feedback tomorrow.

@@ -114,6 +113,12 @@ struct InitJointTrajectoryOptions
ros::Time* other_time_base;
};

template <class Trajectory>
bool IsNotEmpty(typename Trajectory::value_type trajPerJoint)
Copy link
Member

Choose a reason for hiding this comment

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

isNotEmpty

@adolfo-rt
Copy link
Member

I ran the tests and tested it in simulation. Seems to work as expected (yay).

Make it opt-in
One important thought: Partial joint specification should be opt-in and disabled by default. Rationale:

When a new command specifying a subset of the joints is processed, the unspecified joints keep on executing their previous goal as if nothing happened. I see potential for robots doing unexpected things when different commands that don't know about each other interact. There's always been the risk of controller clients sending bogus commands and crashing the robot or some other unexpected behavior, but the interaction of conflicting commands within a controller was never an issue. I would consider this an advanced behavior that has to be enabled explicitly, as in I know what I'm doing.

Review thoroughness
Review-wise, I have to confess that the changes are so extensive, that even after having spent a few hours reviewing them, I don't get the feeling of having been thorough enough. It's good that tests are passing, although I don't feel very confident about the completeness of the tolerance checking tests (my fault). When I wrote the tests, that was the only part that was not exercised to the fullest.

To make the test suite more complete and exercise the new feature, I'm thinking of: while the controller executes a trajectory involving all joints (not holding position, but actually moving), send a new command (topic interface) or goal (action interface) that:

  • Send trajectories with all waypoints in the past: Nothing gets executed.
  • Send trajectories with some waypoints on the past, and some in the future: Some get executed.
  • Send trajectories with all waypoints in the future. All get executed, in the future.

I would also like the implementation to be validated on a real-time system.

More

The structure and style of the patch can be improved for better code reading and brevity ,but I'll skip those comments for now.

@beatrizleon
Copy link
Contributor Author

@adolfo-rt Thanks for the review. I am going through your comments now.

@beatrizleon
Copy link
Contributor Author

How are you thinking we could implement the opt-in option?

@adolfo-rt
Copy link
Member

How are you thinking we could implement the opt-in option?

With a ROS parameter, say allow_partial_joint_specification, or something shorter, but equally descriptive. One would have to explicitly set it to True to enable partial joint specification. To enforce the behavior, you would have to do something similar to what was done up to now:

  • When using the action inteface. Keep the check that rejected goals early on, but disable it if allow_partial_joint_specification == True
  • For topic commands, the check that kicked-in was this one. Same story, keep the check, but disable it if allow_partial_joint_specification == True.

Note that these checks relied on the permutation function, which actually checked for permutations (not mappings). As an alternative, you can call your new mapping function and additionally check that the two input vectors have the same size.

@beatrizleon
Copy link
Contributor Author

Added the ros param. I named it: "allow_partial_joints_goal" but it is opened to suggestions :)

@beatrizleon
Copy link
Contributor Author

@adolfo-rt I added a set of tests (very similar to the existing ones) to test partial trajectories which included the ones you mentioned in your previous comment.

We do not have a real time system, then I would not be able to test that.

Appart from that I think I have addressed all your comments. Let me know what you think.

@ugocupcic
Copy link

@adolfo-rt any news on this? We're kind of waiting for that functionality at Shadow :)

Cheers,

Ugo

@sachinchitta
Copy link
Contributor

@ugocupcic - @adolfo-rt did mention on the mailing list that he would be offline for 3 weeks starting Sept. 8.

@ugocupcic
Copy link

Ah! OK thanks @sachinchitta :)

@toliver
Copy link

toliver commented Jan 20, 2016

@adolfo-rt any new on this? If there is anything else that we could improve to get it merged please let us know.

@v4hn
Copy link
Contributor

v4hn commented May 10, 2016

It has been nearly three month since @adolfo-rt was last active on github.
Is there anyone else who could look at that?
It was mentioned that this should be in the kinetic release in ros-controls/ros_control#234 . Is there any reason why this should not be merged into indigo as well?
It would help me quite a lot if it were.

@bmagyar
Copy link
Member

bmagyar commented May 10, 2016

I made the releases for Kinetic and if all goes fine (since it's a well discussed issue) I will merge it to kinetic-devel soon. I'm not sure though if these changes should go to Indigo&Jade as well, so my approach so far was to merge all new stuff to kinetic-devel, and wait for some of our sleeping agents to appear so we can discuss propagating them back to indigo&jade.

@toliver
Copy link

toliver commented May 23, 2016

We are going to try to rebase this branch and open a new PR against kinetic-devel. Hopefully this week or the next.

@bmagyar please let us know if we should also keep this PR open just in case it's getting merged into indigo later on.

@bmagyar
Copy link
Member

bmagyar commented May 23, 2016

Great Toni!

For the rebase may I ask you to also either squash the commits into one huge commit or into bigger chunks so that the "work in progress" type of commits are not reflected in the proposed changes? It's better if we track feature additions rather than the entire development processes.

Once the new PR is open, this can be closed. I am personally ok to push through all the new stuff for ROS Kinetic but if you'd like back-support for Indigo we will have to gather some more people and get a lot more feedback. If you wish to have the Kinetic features in older distros, feel free to open an issue and let's discuss them there.

@bmagyar
Copy link
Member

bmagyar commented Nov 16, 2016

Closing since we merged it to Kinetic.

@bmagyar bmagyar closed this Nov 16, 2016
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.

7 participants