CARLA
Public Member Functions | Private Member Functions | Private Attributes | List of all members
carla::traffic_manager::CollisionStage Class Reference

This class has functionality to detect potential collision with a nearby actor. More...

#include <CollisionStage.h>

+ Inheritance diagram for carla::traffic_manager::CollisionStage:
+ Collaboration diagram for carla::traffic_manager::CollisionStage:

Public Member Functions

void ClearCycleCache ()
 
 CollisionStage (const std::vector< ActorId > &vehicle_id_list, const SimulationState &simulation_state, const BufferMap &buffer_map, const TrackTraffic &track_traffic, const Parameters &parameters, CollisionFrame &output_array, cc::DebugHelper &debug_helper, RandomGeneratorMap &random_devices)
 
void RemoveActor (const ActorId actor_id) override
 
void Reset () override
 
void Update (const unsigned long index) override
 

Private Member Functions

void DrawBoundary (const LocationVector &boundary)
 
LocationVector GetBoundary (const ActorId actor_id)
 
float GetBoundingBoxExtention (const ActorId actor_id)
 
LocationVector GetGeodesicBoundary (const ActorId actor_id)
 
GeometryComparison GetGeometryBetweenActors (const ActorId reference_vehicle_id, const ActorId other_actor_id)
 
Polygon GetPolygon (const LocationVector &boundary)
 
std::pair< bool, float > NegotiateCollision (const ActorId reference_vehicle_id, const ActorId other_actor_id, const uint64_t reference_junction_look_ahead_index)
 
- Private Member Functions inherited from carla::traffic_manager::Stage
 Stage ()
 
 Stage (const Stage &)
 
virtual ~Stage ()
 

Private Attributes

const BufferMapbuffer_map
 
CollisionLockMap collision_locks
 
cc::DebugHelperdebug_helper
 
GeodesicBoundaryMap geodesic_boundary_map
 
GeometryComparisonMap geometry_cache
 
CollisionFrameoutput_array
 
const Parametersparameters
 
RandomGeneratorMaprandom_devices
 
const SimulationStatesimulation_state
 
const TrackTraffictrack_traffic
 
const std::vector< ActorId > & vehicle_id_list
 

Detailed Description

This class has functionality to detect potential collision with a nearby actor.

Definition at line 47 of file CollisionStage.h.

Constructor & Destructor Documentation

◆ CollisionStage()

carla::traffic_manager::CollisionStage::CollisionStage ( const std::vector< ActorId > &  vehicle_id_list,
const SimulationState simulation_state,
const BufferMap buffer_map,
const TrackTraffic track_traffic,
const Parameters parameters,
CollisionFrame output_array,
cc::DebugHelper debug_helper,
RandomGeneratorMap random_devices 
)

Definition at line 18 of file CollisionStage.cpp.

Member Function Documentation

◆ ClearCycleCache()

void carla::traffic_manager::CollisionStage::ClearCycleCache ( )

Definition at line 413 of file CollisionStage.cpp.

References geodesic_boundary_map, and geometry_cache.

Referenced by carla::traffic_manager::TrafficManagerLocal::Run().

+ Here is the caller graph for this function:

◆ DrawBoundary()

void carla::traffic_manager::CollisionStage::DrawBoundary ( const LocationVector boundary)
private

Definition at line 418 of file CollisionStage.cpp.

References debug_helper, and carla::client::DebugHelper::DrawLine().

+ Here is the call graph for this function:

◆ GetBoundary()

LocationVector carla::traffic_manager::CollisionStage::GetBoundary ( const ActorId  actor_id)
private

◆ GetBoundingBoxExtention()

float carla::traffic_manager::CollisionStage::GetBoundingBoxExtention ( const ActorId  actor_id)
private

◆ GetGeodesicBoundary()

LocationVector carla::traffic_manager::CollisionStage::GetGeodesicBoundary ( const ActorId  actor_id)
private

Definition at line 163 of file CollisionStage.cpp.

References buffer_map, carla::traffic_manager::constants::Collision::COS_10_DEGREES, carla::geom::Math::Dot(), carla::road::EPSILON, geodesic_boundary_map, GetBoundary(), GetBoundingBoxExtention(), carla::traffic_manager::SimulationState::GetDimensions(), carla::traffic_manager::Parameters::GetDistanceToLeadingVehicle(), carla::traffic_manager::GetTargetWaypoint(), carla::geom::Vector3D::MakeSafeUnitVector(), parameters, reverse(), simulation_state, SQUARE, carla::geom::Vector3D::x, and carla::geom::Vector3D::y.

Referenced by GetGeometryBetweenActors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetGeometryBetweenActors()

GeometryComparison carla::traffic_manager::CollisionStage::GetGeometryBetweenActors ( const ActorId  reference_vehicle_id,
const ActorId  other_actor_id 
)
private

Definition at line 247 of file CollisionStage.cpp.

References geometry_cache, GetBoundary(), GetGeodesicBoundary(), and GetPolygon().

Referenced by NegotiateCollision().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPolygon()

Polygon carla::traffic_manager::CollisionStage::GetPolygon ( const LocationVector boundary)
private

Definition at line 236 of file CollisionStage.cpp.

Referenced by GetGeometryBetweenActors().

+ Here is the caller graph for this function:

◆ NegotiateCollision()

std::pair< bool, float > carla::traffic_manager::CollisionStage::NegotiateCollision ( const ActorId  reference_vehicle_id,
const ActorId  other_actor_id,
const uint64_t  reference_junction_look_ahead_index 
)
private

Definition at line 296 of file CollisionStage.cpp.

References carla::traffic_manager::TrafficLightState::at_traffic_light, carla::traffic_manager::constants::Collision::BOUNDARY_EXTENSION_MINIMUM, buffer_map, collision_locks, carla::traffic_manager::CollisionLock::distance_to_lead_vehicle, carla::geom::Math::DistanceSquared(), carla::geom::Math::Dot(), carla::road::EPSILON, GetBoundingBoxExtention(), carla::traffic_manager::SimulationState::GetDimensions(), carla::traffic_manager::Parameters::GetDistanceToLeadingVehicle(), GetGeometryBetweenActors(), carla::traffic_manager::SimulationState::GetHeading(), carla::traffic_manager::SimulationState::GetLocation(), carla::traffic_manager::SimulationState::GetTLS(), carla::rpc::Green, carla::traffic_manager::GeometryComparison::inter_bbox_distance, carla::traffic_manager::GeometryComparison::inter_geodesic_distance, carla::traffic_manager::CollisionLock::lead_vehicle_id, carla::geom::Vector3D::MakeSafeUnitVector(), carla::traffic_manager::GeometryComparison::other_vehicle_to_reference_geodesic, parameters, carla::traffic_manager::GeometryComparison::reference_vehicle_to_other_geodesic, simulation_state, SQUARE, carla::traffic_manager::constants::Collision::SQUARE_ROOT_OF_TWO, carla::traffic_manager::TrafficLightState::tl_state, and carla::geom::Vector3D::x.

Referenced by Update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveActor()

void carla::traffic_manager::CollisionStage::RemoveActor ( const ActorId  actor_id)
overridevirtual

Implements carla::traffic_manager::Stage.

Definition at line 104 of file CollisionStage.cpp.

References collision_locks.

Referenced by carla::traffic_manager::ALSM::RemoveActor().

+ Here is the caller graph for this function:

◆ Reset()

void carla::traffic_manager::CollisionStage::Reset ( void  )
overridevirtual

Implements carla::traffic_manager::Stage.

Definition at line 108 of file CollisionStage.cpp.

References collision_locks.

Referenced by carla::traffic_manager::TrafficManagerLocal::Stop().

+ Here is the caller graph for this function:

◆ Update()

void carla::traffic_manager::CollisionStage::Update ( const unsigned long  index)
overridevirtual

Implements carla::traffic_manager::Stage.

Definition at line 36 of file CollisionStage.cpp.

References carla::traffic_manager::CollisionHazardData::available_distance_margin, buffer_map, carla::traffic_manager::SimulationState::ContainsActor(), carla::geom::Math::DistanceSquared(), carla::traffic_manager::Parameters::GetCollisionDetection(), carla::traffic_manager::SimulationState::GetLocation(), carla::traffic_manager::TrackTraffic::GetOverlappingVehicles(), carla::traffic_manager::Parameters::GetPercentageIgnoreVehicles(), carla::traffic_manager::Parameters::GetPercentageIgnoreWalkers(), carla::traffic_manager::GetTargetWaypoint(), carla::traffic_manager::SimulationState::GetType(), carla::traffic_manager::CollisionHazardData::hazard, carla::traffic_manager::CollisionHazardData::hazard_actor_id, carla::traffic_manager::constants::WaypointSelection::JUNCTION_LOOK_AHEAD, carla::traffic_manager::constants::Collision::MAX_COLLISION_RADIUS, NegotiateCollision(), output_array, parameters, carla::traffic_manager::Pedestrian, random_devices, simulation_state, sort(), SQUARE, track_traffic, Vehicle, vehicle_id_list, carla::traffic_manager::constants::Collision::VERTICAL_OVERLAP_THRESHOLD, and carla::geom::Vector3D::z.

Referenced by carla::traffic_manager::TrafficManagerLocal::Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ buffer_map

const BufferMap& carla::traffic_manager::CollisionStage::buffer_map
private

Definition at line 51 of file CollisionStage.h.

Referenced by GetGeodesicBoundary(), NegotiateCollision(), and Update().

◆ collision_locks

CollisionLockMap carla::traffic_manager::CollisionStage::collision_locks
private

Definition at line 57 of file CollisionStage.h.

Referenced by GetBoundingBoxExtention(), NegotiateCollision(), RemoveActor(), and Reset().

◆ debug_helper

cc::DebugHelper& carla::traffic_manager::CollisionStage::debug_helper
private

Definition at line 55 of file CollisionStage.h.

Referenced by DrawBoundary().

◆ geodesic_boundary_map

GeodesicBoundaryMap carla::traffic_manager::CollisionStage::geodesic_boundary_map
private

Definition at line 62 of file CollisionStage.h.

Referenced by ClearCycleCache(), and GetGeodesicBoundary().

◆ geometry_cache

GeometryComparisonMap carla::traffic_manager::CollisionStage::geometry_cache
private

Definition at line 61 of file CollisionStage.h.

Referenced by ClearCycleCache(), and GetGeometryBetweenActors().

◆ output_array

CollisionFrame& carla::traffic_manager::CollisionStage::output_array
private

Definition at line 54 of file CollisionStage.h.

Referenced by Update().

◆ parameters

const Parameters& carla::traffic_manager::CollisionStage::parameters
private

Definition at line 53 of file CollisionStage.h.

Referenced by GetGeodesicBoundary(), NegotiateCollision(), and Update().

◆ random_devices

RandomGeneratorMap& carla::traffic_manager::CollisionStage::random_devices
private

Definition at line 63 of file CollisionStage.h.

Referenced by Update().

◆ simulation_state

const SimulationState& carla::traffic_manager::CollisionStage::simulation_state
private

◆ track_traffic

const TrackTraffic& carla::traffic_manager::CollisionStage::track_traffic
private

Definition at line 52 of file CollisionStage.h.

Referenced by Update().

◆ vehicle_id_list

const std::vector<ActorId>& carla::traffic_manager::CollisionStage::vehicle_id_list
private

Definition at line 49 of file CollisionStage.h.

Referenced by Update().


The documentation for this class was generated from the following files: