umich_sim.sim_backend.sections package#
Submodules#
umich_sim.sim_backend.sections.freeway_section module#
Backend - FreewaySection Class Created on Tue February 15, 2022
- Summary: The FreewaySection class represents a single road section in the Freeway experiment
type. It is derived from the base Section class. This class is responsible for managing all the vehicle that interact along this freeway section, along with their specific movements as they enter and exit the section.
- class umich_sim.sim_backend.sections.freeway_section.FreewaySection(starting_waypoints: List[Waypoint], ending_waypoints: List[Waypoint])#
Bases:
Section
- get_initial_waypoint(vehicle: Vehicle) Waypoint #
Gets the waypoint at the start of the FreewaySection in the Vehicle’s current lane.
- Parameters:
vehicle – the current Vehicle
- Returns:
a carla.Waypoint representing where the Vehicle will enter the section
- get_thru_waypoints(carla_map: Map, current_vehicle: Vehicle, direction: str) List[Waypoint] #
Determines the waypoints that correspond with a particular lane change through this FreewaySection.
- Parameters:
carla_map – the carla.Map that the experiment is running on
current_vehicle – the current Vehicle
direction – a string presenting the direction to take (either “left” or “right” or “straight”)
- Returns:
a List of carla.Waypoints corresponding with the desired lane change
- tick() None #
Updates the section with each tick of the world.
- Returns:
umich_sim.sim_backend.sections.intersection module#
Backend - Intersection Class Created on Tue February 15, 2022
- Summary: The Intersection class represents a single intersection in the Intersection experiment
type. It is derived from the base Section class. This class is responsible for managing all the vehicle that interact in this intersection, along with their specific movements as they enter and exit the intersection.
- class umich_sim.sim_backend.sections.intersection.Intersection(junction: Junction, traffic_lights: List[TrafficLight], green_time: float = 10.0, yellow_time: float = 3.0, first_pair: Tuple = (0, 2), second_pair: Tuple = (1, 3))#
Bases:
Section
- get_initial_waypoint(vehicle: Vehicle) Waypoint #
Get the carla.Waypoint where the Vehicle will enter the intersection.
- Parameters:
vehicle – the current Vehicle
- Returns:
a carla.Waypoint representing where the Vehicle will enter the section
- get_stop_location(location_vector: array) Tuple[int, Waypoint] #
Determines the traffic light that the vehicle should stop at given its current location and lane.
- Parameters:
location_vector – the current position of the Vehicle as a np.array
- Returns:
the index corresponding to the lane’s traffic light in the self.traffic_lights list and the carla.Waypoint that the vehicle should stop at when they arrive at the intersection
- get_thru_waypoints(carla_map: Map, current_vehicle: Vehicle, direction: str) List[Waypoint] #
Determines the waypoints that correspond with a particular turn at the intersection
- Parameters:
carla_map – the carla.Map that the experiment is running on
current_vehicle – the current Vehicle
direction – a string presenting the direction to turn (either “left” or “right” or “straight”)
- Returns:
a List of carla.Waypoints corresponding with the desired turn
- id = 0#
- stop_at_light(current_vehicle: Vehicle, braking_distance: float) Tuple[bool, Location] #
Determines if the vehicle needs to stop at the light, and gives the vehicle a target location to stop at.
- Parameters:
current_vehicle – a Vehicle representing the current vehicle
braking_distance – a float representing how long the car needs to break
- Returns:
a Tuple indicating if the vehicle needs to stop at the light and where it should stop if needed
- tick() None #
Updates the Intersection with each tick of the world.
Checks the state of each traffic light in the Intersection. For all the lights that are currently green, checks if there are any vehicles waiting at that light. If there are waiting vehicles, then remove their target location and advance them to the next section to allow them to proceed. :return: None
umich_sim.sim_backend.sections.section module#
Backend - Section Class Created on Mon May 9th, 2022
- Summary: The Section class provides the base functionality that exists in both the FreewaySection
and the Intersection classes. Both of these classes derive from this base class.
- class umich_sim.sim_backend.sections.section.Section#
Bases:
object
- abstract get_initial_waypoint(vehicle: Vehicle) Waypoint #
Gets the waypoint at the start of the Section.
This is an abstract function that must be implemented by the derived types. As the vehicle approaches the section, get the waypoint that the Vehicle will start the section at.
- Parameters:
vehicle – the current Vehicle
- Returns:
a carla.Waypoint representing where the Vehicle will enter the section
- abstract get_thru_waypoints(carla_map: Map, current_vehicle: Vehicle, direction: str) List[Waypoint] #
Determines the waypoints that correspond with a particular maneuver through the Section.
This is an abstract function that must be implemented by the derived types. This function will take in the currently running carla.Map, the vehicle’s current transform, and a string representing the desired maneuver direction through the section. This function will then return a List of carla.Waypoints that corresponds with the correct maneuver through this particular section
- Parameters:
carla_map – the carla.Map that the experiment is running on
current_vehicle – the current Vehicle
direction – a string presenting the direction to maneuver (either “left” or “right” or “straight”)
- Returns:
a List of carla.Waypoints corresponding with the desired maneuver
- id = 0#
- abstract tick() None #
Updates the section with each tick of the world.
This is an abstract function that must be implemented by the derived types. This function will update the section on every tick of the world. If the section has become active, then the vehicles waiting to start at this section will become active as well.
- Returns: