-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
45-50% performance improvement in MPPI controller using Eigen library for computation. #4621
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ayush1285 <[email protected]>
Signed-off-by: Ayush1285 <[email protected]>
Signed-off-by: Ayush1285 <[email protected]>
… files Signed-off-by: Ayush1285 <[email protected]>
Signed-off-by: Ayush1285 <[email protected]>
Signed-off-by: Ayush1285 <[email protected]>
Signed-off-by: Ayush1285 <[email protected]>
This pull request is in conflict. Could you fix it @Ayush1285? |
Signed-off-by: Ayush1285 <[email protected]>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <[email protected]>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <[email protected]>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
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 did a pretty fast review, so far from complete on each detail, but a good starting point!
nav2_mppi_controller/include/nav2_mppi_controller/tools/noise_generator.hpp
Outdated
Show resolved
Hide resolved
nav2_mppi_controller/include/nav2_mppi_controller/tools/noise_generator.hpp
Outdated
Show resolved
Hide resolved
nav2_mppi_controller/include/nav2_mppi_controller/tools/utils.hpp
Outdated
Show resolved
Hide resolved
…ator Signed-off-by: Ayush1285 <[email protected]>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <[email protected]>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Let me know here when you want me to take a look again! I'm quite excited for this work - even if for no reason than to move to Eigen + 10% performance boost, since Eigen's release and support is much more known than xtensor's |
Sure, I'm trying a few optimizations and will push changes once I'm done. |
Signed-off-by: Ayush1285 <[email protected]>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <[email protected]>
I've completed the migration to Eigen. But we need to make sure that functionality-wise everything is correct or not. I'll run tests and ensure that all of them are passing. Meanwhile, you can take a look at the latest changes. |
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
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 did a first look through (didn't analyze in detail the math in the critics, but higher level programming items first), but generally looks good to me with some details to answer!
nav2_mppi_controller/include/nav2_mppi_controller/controller.hpp
Outdated
Show resolved
Hide resolved
nav2_mppi_controller/include/nav2_mppi_controller/optimizer.hpp
Outdated
Show resolved
Hide resolved
vx_last = vx_curr; | ||
|
||
float & wz_curr = control_sequence_.wz(i); | ||
wz_curr = std::clamp(wz_curr, wz_last - max_delta_wz, wz_last + max_delta_wz); |
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.
Worth having a util for clamp that implements this instead of putting inline for each location? It is prone to copy+paste errors
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 think this is still nice-to-have, but I won't block for it
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.
@Ayush1285 thoughts on adding this? it would make things quite a bit more readable and less error prone for future modifiations
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.
We can add an util function. What will it implement? Clamping for all x, y, and z values, or just wrapping std::min(..., std::max())?
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.
Just a wrapper around min(max())
Signed-off-by: Ayush1285 <[email protected]>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
This pull request is in conflict. Could you fix it @Ayush1285? |
@SteveMacenski It seems system tests are passing now after fixing the CostCritic issue but dwb_critics tests failed, Is it a flaky test? On my local system, it is passing. |
Signed-off-by: Ayush1285 <[email protected]>
Signed-off-by: Ayush1285 <[email protected]>
Back from ROSCon / ROS-I meetings now. Reviewing the software / remaining open items today. I think next steps from there are for me to play with this on my machine as well and:
Then good to merge and very publicly thank you for this amazing work 🎆 Is there anything else you think needs to be done here or is planned that we should factor in? I'm noticing on the code coverage report that there are a couple of lines that are no longer being tested that the UX is saying were covered before in the Obstacle Critic and possibly Optimizer (?). Its just a few stray lines, but makes my eyebrows raise a little bit since I'm not sure how that's possible if the tests are unchanged and they appear to be things that should be triggering 🤷 Please go through all open comments (you may need to expand some the GitHub UX collapses) as some are open questions I want the 👍 on that you checked on those things. There are 5 above this 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 got to everything except for the main optimizer file, I ran out of time :(
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.
Completed the full review
Signed-off-by: Ayush1285 <[email protected]>
Signed-off-by: Ayush1285 <[email protected]>
…ed optimizer_benchmark test with critics and params Signed-off-by: Ayush1285 <[email protected]>
@SteveMacenski Verifying the impact of the fast-math compiler flag needs to be done. On my machine, removing fast-math and keeping fma flag resulted in sped up for Eigen.
I'll take a look at it. |
To prevent us from scrolling up through old comments before the last review: the only one left open is the Clamp question where I responded "yes, just |
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.
Otherwise, my only open other things are the clamping util, copy in the util return, stride either mistake or my misunderstanding, and reviewing the test coverage
Everything else is on me to do some functional testing for external validation and this is finally good to be merged! I'm very optimistic we can get this in before the end of the year!
Signed-off-by: Ayush1285 <[email protected]>
Signed-off-by: Ayush1285 <[email protected]>
Signed-off-by: Ayush1285 <[email protected]>
Signed-off-by: Ayush1285 <[email protected]>
Basic Info
Description of contribution in a few bullet points
Description of documentation updates required from your changes
Future work that may be required in bullet points
For Maintainers: