data_gathering.car_detection_matrix package
Submodules
data_gathering.car_detection_matrix.run_matrix module
- class data_gathering.car_detection_matrix.run_matrix.DetectionMatrix(ego_vehicle: carla.Actor, world: carla.World, road_lane_ids: Set[RoadLaneId] | None = None)
Bases:
objectCreate a matrix representing the lanes around the ego vehicle.
- Parameters:
ego_vehicle (carla.Actor)
world (carla.World)
road_lane_ids (Optional[Set[RoadLaneId]])
- __init__(ego_vehicle: carla.Actor, world: carla.World, road_lane_ids: Set[RoadLaneId] | None = None)
- Parameters:
ego_vehicle (carla.Actor)
world (carla.World)
road_lane_ids (Optional[Set[RoadLaneId]])
- running
If the matrix will perform updates.
- matrix: Dict[int, List[int]]
An ordered dictionary representing the city matrix. The keys for existing lanes are the lane IDs in the format “road_id_lane_id”. For non-existing lanes different placeholder exist, e.g. left_outer_lane, left_inner_lane, No_4th_lane, No_opposing_direction The values indicate whether a vehicle is present: 0 - No vehicle, 1 - Ego vehicle, 3 - No road. Format example:
{ "left_outer_lane": [3, 3, 3, 3, 3, 3, 3, 3], "left_inner_lane": [3, 3, 3, 3, 3, 3, 3, 3], "1_2": [0, 0, 0, 0, 0, 0, 0, 0], "1_1": [0, 0, 0, 0, 0, 0, 0, 0], "1_-1": [0, 0, 0, 0, 0, 0, 0, 0], "1_-2": [0, 0, 0, 0, 0, 0, 0, 0], "right_inner_lane": [3, 3, 3, 3, 3, 3, 3, 3], "right_outer_lane": [3, 3, 3, 3, 3, 3, 3, 3], }
Attention
Currently the keys are replaces by numbers.
- Type:
- update() Dict[int, List[int]] | None
If the matrix is
running, it will update the matrix and return it, otherwise returnsNone.
- start()
Allows the matrix to update.
- stop()
Prevents the matrix from updating.
- class data_gathering.car_detection_matrix.run_matrix.AsyncDetectionMatrix(ego_vehicle: carla.Actor, world: carla.World, road_lane_ids=None, *, sleep_time=0.1)
Bases:
DetectionMatrix- Parameters:
ego_vehicle (carla.Actor)
world (carla.World)
- __init__(ego_vehicle: carla.Actor, world: carla.World, road_lane_ids=None, *, sleep_time=0.1)
Asynchronous version of the
DetectionMatrix.Will calculate the matrix update in a separate thread.
- Parameters:
ego_vehicle (carla.Actor)
world (carla.World)
- to_numpy() None | np.ndarray[int, Any]
Returns the values of
matrixas a numpy array.- Return type:
None | np.ndarray[int, Any]
- matrix: Dict[int, List[int]]
An ordered dictionary representing the city matrix. The keys for existing lanes are the lane IDs in the format “road_id_lane_id”. For non-existing lanes different placeholder exist, e.g. left_outer_lane, left_inner_lane, No_4th_lane, No_opposing_direction The values indicate whether a vehicle is present: 0 - No vehicle, 1 - Ego vehicle, 3 - No road. Format example:
{ "left_outer_lane": [3, 3, 3, 3, 3, 3, 3, 3], "left_inner_lane": [3, 3, 3, 3, 3, 3, 3, 3], "1_2": [0, 0, 0, 0, 0, 0, 0, 0], "1_1": [0, 0, 0, 0, 0, 0, 0, 0], "1_-1": [0, 0, 0, 0, 0, 0, 0, 0], "1_-2": [0, 0, 0, 0, 0, 0, 0, 0], "right_inner_lane": [3, 3, 3, 3, 3, 3, 3, 3], "right_outer_lane": [3, 3, 3, 3, 3, 3, 3, 3], }
Attention
Currently the keys are replaces by numbers.
- Type:
- running
If the matrix will perform updates.
- getMatrix()
- start()
Allows the matrix to update.
- stop()
Prevents the matrix from updating.