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

Move post-processor params into AIKIDO. #579

Merged
merged 29 commits into from
Aug 7, 2020
Merged

Conversation

sniyaz
Copy link

@sniyaz sniyaz commented Jun 26, 2020

A while ago we added post-processor params in libherb with this PR:

https://github.com/personalrobotics/libherb/pull/114

It's time to start moving these into AIKIDO, and this PR starts with the post-processor parms structs. This makes a bunch of new things possible and lets users specify exactly how they'd like to post-process a path. This is relevant, for example, to #558.

This PR does three key things:

  1. Move these param structs into AIKIDO.
  2. Add a getTrajectoryPostProcessor method to ConcreteRobot that takes param struct in and returns the corresponding post-processor.
  3. Add a postProcessPath method to ConcreteRobot that takes param struct in and post-processes according to those params.

TODO

Once this PR merges, update libherb and herb3_demos to use this code instead of what lives there now.


Before creating a pull request

  • Document new methods and classes
  • Format code with make format

Before merging a pull request

  • Set version target by selecting a milestone on the right side
  • Summarize this change in CHANGELOG.md
  • Add unit test(s) for this change

@sniyaz sniyaz requested review from brianhou and egordon June 26, 2020 09:07
@sniyaz sniyaz added this to the Aikido 0.4.0 milestone Jun 26, 2020
@brianhou
Copy link
Contributor

I'd still prefer defining the parameters closer to the actual planner / postprocessor. I think your previous argument was that it was convenient to have all the parameters for one robot in one place that could be easily tweaked, but that isn't quite as convincing to me now that we're defining these default parameters in AIKIDO. What do you think?

@sniyaz
Copy link
Author

sniyaz commented Jun 26, 2020

@brianhou That sounds fair. Would moving the new structs to a location like /include/aikido/planner/PostProcessorParams.hpp sound better to you?

@sniyaz sniyaz closed this Jun 27, 2020
@sniyaz sniyaz reopened this Jun 27, 2020
@sniyaz
Copy link
Author

sniyaz commented Jun 27, 2020

Whoops, bumbling finger accidentally closed this, please ignore that 😅

@brianhou
Copy link
Contributor

I was thinking even closer, like defining the Hauser parameter struct in the same file as the actual postprocessors.

Then, I think we'll need to figure out how to register/construct these parameter structs. For starters, that could be just moving the current PostProcessorParams class to aikido/planner/PostProcessorParams.hpp as you suggested.

@sniyaz
Copy link
Author

sniyaz commented Jun 29, 2020

@brianhou Sweet, that sounds like a good plan! I'll go with that then.

@sniyaz
Copy link
Author

sniyaz commented Jul 10, 2020

@brianhou Can you take a look and see if this new structure is OK with you? I'm working on the libherb PR right now 😄

Copy link
Contributor

@egordon egordon left a comment

Choose a reason for hiding this comment

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

I would recommending implementing this as a template class PostProcessorParams<T>.

Where T is of type aikido::planner::TrajectoryPostProcessor (you can enforce this with static_assert, see here)

In the PostProcessor Classes:
Move the structs HauserParams and KunzParams inside their respective classes, and just call them struct Params, giving them the same default values as the constructor.
Additionally, add the constructor (Eigen::VectorXd _velocityLimits, Eigen::VectorXd _accelerationLimits, Params params) to those postprocessors that you can call from getTrajectoryPostProcessor

In PostProcessorParams:
Have the single constructor be PostProcessorParams(T::Params params = T::Params()) : mParams(params) {}, ensuring that this is only called with PostProcessors that have the Params struct will be enforced at compile-time.

Then you can get rid of PostProcessorType and run-time checks, as getTrajectoryPostProcessor can just be a template function, enforced at compile-time.

Have the public getter function T::Params getParams() access the private variable T::Params mParams.

You can make T a default class (see here) for convenience.

Copy link
Contributor

@egordon egordon left a comment

Choose a reason for hiding this comment

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

Switching to Request changes since I think we should get this templated before merging.

@sniyaz
Copy link
Author

sniyaz commented Jul 23, 2020

@egordon @brianhou Just as a heads up, I just tested this using soda_handoff and things seem to build and work fine 👍

Copy link
Contributor

@egordon egordon left a comment

Choose a reason for hiding this comment

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

Looks good in general, thanks! Just a few nits (won't approve since it will just get overridden when you address them.

@sniyaz
Copy link
Author

sniyaz commented Jul 24, 2020

@egordon I think this is ready to merge, can you take a look when you have the chance?

@sniyaz sniyaz changed the title Start moving post-processor params into AIKIDO. Move post-processor params into AIKIDO. Jul 24, 2020
Copy link
Contributor

@brianhou brianhou 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 doing this! I left a few small comments.

Looking forward, I know we have a bunch of cruft from not having this dispatch function previously. Aside from the libherb and libada compatibility issues, I think we can now:

  • Delete smoothPath, retimePath, and retimePathWithKunz, in favor of the postProcessPath function you've added here.
  • Delete the previous version of getTrajectoryPostProcessor that's hardcoded to return a ParabolicSmoother.

What do you think?

@sniyaz
Copy link
Author

sniyaz commented Jul 31, 2020

@brianhou I think the nits should be responded to, and PostProcessorParams has been killed. LMK if things look good to merge!

Also, my plan to hold off on killing the old post-processing methods (like you suggested) in a separate set of PRs up and through herb3_demos (I'll work on those ASAP once these get merged). My thinking is that we're probably going to break lots of things, and I want to keep these PR sizes more manageable. LMK if that sounds good to you!

Copy link
Contributor

@brianhou brianhou left a comment

Choose a reason for hiding this comment

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

It seems that libherb could use getTrajectoryPostProcessor(metaSkeleton, params) if it existed. Can we add it just for convenience? (And again, it could just dispatch to the more explicit getTrajectoryPostProcessor.)

Aside from that and one other nit, looks pretty good to me. @egordon can you take one final look?

@sniyaz
Copy link
Author

sniyaz commented Jul 31, 2020

@brianhou @egordon Alright, think we're done done now 😅 LMK if anything else looks wrong, and thanks so much again for reviewing!

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.

4 participants