-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add debug topic to visualize whether MPPI critic has an effect on costs #5485
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
Add debug topic to visualize whether MPPI critic has an effect on costs #5485
Conversation
|
Open points:
|
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 5 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
If just a bool array, how are you labeling / visualizing that? Yeah, I think having the label + score alignment is useful. I suppose even publishing the trajectory scores for each critic would be a useful visualization -- that would replace the Another visualization could be coloring the samples in the candidate_trajectories topic by the accumulated costs of all critics to see how they they penalized by various values. DWB does this I believe. That isn't related to what you're doing yet, but we could use the final scores to adjust the colors of the trajectory markers for each trajectory on some normalized scale. |
I added the labels manually for that screenshot
I think I'm misunderstanding something. You mean publish all the scores of all the trajectories? (nb traj x nb citics ?). Is there one useful score per metric for all the trajectories that would be useful to publish? e.g. mean, sum, etc...?
Yes also thought about it. I'll implement it if I find myself needing it |
The critics have a single It might be useful to |
Signed-off-by: Tony Najjar <[email protected]>
c5e96e5 to
af2cd4b
Compare
|
Got it. For this PR I will stick to only publishing sum but in a way that is extensible. I changed the approach completely to not change the critics. Consider the PR a draft, no need to nitpick now, can you give your review on the general approach before I spend more time into it? |
Signed-off-by: Tony Najjar <[email protected]>
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'm curious about the perf hit, but I don't think it should be that bad.
Something to visualize this in tools/ would be good to pair in this PR so this can be immediately useful to someone
| CriticData & data) const | ||
| { | ||
| for (const auto & critic : critics_) { | ||
| nav2_msgs::msg::CriticsStats stats_msg; |
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.
unique ptr for efficiency reasons
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.
interesting, can you say why more specifically? The object is relatively small, has a short lifetime and doesn't need to be transferred or copied
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.
When you publish a raw message in ROS 2, it gets copied into a unique pointer by the middleware. If you allocate the unique pointer up front and then std::move() into the middleware, then it doesn't have to do that message-sized copy. Plus, if IPC or composition is used, it can also be directly handled which may or may not be entirely zero copy depending on the situation (1-to-1 or 1-to-N).
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.
When you publish a raw message in ROS 2, it gets copied into a unique pointer by the middleware
Okay thanks. It feels like an intermediate-level thing that I should have known. How did you get to know that? Because even the official ROS tutorials don't use a pointer there
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.
Experience and benchmarking :-)
Signed-off-by: Tony Najjar <[email protected]>
Like what? They can use Foxglove or Plotjuggler. Whatever you have in mind, I can't spend much more time on that debug PR |
The additional time taken when |
Like the plotjuggler config you've shown and a 3-5 sentence readme about how to launch with MPPI's
Cool cool |
Signed-off-by: Tony Najjar <[email protected]>
These were Foxglove screenshots, I don't use plotjuggler (sorry Davide if you ever read this). I added the param in the readme and in the docs. I also added a small section explaining more. I wouldn't really add a Foxglove layout config, I think it's more confusing than it helps because the config depends on the order of the critics in their nav2 config - I couldn't find a way to fetch the label from the message. |
Signed-off-by: Tony Najjar <[email protected]>
|
@tonynajjar, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: Tony Najjar <[email protected]>
Signed-off-by: Tony Najjar <[email protected]>
|
@tonynajjar set the param to true https://github.com/ros-navigation/navigation2/blob/main/nav2_system_tests/src/gps_navigation/nav2_no_map_params.yaml#L57 to at least exercise it in CI |
Signed-off-by: Tony Najjar <[email protected]>
edb2cb6 to
8e47961
Compare
…ts (ros-navigation#5485) * Publish criticsStats Signed-off-by: Tony Najjar <[email protected]> * linting Signed-off-by: Tony Najjar <[email protected]> * change header to stamp Signed-off-by: Tony Najjar <[email protected]> * make unique_pointer Signed-off-by: Tony Najjar <[email protected]> * typo Signed-off-by: Tony Najjar <[email protected]> * Add readme Signed-off-by: Tony Najjar <[email protected]> * add to readme Signed-off-by: Tony Najjar <[email protected]> * fixes Signed-off-by: Tony Najjar <[email protected]> --------- Signed-off-by: Tony Najjar <[email protected]>
…ts (#5485) * Publish criticsStats Signed-off-by: Tony Najjar <[email protected]> * linting Signed-off-by: Tony Najjar <[email protected]> * change header to stamp Signed-off-by: Tony Najjar <[email protected]> * make unique_pointer Signed-off-by: Tony Najjar <[email protected]> * typo Signed-off-by: Tony Najjar <[email protected]> * Add readme Signed-off-by: Tony Najjar <[email protected]> * add to readme Signed-off-by: Tony Najjar <[email protected]> * fixes Signed-off-by: Tony Najjar <[email protected]> --------- Signed-off-by: Tony Najjar <[email protected]>
* Return early from edge interpolation for zero-length edges (#5453) * Return early from edge interpolation for zero-length edges Signed-off-by: Emerson Knapp <[email protected]> * Move the check and add a test Signed-off-by: Emerson Knapp <[email protected]> --------- Signed-off-by: Emerson Knapp <[email protected]> * nav2_route vizualization marker rendering performance improvement (#5452) * nav2_route vizualization marker use sphere_list and line_list for rendering performance Signed-off-by: Emerson Knapp <[email protected]> * Fix unit test and break out magic constants into named values Signed-off-by: Emerson Knapp <[email protected]> --------- Signed-off-by: Emerson Knapp <[email protected]> * Fix dynamic param SmacPlannerLattice (#5478) * Fix SmacPlannerLattice dynamic parameter early exit Signed-off-by: Tony Najjar <[email protected]> * remove comment Signed-off-by: Tony Najjar <[email protected]> --------- Signed-off-by: Tony Najjar <[email protected]> * Fix duplicate poses with computePlanThroughPoses (#5488) * fix-duplicate-poses Signed-off-by: Tony Najjar <[email protected]> * Update nav2_planner/src/planner_server.cpp Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Tony Najjar <[email protected]> --------- Signed-off-by: Tony Najjar <[email protected]> Co-authored-by: Steve Macenski <[email protected]> * Fix seg fault (#5501) * Fix segmentation fault Signed-off-by: Tony Najjar <[email protected]> * fix linting Signed-off-by: Tony Najjar <[email protected]> --------- Signed-off-by: Tony Najjar <[email protected]> * Route graph vis fixes: Fixes regressions from #5452 (#5507) * Fixes for route graph Signed-off-by: SteveMacenski <[email protected]> * Fix route graph vis Signed-off-by: SteveMacenski <[email protected]> --------- Signed-off-by: SteveMacenski <[email protected]> * Removing openMP dep on MPPI (#5506) Signed-off-by: SteveMacenski <[email protected]> * Add debug topic to visualize whether MPPI critic has an effect on costs (#5485) * Publish criticsStats Signed-off-by: Tony Najjar <[email protected]> * linting Signed-off-by: Tony Najjar <[email protected]> * change header to stamp Signed-off-by: Tony Najjar <[email protected]> * make unique_pointer Signed-off-by: Tony Najjar <[email protected]> * typo Signed-off-by: Tony Najjar <[email protected]> * Add readme Signed-off-by: Tony Najjar <[email protected]> * add to readme Signed-off-by: Tony Najjar <[email protected]> * fixes Signed-off-by: Tony Najjar <[email protected]> --------- Signed-off-by: Tony Najjar <[email protected]> * fix(nav2_theta_star_planner): Correct typo in CMakeLists ament_export_dependencies (#5514) Signed-off-by: JPLDevMaster <[email protected]> * Fix/dependency and header (#5520) * Add missing dependency declaration Signed-off-by: Sushant Chavan <[email protected]> * Remove unused header Signed-off-by: Sushant Chavan <[email protected]> --------- Signed-off-by: Sushant Chavan <[email protected]> * bump to 1.4.2 for kilted release Signed-off-by: SteveMacenski <[email protected]> * Adding critic manager for refactor Signed-off-by: SteveMacenski <[email protected]> * Update API refactor Signed-off-by: SteveMacenski <[email protected]> * API updates Signed-off-by: SteveMacenski <[email protected]> * Fix formatting issues in critic_manager.hpp Signed-off-by: Steve Macenski <[email protected]> --------- Signed-off-by: Emerson Knapp <[email protected]> Signed-off-by: Tony Najjar <[email protected]> Signed-off-by: SteveMacenski <[email protected]> Signed-off-by: JPLDevMaster <[email protected]> Signed-off-by: Sushant Chavan <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Co-authored-by: Emerson Knapp <[email protected]> Co-authored-by: Tony Najjar <[email protected]> Co-authored-by: João Penha Lopes <[email protected]> Co-authored-by: Sushant Chavan <[email protected]>
…ts (ros-navigation#5485) * Publish criticsStats Signed-off-by: Tony Najjar <[email protected]> * linting Signed-off-by: Tony Najjar <[email protected]> * change header to stamp Signed-off-by: Tony Najjar <[email protected]> * make unique_pointer Signed-off-by: Tony Najjar <[email protected]> * typo Signed-off-by: Tony Najjar <[email protected]> * Add readme Signed-off-by: Tony Najjar <[email protected]> * add to readme Signed-off-by: Tony Najjar <[email protected]> * fixes Signed-off-by: Tony Najjar <[email protected]> --------- Signed-off-by: Tony Najjar <[email protected]>
…ts (ros-navigation#5485) * Publish criticsStats Signed-off-by: Tony Najjar <[email protected]> * linting Signed-off-by: Tony Najjar <[email protected]> * change header to stamp Signed-off-by: Tony Najjar <[email protected]> * make unique_pointer Signed-off-by: Tony Najjar <[email protected]> * typo Signed-off-by: Tony Najjar <[email protected]> * Add readme Signed-off-by: Tony Najjar <[email protected]> * add to readme Signed-off-by: Tony Najjar <[email protected]> * fixes Signed-off-by: Tony Najjar <[email protected]> --------- Signed-off-by: Tony Najjar <[email protected]>
Basic Info
Description of contribution in a few bullet points
Visualize result:
Description of documentation updates required from your changes
Description of how this change was tested
Send navigation goals and checked that the values in the topic make sense according to
threshold_to_considerFuture work that may be required in bullet points
For Maintainers:
backport-*.