Skip to content

pycvc: vehicle routes (plan_vehicle_route, route_follower), the route vehicle, a belief raster - #745

Merged
transfix merged 2 commits into
masterfrom
feat/pycvc-vehicle-routes
Oct 20, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/pycvc-vehicle-routes

Conversation

@transfix

Copy link
Copy Markdown
Owner

Summary

A vehicle with a turning radius should drive a planned route, not nav's carrot. The carrot FSM's wall-follow target (1.6 normalized units off the wall) can sit inside the turning circle, and the vehicle then hunts between gears forever. That is the stall behind CVC-Lab/GRL-SNAM's Jolt squad test: on libcvc 3.7.0, with 5–10 cm start offsets, both RoboRacers arrive in only 4 of 10 runs. libcvc's own finale and cvcdbg already drive vehicle routes on a plant; Python could not. pycvc_nav.i now wraps:

  • nav_plan_vehicle_route(occ, bounds, start pose, goal, vehicle, options) → reached, poses (M,4) [x, y, heading, reverse], cusps, length, reverse_length, expansions. The GIL is released while it searches.
  • nav_route_clearance(occ, bounds, pose, vehicle).
  • nav_route_follower_create(sim, options) / _set / _clear / _apply / _status. The follower's capsule holds a reference to its sim_world capsule, as sim_thread's does.
  • nav_sim_world_route_vehicle(sim, i): agent i's route vehicle from the plant (None on nav's bicycle): min_radius = wheelbase / tan(max_steer), the body discs from plant_plan_of, and the sim's reach, in world units. It is the same derivation cvcdbg's C++ makes, so a Python host plans with the same vehicle.
  • nav_sim_world_belief_occ(sim, m): a copy of plane m's planning raster, so a route can be planned on what the agent knows.

The option dicts take exactly the C++ structs' fields; an unknown key or a non-number is an error. bindings/pycvc/README.md documents them.

Test plan

  • test_pycvc_nav_routes.py (26 checks): open ground; a corridor too narrow to turn in, reached backing up, every pose clear; option validation; clearance; a follower driving an agent along its route to the end; the follower keeping its world alive; index and shape errors; the route vehicle (none on the bicycle; on a Jolt plant min_radius = wheelbase / tan(max_steer)); a Humvee driving its route to the end on the plant
  • test_pycvc_physics.py (43) and test_pycvc_nav_belief.py unchanged against the same build (Linux, Python 3.12, Jolt)
  • CI

The GRL-SNAM squad change that uses these follows as a separate PR. It needs a pycvc release with these bindings for its CI.

…ef plane's raster

A vehicle with a turning radius drives a planned route rather than nav's carrot: the carrot FSM's wall-follow target can sit inside the turning circle, where the vehicle hunts between gears. pycvc_nav.i now wraps:
- nav_plan_vehicle_route(occ, bounds, start pose, goal, vehicle, options) -> reached, poses (M,4) [x, y, heading, reverse], cusps, length, reverse_length, expansions (GIL released while it searches);
- nav_route_clearance;
- nav_route_follower_create(sim, options) / _set / _clear / _apply / _status, a capsule holding a reference to its sim_world, as sim_thread's does;
- nav_sim_world_belief_occ(sim, m), a copy of plane m's planning raster, to plan on what an agent knows.
The option dicts take exactly the C++ structs' fields; an unknown key or a non-number is an error. test_pycvc_nav_routes (19 checks): open ground, a corridor reached backing up, the validation, clearance, a follower driving an agent along its route to the end, the world kept alive by the follower, and the index and shape errors.
nav_sim_world_route_vehicle(sim, i): None on nav's bicycle; on a plant, agent i's min_radius (wheelbase / tan(max steer)), body discs (plant_plan_of), wheelbase, max_steer and the sim's reach, in world units: the derivation a C++ host makes (cvcdbg's vehicle routes), so a Python host plans with the same vehicle. test_pycvc_nav_routes now drives a Humvee along its route to the end on the Jolt plant (26 checks).
transfix added a commit to CVC-Lab/GRL-SNAM that referenced this pull request Oct 20, 2026
On a plant, nav's carrot FSM can put its wall-follow target inside the vehicle's turning circle, where the vehicle hunts between gears for good: on libcvc 3.7.0 the Jolt crossing's RoboRacers both arrived from only 4 of 10 starts a few cm apart. nav_native.VehicleRoutes drives a native world's agents on libcvc's vehicle routes (plan_vehicle_route on each agent's own belief plane, route_follower; pycvc from transfix/libcvc#745), planning an agent again when it stands still short of its goal, as libcvc's finale and cvcdbg's convoy do. Squad(plant=...) uses them for agents with a fixed goal whenever pycvc has them (vehicle_routes=None; True requires them, False keeps the carrot); a moving-goal agent keeps the carrot. A route agent arrives when it finishes its route. With routes: 10 of 10 starts arrive, no penetration, 858-912 ticks. The arrival test now xfails only without the bindings; new tests: nearby starts, the choice and the plant requirement, a moving goal keeping the carrot.
@transfix
transfix merged commit 3a303fc into master Oct 20, 2026
24 checks passed
@transfix
transfix deleted the feat/pycvc-vehicle-routes branch October 29, 2026 20:52
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