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

fix division by zero in constraint_critic, leading to cost values being NaNs. These values then propagate through all the critics and results in NaN control_sequence. These NaNs were removed by the hard applyControlSequenceConstraints(), but replaced with ax_max & wz_max. These lead to high turning at the start of a run.

Before the change:
https://github.com/user-attachments/assets/d43f7455-e8b7-4bd6-a8b1-12326bd4ce2b

After the change:
https://github.com/user-attachments/assets/31c06d84-6bec-4b57-bbee-d7d33f944515

Also, a minor change in applyConstraints() to use Eigen Array operations instead of loop and raw pointers. No functional change.

Description of documentation updates required from your changes

None

Description of how this change was tested

  • Tested on simulation and on robot
  • Manually inspected the cost values and control_sequence.wz

Future work that may be required in bullet points

None

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-*.

leading to cost values being NaNs, which then propagate through all the critics and results in NaN control_sequence. These NaNs were removed by the hard applyControlSequenceConstraints(), but replaced with ax_max & wz_max. These lead to high steering at the start of a run

Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
@adivardi adivardi force-pushed the fix_division_by_zero branch from 69abc07 to eb1dec4 Compare October 22, 2025 12:59
Signed-off-by: Adi Vardi <adi.vardi@enway.ai>
@adivardi adivardi force-pushed the fix_division_by_zero branch from 0835690 to f868f6e Compare October 22, 2025 13:07
@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
...ler/include/nav2_mppi_controller/motion_models.hpp 100.00% <100.00%> (ø)
..._mppi_controller/src/critics/constraint_critic.cpp 65.21% <ø> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Nice, love it thanks!

@SteveMacenski SteveMacenski merged commit feb3418 into ros-navigation:main Oct 22, 2025
16 checks passed
@adivardi adivardi deleted the fix_division_by_zero branch October 23, 2025 11:20
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.

2 participants