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

This class has functionality for responding to traffic lights and managing entry into non-signalized junctions. More...

#include <TrafficLightStage.h>

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

Public Member Functions

void RemoveActor (const ActorId actor_id) override
 
void Reset () override
 
 TrafficLightStage (const std::vector< ActorId > &vehicle_id_list, const SimulationState &Simulation_state, const BufferMap &buffer_map, const Parameters &parameters, const cc::World &world, TLFrame &output_array, RandomGenerator &random_device)
 
void Update (const unsigned long index) override
 

Private Member Functions

void AddActorToNonSignalisedJunction (const ActorId ego_actor_id, const JunctionID junction_id)
 Initialized the vehicle to the non-signalized junction maps. More...
 
JunctionID GetAffectedJunctionId (const ActorId ego_actor_id)
 Get current affected junction id for the vehicle. More...
 
bool HandleNonSignalisedJunction (const ActorId ego_actor_id, const JunctionID junction_id, cc::Timestamp timestamp)
 This controls all vehicle's interactions at non signalized junctions. More...
 
- Private Member Functions inherited from carla::traffic_manager::Stage
 Stage ()
 
 Stage (const Stage &)
 
virtual ~Stage ()
 

Private Attributes

const BufferMapbuffer_map
 
cc::Timestamp current_timestamp
 
std::unordered_map< JunctionID, std::deque< ActorId > > entering_vehicles_map
 Variables used to handle non signalized junctions. More...
 
TLFrameoutput_array
 
const Parametersparameters
 
RandomGeneratorrandom_device
 
const SimulationStatesimulation_state
 
const std::vector< ActorId > & vehicle_id_list
 
std::unordered_map< ActorId, JunctionIDvehicle_last_junction
 Map linking the vehicles with their current junction. Used for easy access to the previous two maps. More...
 
std::unordered_map< ActorId, cc::Timestampvehicle_stop_time
 Map containing the timestamp at which the actor first stopped at a stop sign. More...
 
const cc::Worldworld
 

Detailed Description

This class has functionality for responding to traffic lights and managing entry into non-signalized junctions.

Definition at line 15 of file TrafficLightStage.h.

Constructor & Destructor Documentation

◆ TrafficLightStage()

carla::traffic_manager::TrafficLightStage::TrafficLightStage ( const std::vector< ActorId > &  vehicle_id_list,
const SimulationState Simulation_state,
const BufferMap buffer_map,
const Parameters parameters,
const cc::World world,
TLFrame output_array,
RandomGenerator random_device 
)

Definition at line 15 of file TrafficLightStage.cpp.

Member Function Documentation

◆ AddActorToNonSignalisedJunction()

void carla::traffic_manager::TrafficLightStage::AddActorToNonSignalisedJunction ( const ActorId  ego_actor_id,
const JunctionID  junction_id 
)
private

Initialized the vehicle to the non-signalized junction maps.

Definition at line 83 of file TrafficLightStage.cpp.

References entering_vehicles_map, RemoveActor(), and vehicle_last_junction.

Referenced by Update().

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

◆ GetAffectedJunctionId()

JunctionID carla::traffic_manager::TrafficLightStage::GetAffectedJunctionId ( const ActorId  ego_actor_id)
private

Get current affected junction id for the vehicle.

Definition at line 132 of file TrafficLightStage.cpp.

References buffer_map, carla::traffic_manager::GetTargetWaypoint(), carla::traffic_manager::constants::WaypointSelection::JUNCTION_LOOK_AHEAD, and vehicle_last_junction.

Referenced by Update().

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

◆ HandleNonSignalisedJunction()

bool carla::traffic_manager::TrafficLightStage::HandleNonSignalisedJunction ( const ActorId  ego_actor_id,
const JunctionID  junction_id,
cc::Timestamp  timestamp 
)
private

This controls all vehicle's interactions at non signalized junctions.

Priorities are done by order of arrival and no two vehicle will enter the junction at the same time. Only once it is exiting can the next one enter. Additionally, all vehicles will always brake at the stop sign for a set amount of time.

Definition at line 104 of file TrafficLightStage.cpp.

References carla::client::Timestamp::elapsed_seconds, entering_vehicles_map, carla::traffic_manager::constants::MotionPlan::EPSILON_RELATIVE_SPEED, carla::traffic_manager::SimulationState::GetVelocity(), carla::geom::Vector3D::Length(), carla::traffic_manager::constants::TrafficLight::MINIMUM_STOP_TIME, simulation_state, and vehicle_stop_time.

Referenced by Update().

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

◆ RemoveActor()

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

Implements carla::traffic_manager::Stage.

Definition at line 169 of file TrafficLightStage.cpp.

References entering_vehicles_map, vehicle_last_junction, and vehicle_stop_time.

Referenced by AddActorToNonSignalisedJunction(), carla::traffic_manager::ALSM::RemoveActor(), and Update().

+ Here is the caller graph for this function:

◆ Reset()

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

Implements carla::traffic_manager::Stage.

Definition at line 187 of file TrafficLightStage.cpp.

References entering_vehicles_map, vehicle_last_junction, and vehicle_stop_time.

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

+ Here is the caller graph for this function:

◆ Update()

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

Member Data Documentation

◆ buffer_map

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

Definition at line 19 of file TrafficLightStage.h.

Referenced by GetAffectedJunctionId().

◆ current_timestamp

cc::Timestamp carla::traffic_manager::TrafficLightStage::current_timestamp
private

Definition at line 33 of file TrafficLightStage.h.

Referenced by Update().

◆ entering_vehicles_map

std::unordered_map<JunctionID, std::deque<ActorId> > carla::traffic_manager::TrafficLightStage::entering_vehicles_map
private

Variables used to handle non signalized junctions.

Map containing the vehicles entering a specific junction, ordered by time of arrival.

Definition at line 26 of file TrafficLightStage.h.

Referenced by AddActorToNonSignalisedJunction(), HandleNonSignalisedJunction(), RemoveActor(), and Reset().

◆ output_array

TLFrame& carla::traffic_manager::TrafficLightStage::output_array
private

Definition at line 31 of file TrafficLightStage.h.

Referenced by Update().

◆ parameters

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

Definition at line 20 of file TrafficLightStage.h.

Referenced by Update().

◆ random_device

RandomGenerator& carla::traffic_manager::TrafficLightStage::random_device
private

Definition at line 32 of file TrafficLightStage.h.

Referenced by Update().

◆ simulation_state

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

Definition at line 18 of file TrafficLightStage.h.

Referenced by HandleNonSignalisedJunction(), and Update().

◆ vehicle_id_list

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

Definition at line 17 of file TrafficLightStage.h.

Referenced by Update().

◆ vehicle_last_junction

std::unordered_map<ActorId, JunctionID> carla::traffic_manager::TrafficLightStage::vehicle_last_junction
private

Map linking the vehicles with their current junction. Used for easy access to the previous two maps.

Definition at line 28 of file TrafficLightStage.h.

Referenced by AddActorToNonSignalisedJunction(), GetAffectedJunctionId(), RemoveActor(), Reset(), and Update().

◆ vehicle_stop_time

std::unordered_map<ActorId, cc::Timestamp> carla::traffic_manager::TrafficLightStage::vehicle_stop_time
private

Map containing the timestamp at which the actor first stopped at a stop sign.

Definition at line 30 of file TrafficLightStage.h.

Referenced by HandleNonSignalisedJunction(), RemoveActor(), and Reset().

◆ world

const cc::World& carla::traffic_manager::TrafficLightStage::world
private

Definition at line 21 of file TrafficLightStage.h.

Referenced by Update().


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