Getting road curvature or turning radius at a vehicle’s position via TraCI/libsumo?
Hi,
I’m trying to determine the road curvature (or turning radius) at the position of a vehicle during a SUMO simulation. I saw in the documentation that SUMO reduces speed limits in intersections based on the turning radius:
https://sumo.dlr.de/docs/Simulation/Intersections.html
My question is: Is there a way to query the current road curvature or turning radius via TraCI or libsumo, given a vehicle ID?
Ideally, I would like something like:
radius = traci.vehicle.getTurningRadius(vehicleID)
# or
curvature = traci.vehicle.getCurvature(vehicleID)
This would be helpful both:
- Inside intersections, where SUMO already calculates a turning radius,
- Outside intersections, for example on long curved roads or highway ramps.
If there’s no direct API for this, is there a recommended way to compute it manually using available data like lane shapes?
Thanks a lot in advance!
This can only be approximated by getting the lane shape sumolib.net.lane.getShape (ref) and the vehicle position traci.vehicle.getLanePosition (ref). Anyway lanes actually consist of a series of straight stretches, so estimates of curvature and turning radius need to take into account some lane part upstream of the current position.