Skip to content

Routing and guidance follow the driving direction - #37

Merged
Monstrofil merged 3 commits into
mainfrom
worktree-nav-heading-reroute
Oct 24, 2026
Merged

Monstrofil merged 3 commits into
mainfrom
worktree-nav-heading-reroute

Conversation

@Monstrofil

Copy link
Copy Markdown
Contributor

Reroutes while driving turned back toward the nearest road point behind the car, and driving back along the route froze guidance. The car's heading is now used for routing and wrong-way detection.

  • ch: the CH router takes a start heading; start nodes behind the car cost OsmAnd's 60 s reverse penalty.
  • routing: the motion heading (moving > 1.5 m/s, kept 30 s after stopping) goes with every route and reroute request, as OsmAnd initialDirection for HH/A* (set before each router, since HH clears it) and as the CH penalty.
  • guidance: driving > 120° against the route direction at the progress point for 5 s asks for a reroute in the driving direction; it does not ask again until the car has driven along a route.

Tests: make test (new cases in ch_test, reroute_state_test, navigation_ui_test); clean QNX make with ELF/ABI checks. Not yet run on the radio or in the car.

🤖 Generated with Claude Code

Monstrofil and others added 3 commits October 24, 2026 21:31
Router::route takes an optional start heading (degrees clockwise from
north). A snapped start node more than 120 degrees off it costs 60 s more,
the same default penalty OsmAnd's own routers charge for starting against
the initial direction, so a reroute while driving continues ahead instead
of turning back to the nearest junction behind. Snap candidates now carry
their node coordinates for the bearing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A route request carried only origin and destination, so a reroute while
driving away from the route started from the nearest road point in
whichever direction was cheapest, usually back the way the car came; every
recalculation then put the turn further behind.

The engine now keeps the motion heading while the car moves faster than
1.5 m/s (the camera's threshold) and for 30 s after it stops, and passes it
with every route and reroute request. The worker sets it as OsmAnd's
initialDirection (radians clockwise from north, the directionRoute
convention) before each router, since HH clears it after a run, and gives
it to the CH planner's start penalty. A parked car has no heading and
routes as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Driving back along the route stays within the 50 m off-route distance, and
progress never counts backwards, so guidance froze and offered no new
route. The tracker now reports the route's direction at the car's progress
point (not the nearest segment, which on a route returning along the other
carriageway points the other way). Driving more than 120 degrees against it
for 5 s while moving asks for a route in the driving direction. It does not
ask again until the car has driven along a route, so a recalculated route
that still begins with a U-turn stands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Monstrofil
Monstrofil merged commit 2ef7a73 into main Oct 24, 2026
1 check passed
@Monstrofil
Monstrofil deleted the worktree-nav-heading-reroute branch October 24, 2026 19:43
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.

1 participant