data_gathering package
Subpackages
Submodules
data_gathering.information_manager module
Aim of this module is to provide a less convoluted access to information, i.e. distill the information from the data and return high level information
- class data_gathering.information_manager.InformationManager(agent: LunaticAgent, update_information: bool = True)
Bases:
objectTracks global information, e.g. all actors, traffic lights, etc. as well as agent specific information, e.g. current speed, current location, and nearby actors in relation to the agent.
Tip
global information is attributed by
ClassVarandstaticmethodand is shared across all instances, this information is constant for the current tick.- Parameters:
agent (LunaticAgent)
update_information (bool)
- relevant_traffic_light: carla.TrafficLight | None = None
Result of
CarlaDataProvider.get_next_traffic_light()
- relevant_traffic_light_distance: float = inf
Distance to the
relevant_traffic_lightIs float(‘inf’) ifrelevant_traffic_lightis None.
- gathered_information: InformationManager.Information
InformationManager.Informationgathered duringtick()
- vehicles: ClassVar['list[carla.Vehicle]']
List of all tracked vehicles
- walkers: ClassVar['list[carla.Walker]']
List of all tracked pedestrians
- static_obstacles: ClassVar['list[carla.Actor]']
List of all tracked static obstacles
- obstacles: ClassVar['list[carla.Actor]']
Union of
vehicles, py:attr:walkers and py:attr:static_obstacles
- lights_map: ClassVar['Dict[int, carla.Waypoint]'] = {}
Map of traffic lights to their trigger waypoints
- frame: ClassVar['int | None'] = None
Last frame the InformationManager was updated.
The current frame of the world should be passed to the global_tick method.
- __init__(agent: LunaticAgent, update_information: bool = True)
- Parameters:
agent (LunaticAgent)
update_information (bool)
- state_counter: Dict[AgentState, int]
Tracks different
AgentStateand the amount of ticks the agent is in this state.
- detect_next_traffic_light()
Set the
relevant_traffic_lightandrelevant_traffic_light_distanceif not set.Note
Does not check for planned path but current route along waypoints, might not be exact.
This function is automatically called in :py:meth:`tick`
- tick()
Tick the information manager and update the information for the corresponding agent.
- class Information(current_waypoint: carla.Waypoint, current_speed: float, current_states: Dict[AgentState, int], relevant_traffic_light: carla.TrafficLight | None, relevant_traffic_light_distance: float, vehicles: List[carla.Vehicle], walkers: List[carla.Walker], static_obstacles: List[carla.Actor], obstacles: List[carla.Actor], walkers_nearby: List[carla.Walker], vehicles_nearby: List[carla.Vehicle], static_obstacles_nearby: List[carla.Actor], obstacles_nearby: List[carla.Actor], traffic_lights_nearby: List[carla.TrafficLight], distances: Dict[carla.Actor, float])
Bases:
NamedTupleData gathered by the InformationManager which is passed to the agent.
- Parameters:
current_waypoint (carla.Waypoint)
current_speed (float)
current_states (Dict[AgentState, int])
relevant_traffic_light (Optional[carla.TrafficLight])
relevant_traffic_light_distance (float)
vehicles (List[carla.Vehicle])
walkers (List[carla.Walker])
static_obstacles (List[carla.Actor])
obstacles (List[carla.Actor])
walkers_nearby (List[carla.Walker])
vehicles_nearby (List[carla.Vehicle])
static_obstacles_nearby (List[carla.Actor])
obstacles_nearby (List[carla.Actor])
traffic_lights_nearby (List[carla.TrafficLight])
distances (Dict[carla.Actor, float])
- current_waypoint: carla.Waypoint
Alias for field number 0
- current_states: Dict[AgentState, int]
Alias for field number 2
- relevant_traffic_light: carla.TrafficLight | None
Alias for field number 3
- vehicles: List[carla.Vehicle]
Alias for field number 5
- walkers: List[carla.Walker]
Alias for field number 6
- static_obstacles: List[carla.Actor]
Filtered obstacles by InformationManager.OBSTACLE_FILTER
- count(value, /)
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
- obstacles: List[carla.Actor]
Union of vehicles, walkers and static_obstacles
- walkers_nearby: List[carla.Walker]
Alias for field number 9
- vehicles_nearby: List[carla.Vehicle]
Alias for field number 10
- static_obstacles_nearby: List[carla.Actor]
Alias for field number 11
- obstacles_nearby: List[carla.Actor]
Alias for field number 12
- traffic_lights_nearby: List[carla.TrafficLight]
Alias for field number 13
- distances: Dict[carla.Actor, float]
Distances to all actors in
obstacles
- OBSTACLE_FILTER: str = 'static.prop.[cistmw]*'
fnmatch for obstacles that the agent will consider in its path. https://carla.readthedocs.io/en/latest/bp_library/#static
- static get_traffic_lights() Dict[carla.TrafficLight, carla.Transform]
- Return type:
- static get_trafficlight_trigger_waypoint(traffic_light: carla.TrafficLight) carla.Waypoint
Get the location where the traffic light is triggered.
- Parameters:
traffic_light (carla.TrafficLight)
- Return type:
- static global_tick(frame: int | None = None) None
Update global information that is constant for the current tick and not agent specific.
- Updates:
- Parameters:
frame (Optional[int]) – The id of the current frame. If None retrieves the id from the current
carla.WorldSnapshot. Multiple calls with the same frame are ignored. (default: None)- Return type:
None
- static get_vehicles() List[carla.Vehicle]
- Return type:
- static get_walkers() List[carla.Walker]
- Return type: