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 Junction junction)
 Initialized the vehicle to the non-signalized junction maps. More...
 
bool HandleNonSignalisedJunction (const ActorId ego_actor_id, const Junction junction, const Buffer &waypoint_buffer, 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...
 
std::unordered_map< JunctionID, std::deque< ActorId > > exiting_vehicles_map
 Map containing the vehicles exiting a specific junction. 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 Junction  junction 
)
private

Initialized the vehicle to the non-signalized junction maps.

Definition at line 89 of file TrafficLightStage.cpp.

References entering_vehicles_map, exiting_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:

◆ HandleNonSignalisedJunction()

bool carla::traffic_manager::TrafficLightStage::HandleNonSignalisedJunction ( const ActorId  ego_actor_id,
const Junction  junction,
const Buffer waypoint_buffer,
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 114 of file TrafficLightStage.cpp.

References carla::geom::Math::Dot(), carla::client::Timestamp::elapsed_seconds, entering_vehicles_map, carla::traffic_manager::constants::MotionPlan::EPSILON_RELATIVE_SPEED, carla::traffic_manager::constants::TrafficLight::EXIT_JUNCTION_THRESHOLD, exiting_vehicles_map, carla::geom::Transform::GetForwardVector(), carla::traffic_manager::SimulationState::GetVelocity(), carla::geom::Vector3D::Length(), carla::geom::Transform::location, 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 157 of file TrafficLightStage.cpp.

References entering_vehicles_map, exiting_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 181 of file TrafficLightStage.cpp.

References entering_vehicles_map, exiting_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 Update().

◆ current_timestamp

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

Definition at line 35 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().

◆ exiting_vehicles_map

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

Map containing the vehicles exiting a specific junction.

Definition at line 28 of file TrafficLightStage.h.

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

◆ output_array

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

Definition at line 33 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 34 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 30 of file TrafficLightStage.h.

Referenced by AddActorToNonSignalisedJunction(), 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 32 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: