umich_sim.sim_backend.experiments package#
Submodules#
umich_sim.sim_backend.experiments.experiment module#
Backend - Experiment Class Created on Tue February 15, 2022
- Summary: The Experiment class is a base class that describes the high level interface that all
derived experiments must implement. It provides all the functionality that is universal to all experiments and experiment types. Specific experiment types and specific maps must be represented as derived classes from this base class.
- class umich_sim.sim_backend.experiments.experiment.Experiment(headless: bool)#
Bases:
object
- MAP = 'Town05'#
- add_section(new_section: Section) None #
Adds a new section to the Experiment.
Adds the section to the section_list. Also, handles setting the “next_section” property of the previous section to point to the newly added section.
- Parameters:
new_section – an Intersection or Freeway Section to add to the experiment
- Returns:
None
- add_vehicle(spawn_location: Transform, type_id: VehicleType, ego: bool = False, blueprint_id: Optional[str] = None) Vehicle #
Adds a new Vehicle to the experiment.
The new vehicle will be added at the location specified by spawn_location. The specific type of the vehicle must be specified so the correct type of control is applied to the vehicle.
- Parameters:
spawn_location – a carla.Transform representing where the Vehicle should spawn in the world
type_id – the VehicleType of the carla.Vehicle to specify the type of the Vehicle
ego – a bool representing whether the new Vehicle is the Ego Vehicle or not
blueprint_id – a str representing the specific name of the Vehicle blueprint to use. If not provided, a random blueprint is used
- Returns:
the created Vehicle object
- add_vehicles_from_configuration(configuration: Dict[int, Dict[int, str]])#
Adds vehicles to the Experiment according to the configuration dictionary.
- Parameters:
configuration –
- Returns:
- clean_up_experiment() None #
Destroys all the actors that have been spawned in the Carla simulation.
- Returns:
None
- experiment_type: ExperimentType = None#
- init() None #
Connects to the Carla server.
- Returns:
None
- abstract initialize_experiment(configuration: Dict[str, str]) None #
Uses an existing connection to the Carla server and configures the world according to the experiment design.
THIS FUNCTION IS ABSTRACT, IT MUST BE IMPLEMENTED BY THE DERIVED EXPERIMENT CLASS. OTHERWISE, NOTHING WILL HAPPEN WHEN YOU GO TO RUN THE EXPERIMENT. Adds vehicles in the places specified in the GUI, generates paths for all non-Ego vehicles, specifies traffic light settings.
- Parameters:
configuration – a Dictionary containing the user defined settings for the experiment (exact properties vary from experiment to experiment)
- Returns:
None
- run_experiment() None #
Runs a basic main simulation loop to drive the experiment.
Any additional functionality can be added by overloading this function in a derived class. Spawns a new thread to control each manually driven vehicle. Each tick, updates the positions of each vehicle and applies autonomous control to each vehicle.
- Returns:
None
umich_sim.sim_backend.experiments.freeway_experiment module#
Backend - FreewayExperiment Class Created on Sun March 27, 2022
Summary: The FreewayExperiment class is a class that derives from the base Experiment class.
- class umich_sim.sim_backend.experiments.freeway_experiment.FreewayExperiment(headless: bool)#
Bases:
Experiment
- MAP = 'Town04'#
- initialize_experiment(configuration: Dict[int, Dict[int, str]] = {}) None #
Uses an existing connection to the Carla server and configures the world according to the experiment design.
- Parameters:
configuration – a Dictionary containing the user defined settings for the experiment
- Returns:
None
- junctions: Dict[int, carla.Junction]#
- map: carla.Map#
- server_initialized: bool#
- spawn_points: List[carla.Transform]#
- spectator: carla.Actor#
- update_control(vehicle: Vehicle) None #
update control based on specific experiment type :param vehicle: the vehicle to update control
- waypoints: List[carla.Waypoint]#
umich_sim.sim_backend.experiments.intersection_experiment module#
Backend - IntersectionExperiment Class Created on Monday, April 4th, 2022
- Summary: The IntersectionExperiment class is a class that derives from the base Experiment class. It
runs the Intersection experiment type
- class umich_sim.sim_backend.experiments.intersection_experiment.IntersectionExperiment(headless: bool)#
Bases:
Experiment
- MAP = 'Town05'#
- initialize_experiment(configuration: Optional[Dict[int, Dict[int, str]]] = None) None #
Uses an existing connection to the Carla server and configures the world according to the experiment design.
- Parameters:
configuration – a Dictionary containing the user defined settings for the experiment
- Returns:
None
- junctions: Dict[int, carla.Junction]#
- map: carla.Map#
- server_initialized: bool#
- spawn_points: List[carla.Transform]#
- spectator: carla.Actor#
- update_control(vehicle: Vehicle) None #
update control based on specific experiment type :param vehicle: the vehicle to update control
- waypoints: List[carla.Waypoint]#