Road regulation

A RegulatedRoad is a Road in which the behavior of vehicles take or give the right of way at an intersection based on the priority lane attribute.

On such a road, some rules are enforced:

  • most of the time, vehicles behave as usual;

  • however, they try to predict collisions with other vehicles through the is_conflict_possible() method;

  • when it is the case, right of way is arbitrated through the respect_priorities() method, and the yielding vehicle target velocity is set to 0 until the conflict is resolved.

API

class highway_env.road.regulation.RegulatedRoad(network: Optional[RoadNetwork] = None, vehicles: Optional[List[Vehicle]] = None, obstacles: Optional[List[Obstacle]] = None, np_random: Optional[RandomState] = None, record_history: bool = False)[source]
step(dt: float) None[source]

Step the dynamics of each entity on the road.

Parameters

dt – timestep [s]

enforce_road_rules() None[source]

Find conflicts and resolve them by assigning yielding vehicles and stopping them.

static respect_priorities(v1: Vehicle, v2: Vehicle) Vehicle[source]

Resolve a conflict between two vehicles by determining who should yield

Parameters
  • v1 – first vehicle

  • v2 – second vehicle

Returns

the yielding vehicle