agents.substep_managers package
Helpers that can take over certain parts, some are directly imported into the LunaticAgent but here for easier access and to keep the class cleaner.
- agents.substep_managers.car_following_manager(self: HasPlannerWithConfig[BehaviorAgentSettings | LunaticAgentSettings], vehicle: carla.Vehicle, distance: float, debug: bool = False) carla.VehicleControl[source]
Module in charge of car-following behaviors when there’s someone in front of us.
- Parameters:
vehicle (carla.Vehicle) – car to follow
distance (float) – distance from vehicle
debug (bool) – boolean for debugging
self (HasPlannerWithConfig[BehaviorAgentSettings | LunaticAgentSettings])
- Returns:
Calculates the control for the vehicle
- Assumes:
No control has been calculated in this tick.
- Return type:
- agents.substep_managers.collision_detection_manager(self: LunaticAgent)[source]
This module is in charge of warning in case of a collision with vehicles or static obstacles.
- param location:
current location of the agent
- return vehicle_state:
True if there is a vehicle nearby, False if not
- return vehicle:
nearby vehicle
- return distance:
distance to nearby vehicle
# NOTE: Former collision_and_car_avoid_manager, which evaded car via the tailgating function now rule based.
- Parameters:
self (LunaticAgent)
- agents.substep_managers.collision_manager(self: LunaticAgent, event: carla.CollisionEvent) None[source]
What to do in case of a collision
Callback function for the collision event.
Attention
This function currently is not yet implemented.
- Parameters:
self (LunaticAgent)
event (carla.CollisionEvent)
- Return type:
None
- agents.substep_managers.detect_traffic_light(self: CanDetectNearbyTrafficLights, traffic_lights: ActorList[carla.TrafficLight] | None = None) TrafficLightDetectionResult[source]
This method is in charge of behaviors for red lights.
- Parameters:
self (CanDetectNearbyTrafficLights)
traffic_lights (Optional[ActorList[carla.TrafficLight]])
- Return type:
- agents.substep_managers.emergency_manager(self: LunaticAgent, *, reasons: set[Hazard], control: carla.VehicleControl | None = None, force=False) carla.VehicleControl[source]
Modifies the control values to perform an emergency stop. The steering remains unchanged to avoid going out of the lane during turns.
- Parameters:
reasons (set[Hazard]) – set of
Hazardthat triggered the emergency stop. If empty this function will do nothing. Normallydetected_hazards.control (carla.VehicleControl | None) – control to be modified in place. If
Nonethe control for the current step will be calculated.force – if True, the emergency stop will be performed even if the reasons are empty.
self (LunaticAgent)
- Return type:
- agents.substep_managers.pedestrian_detection_manager(self: LunaticAgent) ObstacleDetectionResult[source]
This module is in charge of warning in case of a collision with any pedestrian.
- param location:
current location of the agent
- return vehicle_state:
True if there is a walker nearby, False if not
- return vehicle:
nearby walker
- return distance:
distance to nearby walker
- Parameters:
self (LunaticAgent)
- Return type:
Submodules
agents.substep_managers.car_following module
- agents.substep_managers.car_following.car_following_manager(self: HasPlannerWithConfig[BehaviorAgentSettings | LunaticAgentSettings], vehicle: carla.Vehicle, distance: float, debug: bool = False) carla.VehicleControl[source]
Module in charge of car-following behaviors when there’s someone in front of us.
- Parameters:
vehicle (carla.Vehicle) – car to follow
distance (float) – distance from vehicle
debug (bool) – boolean for debugging
self (HasPlannerWithConfig[BehaviorAgentSettings | LunaticAgentSettings])
- Returns:
Calculates the control for the vehicle
- Assumes:
No control has been calculated in this tick.
- Return type:
agents.substep_managers.collision_callback module
- agents.substep_managers.collision_callback.collision_manager(self: LunaticAgent, event: carla.CollisionEvent) None[source]
What to do in case of a collision
Callback function for the collision event.
Attention
This function currently is not yet implemented.
- Parameters:
self (LunaticAgent)
event (carla.CollisionEvent)
- Return type:
None
agents.substep_managers.emergency module
- agents.substep_managers.emergency.emergency_manager(self: LunaticAgent, *, reasons: set[Hazard], control: carla.VehicleControl | None = None, force=False) carla.VehicleControl[source]
Modifies the control values to perform an emergency stop. The steering remains unchanged to avoid going out of the lane during turns.
- Parameters:
reasons (set[Hazard]) – set of
Hazardthat triggered the emergency stop. If empty this function will do nothing. Normallydetected_hazards.control (carla.VehicleControl | None) – control to be modified in place. If
Nonethe control for the current step will be calculated.force – if True, the emergency stop will be performed even if the reasons are empty.
self (LunaticAgent)
- Return type:
agents.substep_managers.obstacle_detection module
- agents.substep_managers.obstacle_detection.collision_detection_manager(self: LunaticAgent)[source]
This module is in charge of warning in case of a collision with vehicles or static obstacles.
- param location:
current location of the agent
- return vehicle_state:
True if there is a vehicle nearby, False if not
- return vehicle:
nearby vehicle
- return distance:
distance to nearby vehicle
# NOTE: Former collision_and_car_avoid_manager, which evaded car via the tailgating function now rule based.
- Parameters:
self (LunaticAgent)
agents.substep_managers.pedestrian_detection module
- agents.substep_managers.pedestrian_detection.pedestrian_detection_manager(self: LunaticAgent) ObstacleDetectionResult[source]
This module is in charge of warning in case of a collision with any pedestrian.
- param location:
current location of the agent
- return vehicle_state:
True if there is a walker nearby, False if not
- return vehicle:
nearby walker
- return distance:
distance to nearby walker
- Parameters:
self (LunaticAgent)
- Return type:
agents.substep_managers.traffic_light module
- agents.substep_managers.traffic_light.affected_by_traffic_light(self: CanDetectNearbyTrafficLights, lights_list: ActorList[carla.TrafficLight] | None = None, max_distance: float | None = None) TrafficLightDetectionResult[source]
Method to check if there is a red light affecting the vehicle.
- Parameters:
lights_list (Optional[ActorList[carla.TrafficLight]]) – list containing traffic light objects. If None, all traffic lights in the scene are used.
max_distance (Optional[float]) – max distance for a traffic lights to be considered relevant. If None, the base threshold value is used.
self (CanDetectNearbyTrafficLights)
- Return type:
- agents.substep_managers.traffic_light.detect_traffic_light(self: CanDetectNearbyTrafficLights, traffic_lights: ActorList[carla.TrafficLight] | None = None) TrafficLightDetectionResult[source]
This method is in charge of behaviors for red lights.
- Parameters:
self (CanDetectNearbyTrafficLights)
traffic_lights (Optional[ActorList[carla.TrafficLight]])
- Return type: