30 Oct 2018

Using TraCI to Reroute Vehicles

An important aspect of an intelligent transportatin system with infrastructure to vehichle communication would be the ability for emergency vehicles to recieve information about potential blockages on it’s current route and be sent alternate routes by the road-side units if alternate paths show a potentially shorter travel time. This behaviour can be simulated in SUMO by using several TraCI commands which can change vehicle state. These are similar in usage to the commands mentioned in the previous post about forcing vehicles to yield.

There are several commands which achieve rerouting but in different manners:

  • setRouteID(self, vehID, routeID) setRouteID(string, string) -> None

Changes the vehicles route to the route with the given id.

  • setRoute(self, vehID, edgeList) setRoute(string, list) -> None

    changes the vehicle route to given edges list. The first edge in the list has to be the one that the vehicle is at at the moment.

    example usage: setRoute(‘1’, [‘1’, ‘2’, ‘4’, ‘6’, ‘7’])

  • changeTarget(self, vehID, edgeID) changeTarget(string, string) -> None

    The vehicle’s destination edge is set to the given edge id. The route is rebuilt.

setRouteID requires a pre-determiend route to be specified in the SUMO route file, whereas setRoute can simply be passed a list of connected edges. changeTarget could be useful if the vehicles destination is to change. The actual route generated by changeTarget is computed using Djikstra’s algorithm by default.

Thank You For Reading
Andrew Vaillancourt

Undergraduate Computer Science student at The University of Manitoba