-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
… files Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
This pull request is in conflict. Could you fix it @Ayush1285? |
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
@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 <ayush.singhftw@gmail.com>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
@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 <ayush.singhftw@gmail.com>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
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
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
@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? |
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
Ah, glad we caught that! I just sent that update to the ARM user that was testing this -- lets see what they say (we're all getting back on the horse from the Holidays, so I imagine it'll be next week at this point) |
@Ayush1285 FYI I took a crack at building the
This was in a Docker container created from image |
I think it is due to because you're trying to build rolling branch of nav2 on Jazzy machine. More precisely, there are lot of C style headers, which were deprecated after launch of Jazzy. For example error that you are facing is due this PR: ros2/message_filters#135 |
From the ARM testing folks at Kiwibot:
It looks like that fix did the job. I'm helping them with some more tests and metrics gathering but its looking good :-) |
Thanks for this PR! We (Kiwibot) tested it on one of our robots running ROS 2 Iron on Ubuntu 22.04 (Jetson AGX, ARM64). The compilation issues we previously encountered with xtensor are now resolved. Using the default bringup parameters, we observed the following performance metrics: 17.1 ms average controller execution time |
I've heard enough good news at this point (only 2 weeks late from EOY)! @Ayush1285 please rebase / pull in main. If CI looks good, I'll merge! Thanks so much for your tireless work and effort here, this is a big improvement in performance and long term maintainability. Even better, this enables this to work well and effectively on Jetson board which were not previously possible due to their relatively weak CPUs. The metrics that @jdgalviss reports from Kiwibot are a major improvement and make it possible to use MPPI even on those boards for production without using insane amount of resources or only able to run at sub-20hz. I can't be happier with how this came out and I look forward to any other contributions you'd be interested in helping out with in Nav2! 😄 |
I've merged it with the latest main. There are two unrelated test failures. One in collision monitor test:
Sure, I'm open to more contributions. |
This pull request is in conflict. Could you fix it @Ayush1285? |
Ugh, I'm sorry to do this to you, but it looks like there are merge conflicts from #4812 which changed the use of Otherwise, I tested and this is good to go 😄
This was a pretty big undertaking - what's your feeling about working on MPPI some more or switching gears into another part of the codebase / new algorithms? On the MPPI front, there are a few open tickets that would be really nice to hvae someone look at:
On other fronts:
|
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
I've fixed the merge conflicts. Let's wait for the CI to run. The optimizer_benchmark was missing a change; it was not updated with the latest evalControl() API changes.
I would like to contribute on other fronts. Playing with new control algorithms and improvising the costmap layer seems exciting ideas to me. Currently, I'm a little short on bandwidth but we can discuss/explore potential ideas for now. |
@Ayush1285, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com>
Understood - want to chat a bit on the Nav2 Slack? By no means feel limited to those thoughts, the world's our oyster 😆 |
@Ayush1285 only small thing that would make a nice followup PR: We talked about compressing some of the rollout stuff a bit more cleanly as so (as a rough hand-written-untested template)
Please ping me in Slack / email and lets chat about next projects when you have some bandwidth -- I can't thank you enough for this great work. I know this took alot of time and effort and it is well worth it for the global impact this has |
Yes, I'll fix it in a follow-up PR.
I'll ping you on Slack. |
… for computation. (ros-navigation#4621) * Initial commit Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Corrected to Eigen Array Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * updated motion model with eigen Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Replaced xtensor with eigen in Optimizer, NoiseGenerator and all Util files Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * updated critics with Eigen Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * optimized Eigen::Array implementation Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * added comment Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Updated path align critic and velocity deadband critic with Eigen Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Updated cost critic and constraint critic with eigen Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Updated utils test with Eigen Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Reverted unnecessary changes and fixed static instance in Noise generator Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * changes std::abs to fabs, clamp to min-max Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Converted tests to Eigen Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Complete conversion from xtensor to Eigen Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * fixed few review comments Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed linters and few review comments Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed mis-merge of AckermannReversingTest Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * fixed gtest assertion Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed optimizer_unit_tests and related issues Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed all the unit tests and critic tests, all unit tests passing locally Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * fixed few review comments Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed CostCritic issue and added test for shiftColumn method Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Added test for new functions Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Removed compiler flags Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * updated test to check first and last columns Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Addressed few review comments Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Changed the obstacle critic implementation to the original way. Updated optimizer_benchmark test with critics and params Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed bugs Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed linter Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Added clamp util function Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed bug Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed review comments: Added utils::clamp method Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixing strided trajectory columns Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * fixed lint error Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed merge Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed optimizer benchmark with latest api changes Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * fixed build error Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> * Fixed new util_test Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> --------- Signed-off-by: Ayush1285 <ayush.singhftw@gmail.com> Signed-off-by: RBT22 <rozgonyibalint@gmail.com>
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: