A Road is composed of a RoadNetwork and a list of Vehicle.

The RoadNetwork describes the topology of the road infrastructure as a graph, where edges represent lanes and nodes represent intersections. It contains a graph dictionary which stores the AbstractLane geometries by their LaneIndex. A LaneIndex is a tuple containing:

  • a string identifier of a starting position

  • a string identifier of an ending position

  • an integer giving the index of the described lane, in the (unique) road from the starting to the ending position

For instance, the geometry of the second lane in the road going from the "lab" to the "pub" can be obtained by:

lane = road.road_network.graph["lab"]["pub"][1]

The actual positions of the lab and the pub are defined in the ``lane```geometry object.


class highway_env.road.road.Road(network: highway_env.road.road.RoadNetwork = None, vehicles: List[kinematics.Vehicle] = None, road_objects: List[objects.RoadObject] = None, np_random: numpy.random.mtrand.RandomState = None, record_history: bool = False)[source]

A road is a set of lanes, and a set of vehicles driving on these lanes.

act() None[source]

Decide the actions of each entity on the road.

step(dt: float) None[source]

Step the dynamics of each entity on the road.


dt – timestep [s]

neighbour_vehicles(vehicle: kinematics.Vehicle, lane_index: Tuple[str, str, int] = None) Tuple[Optional[kinematics.Vehicle], Optional[kinematics.Vehicle]][source]

Find the preceding and following vehicles of a given vehicle.

  • vehicle – the vehicle whose neighbours must be found

  • lane_index – the lane on which to look for preceding and following vehicles. It doesn’t have to be the current vehicle lane but can also be another lane, in which case the vehicle is projected on it considering its local coordinates in the lane.


its preceding vehicle, its following vehicle