Skip to content

Fix MAX_NON_OBSTACLE_COST in theta star planner (backport #5865) - #5870

Merged
SteveMacenski merged 1 commit into
kiltedfrom
mergify/bp/kilted/pr-5865
Jan 15, 2026
Merged

SteveMacenski merged 1 commit into
kiltedfrom
mergify/bp/kilted/pr-5865

Conversation

@mergify

@mergify mergify Bot commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Basic Info

Info Please fill out this column
Ticket(s) this addresses (add tickets here #1)
Primary OS tested on (Ubuntu, MacOS, Windows)
Robotic platform tested on (Steve's Robot, gazebo simulation of Tally, hardware turtlebot)
Does this PR contain AI generated software? (No; Yes and it is marked inline in the code)
Was this PR description generated by AI software? Out of respect for maintainers, AI for human-to-human communications are banned

Description of contribution in a few bullet points

Description of documentation updates required from your changes

Description of how this change was tested


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

This is an automatic backport of pull request #5865 done by [Mergify](https://mergify.com).

Signed-off-by: mini-1235 <[email protected]>
(cherry picked from commit 018dca9)
@mergify

mergify Bot commented Jan 15, 2026

Copy link
Copy Markdown
Contributor Author

@mergify[bot], all pull requests must be targeted towards the main development branch.
Once merged into main, it is possible to backport to @kilted, but it must be in main
to have these changes reflected into new distributions.

@SteveMacenski
SteveMacenski merged commit 1eb20b4 into kilted Jan 15, 2026
@SteveMacenski
SteveMacenski deleted the mergify/bp/kilted/pr-5865 branch January 15, 2026 17:52
@codecov

codecov Bot commented Jan 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
...ner/include/nav2_theta_star_planner/theta_star.hpp 96.55% <100.00%> (ø)

... and 9 files with indirect coverage changes

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

JayHerpin pushed a commit to Metal-Shark-Sharktech/navigation2 that referenced this pull request Aug 24, 2026
The traversal term is a cost density but was charged once per step at both cost
sites. A diagonal step covers sqrt(2) cells and an axial one 1.0, so 45-degree
travel was charged 1/sqrt(2) of what it should be.

setNeighbors() now scales its charge by the length of the step. losCheck()
charges once per Bresenham cell, which sums to the staircase length rather than
the length of the line, so it counts its charges and normalises the total to the
chord. Both then charge the traversal term over the same distance as the
euclidean term, and the result is independent of the direction of travel in
regions of uniform cost.

It remains a sampled average rather than an exact line integral: a cell the line
clips but the Bresenham trace steps past is not charged.

The README cost function is updated to match, which also clears the dangling
LETHAL_COST references left when that constant was renamed to
MAX_NON_OBSTACLE_COST in ros-navigation#5870, and a find-and-replace corruption in the same
sentence ("the 'neigh' init_rclcpp is to be expanded").

Signed-off-by: Jay Herpin <[email protected]>
JayHerpin pushed a commit to Metal-Shark-Sharktech/navigation2 that referenced this pull request Aug 24, 2026
getCost() remapped every cost through 26 + 0.9*raw, so a cell of raw cost 0 was
charged as 26. Now that the traversal term is charged per unit distance, that
floor is a constant cost per metre, which is exactly what w_euc_cost already is:
a duplicate path-length weight that silently turns w_euc_cost: 1.0 into an
effective 1.0213, with no parameter exposing it.

That also keeps the heuristic loose. w_heuristic_cost is derived from the
declared w_euc_cost and knows nothing about the floor, so h underestimates the
true cost by 0.021290 per metre, which over a 2 km leg is 42.6 m of admissible
but wasted slack. Removing the floor makes the heuristic exact in free space for
any w_euc_cost <= 1.

It also makes the two isSafe() overloads agree. Since ros-navigation#5870 the plain overload
admits a raw cost of 252, while the line-of-sight overload tests the rescaled
252.8 and rejects it, so a cell of cost 252 is expandable as a neighbour but
blocks a line-of-sight shortcut across it. Reading the raw cost makes both admit
the same set.

The cost is standoff from obstacles, since free space no longer carries any
traversal charge at all; raise w_traversal_cost to restore it.

Signed-off-by: Jay Herpin <[email protected]>
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