Skip to content

Conversation

@adivardi
Copy link
Contributor


Basic Info

Info Please fill out this column
Ticket(s) this addresses -
Primary OS tested on Ubuntu
Robotic platform tested on gazebo simulation & real robot
Does this PR contain AI generated software? (No
Was this PR description generated by AI software? No

Description of contribution in a few bullet points

Color trajectories by costs by adding a red component which is inversely proportional to the costs of the visualized trajectories (the lower the cost the more red the trajectory)

image

Description of documentation updates required from your changes

Should this be noted in the documentation?

Description of how this change was tested

Simulation and actual robot. Visually inspect the trajectories and see the color becomes more red/orange for low cost trajectories. The optimal path is chosen from around the low cost trajectories


Future work that may be required in bullet points

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists
  • Should this be backported to current distributions? If so, tag with backport-*.

Color trajectories by costs by adding a red component which is inversely proportional ti the costs of the visualized trajectories (the lower the cost the more red the trajectory)

Signed-off-by: Adi Vardi <[email protected]>
@adivardi adivardi force-pushed the cost_trajectories branch 2 times, most recently from d8ab5e8 to c938564 Compare October 22, 2025 13:08
Signed-off-by: Adi Vardi <[email protected]>
Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

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

What is the change in the computational cost as a result of this? Can you uncomment https://github.com/ros-navigation/navigation2/blob/main/nav2_mppi_controller/src/controller.cpp#L20 and see what the difference is in runtime of the controller?

Also you have a test relating to this seeming to segfault https://app.circleci.com/pipelines/github/ros-navigation/navigation2/16553/workflows/d301d58c-d10b-463a-aced-020932420f54/jobs/48461/tests

Eigen::ArrayXXf x;
Eigen::ArrayXXf y;
Eigen::ArrayXXf yaws;
Eigen::ArrayXf costs;
Copy link
Member

Choose a reason for hiding this comment

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

You could make this a reference that points to costs_ (just would need a constructor and pass it in). I didn't trace this completely to know if this is neat in terms of where Trajectories is constructed, but it would be preferable so that we didn't have that huge copy

Copy link
Member

Choose a reason for hiding this comment

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

I'd also accept another solution that doesn't involve copying the costs vector around. Its quite large.

@tonynajjar
Copy link
Contributor

I just saw this right as I opened: #5643
Seems like my PR is a superset of this one - if something is missing from it let me know

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.

3 participants