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 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"]
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)¶
A road is a set of lanes, and a set of vehicles driving on these lanes.
- act() None ¶
Decide the actions of each entity on the road.
- step(dt: float) None ¶
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]] ¶
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