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

The function of this class is to integrate all the various stages of the traffic manager appropriately using messengers. More...

#include <TrafficManagerLocal.h>

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

Public Member Functions

ActionBuffer GetActionBuffer (const ActorId &actor_id)
 Method to get the vehicle's action buffer. More...
 
carla::client::detail::EpisodeProxyGetEpisodeProxy ()
 Get CARLA episode information. More...
 
Action GetNextAction (const ActorId &actor_id)
 Method to get the vehicle's next action. More...
 
std::vector< ActorIdGetRegisteredVehiclesIDs ()
 Get list of all registered vehicles. More...
 
void RegisterVehicles (const std::vector< ActorPtr > &actor_list)
 This method registers a vehicle with the traffic manager. More...
 
void Release ()
 To release the traffic manager. More...
 
void RemoveImportedRoute (const ActorId &actor_id, const bool remove_path)
 Method to remove a route. More...
 
void RemoveUploadPath (const ActorId &actor_id, const bool remove_path)
 Method to remove a list of points. More...
 
void Reset ()
 To reset the traffic manager. More...
 
void Run ()
 Initiates thread to run the TrafficManager sequentially. More...
 
void SetAutoLaneChange (const ActorPtr &actor, const bool enable)
 Enable/disable automatic lane change on a vehicle. More...
 
void SetBoundariesRespawnDormantVehicles (const float lower_bound, const float upper_bound)
 Method to set boundaries to respawn of dormant vehicles. More...
 
void SetCollisionDetection (const ActorPtr &reference_actor, const ActorPtr &other_actor, const bool detect_collision)
 Method to set collision detection rules between vehicles. More...
 
void SetCustomPath (const ActorPtr &actor, const Path path, const bool empty_buffer)
 Method to set our own imported path. More...
 
void SetDesiredSpeed (const ActorPtr &actor, const float value)
 Set a vehicle's exact desired velocity. More...
 
void SetDistanceToLeadingVehicle (const ActorPtr &actor, const float distance)
 Method to specify how much distance a vehicle should maintain to the leading vehicle. More...
 
void SetForceLaneChange (const ActorPtr &actor, const bool direction)
 Method to force lane change on a vehicle. More...
 
void SetGlobalDistanceToLeadingVehicle (const float distance)
 Method to specify how much distance a vehicle should maintain to the Global leading vehicle. More...
 
void SetGlobalLaneOffset (float const offset)
 Method to set a global lane offset displacement from the center line. More...
 
void SetGlobalPercentageSpeedDifference (float const percentage)
 Method to set a global % decrease in velocity with respect to the speed limit. More...
 
void SetHybridPhysicsMode (const bool mode_switch)
 Method to set hybrid physics mode. More...
 
void SetHybridPhysicsRadius (const float radius)
 Method to set hybrid physics radius. More...
 
void SetImportedRoute (const ActorPtr &actor, const Route route, const bool empty_buffer)
 Method to set our own imported route. More...
 
void SetKeepRightPercentage (const ActorPtr &actor, const float percentage)
 Method to set % to keep on the right lane. More...
 
void SetLaneOffset (const ActorPtr &actor, const float offset)
 Method to set a lane offset displacement from the center line. More...
 
void SetMaxBoundaries (const float lower, const float upper)
 Method to set limits for boundaries when respawning dormant vehicles. More...
 
void SetOSMMode (const bool mode_switch)
 Method to set Open Street Map mode. More...
 
void SetPercentageIgnoreVehicles (const ActorPtr &actor, const float perc)
 Method to specify the % chance of ignoring collisions with any vehicle. More...
 
void SetPercentageIgnoreWalkers (const ActorPtr &actor, const float perc)
 Method to specify the % chance of ignoring collisions with any walker. More...
 
void SetPercentageRunningLight (const ActorPtr &actor, const float perc)
 Method to specify the % chance of running any traffic light. More...
 
void SetPercentageRunningSign (const ActorPtr &actor, const float perc)
 Method to specify the % chance of running any traffic sign. More...
 
void SetPercentageSpeedDifference (const ActorPtr &actor, const float percentage)
 Method to set a vehicle's % decrease in velocity with respect to the speed limit. More...
 
void SetRandomDeviceSeed (const uint64_t _seed)
 Method to set randomization seed. More...
 
void SetRandomLeftLaneChangePercentage (const ActorPtr &actor, const float percentage)
 Method to set % to randomly do a left lane change. More...
 
void SetRandomRightLaneChangePercentage (const ActorPtr &actor, const float percentage)
 Method to set % to randomly do a right lane change. More...
 
void SetRespawnDormantVehicles (const bool mode_switch)
 Method to set automatic respawn of dormant vehicles. More...
 
void SetSynchronousMode (bool mode)
 Method to switch traffic manager into synchronous execution. More...
 
void SetSynchronousModeTimeOutInMiliSecond (double time)
 Method to set Tick timeout for synchronous execution. More...
 
void SetUpdateVehicleLights (const ActorPtr &actor, const bool do_update)
 Method to set the automatic management of the vehicle lights. More...
 
void SetupLocalMap ()
 Method to setup InMemoryMap. More...
 
void ShutDown ()
 
void Start ()
 To start the TrafficManager. More...
 
void Stop ()
 To stop the TrafficManager. More...
 
bool SynchronousTick ()
 Method to provide synchronous tick. More...
 
 TrafficManagerLocal (std::vector< float > longitudinal_PID_parameters, std::vector< float > longitudinal_highway_PID_parameters, std::vector< float > lateral_PID_parameters, std::vector< float > lateral_highway_PID_parameters, float perc_decrease_from_limit, cc::detail::EpisodeProxy &episode_proxy, uint16_t &RPCportTM)
 Private constructor for singleton lifecycle management. More...
 
void UnregisterVehicles (const std::vector< ActorPtr > &actor_list)
 This method unregisters a vehicle from traffic manager. More...
 
void UpdateImportedRoute (const ActorId &actor_id, const Route route)
 Method to update an already set route. More...
 
void UpdateUploadPath (const ActorId &actor_id, const Path path)
 Method to update an already set list of points. More...
 
virtual ~TrafficManagerLocal ()
 Destructor. More...
 
- Public Member Functions inherited from carla::traffic_manager::TrafficManagerBase
 TrafficManagerBase ()
 Protected constructor for singleton lifecycle management. More...
 
virtual ~TrafficManagerBase ()
 Destructor. More...
 

Private Member Functions

bool CheckAllFrozen (TLGroup tl_to_freeze)
 Method to check if all traffic lights are frozen in a group. More...
 

Private Attributes

ALSM alsm
 
BufferMap buffer_map
 Structures to hold waypoint buffers for all vehicles. More...
 
CollisionFrame collision_frame
 Array to hold output data of collision avoidance. More...
 
CollisionStage collision_stage
 
ControlFrame control_frame
 Array to hold output data of motion planning. More...
 
uint64_t current_reserved_capacity {0u}
 Variable to keep track of currently reserved array space for frames. More...
 
carla::client::detail::EpisodeProxy episode_proxy
 CARLA client connection object. More...
 
std::vector< float > lateral_highway_PID_parameters
 
std::vector< float > lateral_PID_parameters
 
LocalMapPtr local_map
 Pointer to local map cache. More...
 
LocalizationFrame localization_frame
 Array to hold output data of localization stage. More...
 
LocalizationStage localization_stage
 Various stages representing core operations of traffic manager. More...
 
std::vector< float > longitudinal_highway_PID_parameters
 
std::vector< float > longitudinal_PID_parameters
 PID controller parameters. More...
 
std::vector< ActorIdmarked_for_removal
 
MotionPlanStage motion_plan_stage
 
Parameters parameters
 Parameterization object. More...
 
TimePoint previous_update_instance
 Time instance used to calculate dt in asynchronous mode. More...
 
RandomGenerator random_device = RandomGenerator(seed)
 Structure holding random devices per vehicle. More...
 
AtomicActorSet registered_vehicles
 Set of all actors registered with traffic manager. More...
 
int registered_vehicles_state
 State counter to track changes in registered actors. More...
 
std::mutex registration_mutex
 Mutex to prevent vehicle registration during frame array re-allocation. More...
 
std::atomic< bool > run_traffic_manger {true}
 Switch to turn on / turn off traffic manager. More...
 
uint64_t seed {static_cast<uint64_t>(time(NULL))}
 Randomization seed. More...
 
TrafficManagerServer server
 Traffic manager server instance. More...
 
SimulationState simulation_state
 Type containing the current state of all actors involved in the simulation. More...
 
std::atomic< bool > step_begin {false}
 Flags to signal step begin and end. More...
 
std::condition_variable step_begin_trigger
 Condition variables for progressing synchronous execution. More...
 
std::atomic< bool > step_end {false}
 
std::condition_variable step_end_trigger
 
std::mutex step_execution_mutex
 Mutex for progressing synchronous execution. More...
 
TLFrame tl_frame
 Array to hold output data of traffic light response. More...
 
TrackTraffic track_traffic
 Object for tracking paths of the traffic vehicles. More...
 
TrafficLightStage traffic_light_stage
 
std::vector< ActorIdvehicle_id_list
 List of vehicles registered with the traffic manager in current update cycle. More...
 
VehicleLightStage vehicle_light_stage
 
std::unique_ptr< std::thread > worker_thread
 Single worker thread for sequential execution of sub-components. More...
 
cc::World world
 CARLA client and object. More...
 

Detailed Description

The function of this class is to integrate all the various stages of the traffic manager appropriately using messengers.

Definition at line 50 of file TrafficManagerLocal.h.

Constructor & Destructor Documentation

◆ TrafficManagerLocal()

carla::traffic_manager::TrafficManagerLocal::TrafficManagerLocal ( std::vector< float >  longitudinal_PID_parameters,
std::vector< float >  longitudinal_highway_PID_parameters,
std::vector< float >  lateral_PID_parameters,
std::vector< float >  lateral_highway_PID_parameters,
float  perc_decrease_from_limit,
cc::detail::EpisodeProxy &  episode_proxy,
uint16_t &  RPCportTM 
)

Private constructor for singleton lifecycle management.

Definition at line 20 of file TrafficManagerLocal.cpp.

References parameters, registered_vehicles_state, carla::traffic_manager::Parameters::SetGlobalPercentageSpeedDifference(), SetupLocalMap(), and Start().

+ Here is the call graph for this function:

◆ ~TrafficManagerLocal()

carla::traffic_manager::TrafficManagerLocal::~TrafficManagerLocal ( )
virtual

Destructor.

Definition at line 111 of file TrafficManagerLocal.cpp.

References episode_proxy, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), carla::traffic_manager::TrafficManagerServer::port(), Release(), and server.

+ Here is the call graph for this function:

Member Function Documentation

◆ CheckAllFrozen()

bool carla::traffic_manager::TrafficManagerLocal::CheckAllFrozen ( TLGroup  tl_to_freeze)
private

Method to check if all traffic lights are frozen in a group.

Definition at line 458 of file TrafficManagerLocal.cpp.

References carla::rpc::Red.

◆ GetActionBuffer()

ActionBuffer carla::traffic_manager::TrafficManagerLocal::GetActionBuffer ( const ActorId actor_id)
virtual

Method to get the vehicle's action buffer.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 454 of file TrafficManagerLocal.cpp.

References carla::traffic_manager::LocalizationStage::ComputeActionBuffer(), and localization_stage.

+ Here is the call graph for this function:

◆ GetEpisodeProxy()

carla::client::detail::EpisodeProxy & carla::traffic_manager::TrafficManagerLocal::GetEpisodeProxy ( )
virtual

Get CARLA episode information.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 480 of file TrafficManagerLocal.cpp.

References episode_proxy.

◆ GetNextAction()

Action carla::traffic_manager::TrafficManagerLocal::GetNextAction ( const ActorId actor_id)
virtual

Method to get the vehicle's next action.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 450 of file TrafficManagerLocal.cpp.

References carla::traffic_manager::LocalizationStage::ComputeNextAction(), and localization_stage.

+ Here is the call graph for this function:

◆ GetRegisteredVehiclesIDs()

std::vector< ActorId > carla::traffic_manager::TrafficManagerLocal::GetRegisteredVehiclesIDs ( )

Get list of all registered vehicles.

Definition at line 484 of file TrafficManagerLocal.cpp.

References carla::traffic_manager::AtomicActorSet::GetIDList(), and registered_vehicles.

+ Here is the call graph for this function:

◆ RegisterVehicles()

void carla::traffic_manager::TrafficManagerLocal::RegisterVehicles ( const std::vector< ActorPtr > &  actor_list)
virtual

This method registers a vehicle with the traffic manager.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 316 of file TrafficManagerLocal.cpp.

References carla::traffic_manager::AtomicActorSet::Insert(), registered_vehicles, and registration_mutex.

+ Here is the call graph for this function:

◆ Release()

void carla::traffic_manager::TrafficManagerLocal::Release ( )
virtual

To release the traffic manager.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 301 of file TrafficManagerLocal.cpp.

References local_map, and Stop().

Referenced by Reset(), and ~TrafficManagerLocal().

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

◆ RemoveImportedRoute()

void carla::traffic_manager::TrafficManagerLocal::RemoveImportedRoute ( const ActorId actor_id,
const bool  remove_path 
)
virtual

Method to remove a route.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 430 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::RemoveImportedRoute().

+ Here is the call graph for this function:

◆ RemoveUploadPath()

void carla::traffic_manager::TrafficManagerLocal::RemoveUploadPath ( const ActorId actor_id,
const bool  remove_path 
)
virtual

Method to remove a list of points.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 418 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::RemoveUploadPath().

+ Here is the call graph for this function:

◆ Reset()

void carla::traffic_manager::TrafficManagerLocal::Reset ( void  )
virtual

To reset the traffic manager.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 308 of file TrafficManagerLocal.cpp.

References episode_proxy, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), Release(), SetupLocalMap(), Start(), and world.

+ Here is the call graph for this function:

◆ Run()

void carla::traffic_manager::TrafficManagerLocal::Run ( )

Initiates thread to run the TrafficManager sequentially.

Definition at line 140 of file TrafficManagerLocal.cpp.

References alsm, carla::traffic_manager::CollisionStage::ClearCycleCache(), collision_frame, collision_stage, control_frame, current_reserved_capacity, episode_proxy, carla::client::Timestamp::frame, carla::traffic_manager::Parameters::GetHybridPhysicsMode(), carla::traffic_manager::AtomicActorSet::GetIDList(), carla::client::World::GetSnapshot(), carla::traffic_manager::AtomicActorSet::GetState(), carla::traffic_manager::Parameters::GetSynchronousMode(), carla::client::WorldSnapshot::GetTimestamp(), carla::traffic_manager::constants::FrameMemory::GROWTH_STEP_SIZE, carla::traffic_manager::constants::HybridMode::HYBRID_MODE_DT, carla::traffic_manager::constants::FrameMemory::INITIAL_SIZE, carla::traffic_manager::constants::FrameMemory::INV_GROWTH_STEP_SIZE, localization_frame, localization_stage, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), motion_plan_stage, parameters, previous_update_instance, registered_vehicles, registered_vehicles_state, registration_mutex, run_traffic_manger, carla::traffic_manager::Parameters::SetMaxBoundaries(), carla::traffic_manager::AtomicActorSet::Size(), step_begin, step_begin_trigger, step_end, step_end_trigger, step_execution_mutex, tl_frame, traffic_light_stage, carla::traffic_manager::VehicleLightStage::Update(), carla::traffic_manager::TrafficLightStage::Update(), carla::traffic_manager::LocalizationStage::Update(), carla::traffic_manager::MotionPlanStage::Update(), carla::traffic_manager::CollisionStage::Update(), carla::traffic_manager::ALSM::Update(), carla::traffic_manager::VehicleLightStage::UpdateWorldInfo(), vehicle_id_list, vehicle_light_stage, and world.

Referenced by Start().

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

◆ SetAutoLaneChange()

void carla::traffic_manager::TrafficManagerLocal::SetAutoLaneChange ( const ActorPtr actor,
const bool  enable 
)
virtual

Enable/disable automatic lane change on a vehicle.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 362 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetAutoLaneChange().

+ Here is the call graph for this function:

◆ SetBoundariesRespawnDormantVehicles()

void carla::traffic_manager::TrafficManagerLocal::SetBoundariesRespawnDormantVehicles ( const float  lower_bound,
const float  upper_bound 
)
virtual

Method to set boundaries to respawn of dormant vehicles.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 442 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetBoundariesRespawnDormantVehicles().

+ Here is the call graph for this function:

◆ SetCollisionDetection()

void carla::traffic_manager::TrafficManagerLocal::SetCollisionDetection ( const ActorPtr reference_actor,
const ActorPtr other_actor,
const bool  detect_collision 
)
virtual

Method to set collision detection rules between vehicles.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 354 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetCollisionDetection().

+ Here is the call graph for this function:

◆ SetCustomPath()

void carla::traffic_manager::TrafficManagerLocal::SetCustomPath ( const ActorPtr actor,
const Path  path,
const bool  empty_buffer 
)
virtual

Method to set our own imported path.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 414 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetCustomPath().

+ Here is the call graph for this function:

◆ SetDesiredSpeed()

void carla::traffic_manager::TrafficManagerLocal::SetDesiredSpeed ( const ActorPtr actor,
const float  value 
)
virtual

Set a vehicle's exact desired velocity.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 345 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetDesiredSpeed().

+ Here is the call graph for this function:

◆ SetDistanceToLeadingVehicle()

void carla::traffic_manager::TrafficManagerLocal::SetDistanceToLeadingVehicle ( const ActorPtr actor,
const float  distance 
)
virtual

Method to specify how much distance a vehicle should maintain to the leading vehicle.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 366 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetDistanceToLeadingVehicle().

+ Here is the call graph for this function:

◆ SetForceLaneChange()

void carla::traffic_manager::TrafficManagerLocal::SetForceLaneChange ( const ActorPtr actor,
const bool  direction 
)
virtual

Method to force lane change on a vehicle.

Direction flag can be set to true for left and false for right.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 358 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetForceLaneChange().

+ Here is the call graph for this function:

◆ SetGlobalDistanceToLeadingVehicle()

void carla::traffic_manager::TrafficManagerLocal::SetGlobalDistanceToLeadingVehicle ( const float  distance)
virtual

Method to specify how much distance a vehicle should maintain to the Global leading vehicle.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 370 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetGlobalDistanceToLeadingVehicle().

+ Here is the call graph for this function:

◆ SetGlobalLaneOffset()

void carla::traffic_manager::TrafficManagerLocal::SetGlobalLaneOffset ( float const  offset)
virtual

Method to set a global lane offset displacement from the center line.

Positive values imply a right offset while negative ones mean a left one.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 341 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetGlobalLaneOffset().

+ Here is the call graph for this function:

◆ SetGlobalPercentageSpeedDifference()

void carla::traffic_manager::TrafficManagerLocal::SetGlobalPercentageSpeedDifference ( float const  percentage)
virtual

Method to set a global % decrease in velocity with respect to the speed limit.

If less than 0, it's a % increase.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 333 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetGlobalPercentageSpeedDifference().

+ Here is the call graph for this function:

◆ SetHybridPhysicsMode()

void carla::traffic_manager::TrafficManagerLocal::SetHybridPhysicsMode ( const bool  mode_switch)
virtual

Method to set hybrid physics mode.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 402 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetHybridPhysicsMode().

+ Here is the call graph for this function:

◆ SetHybridPhysicsRadius()

void carla::traffic_manager::TrafficManagerLocal::SetHybridPhysicsRadius ( const float  radius)
virtual

Method to set hybrid physics radius.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 406 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetHybridPhysicsRadius().

+ Here is the call graph for this function:

◆ SetImportedRoute()

void carla::traffic_manager::TrafficManagerLocal::SetImportedRoute ( const ActorPtr actor,
const Route  route,
const bool  empty_buffer 
)
virtual

Method to set our own imported route.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 426 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetImportedRoute().

+ Here is the call graph for this function:

◆ SetKeepRightPercentage()

void carla::traffic_manager::TrafficManagerLocal::SetKeepRightPercentage ( const ActorPtr actor,
const float  percentage 
)
virtual

Method to set % to keep on the right lane.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 390 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetKeepRightPercentage().

+ Here is the call graph for this function:

◆ SetLaneOffset()

void carla::traffic_manager::TrafficManagerLocal::SetLaneOffset ( const ActorPtr actor,
const float  offset 
)
virtual

Method to set a lane offset displacement from the center line.

Positive values imply a right offset while negative ones mean a left one.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 337 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetLaneOffset().

+ Here is the call graph for this function:

◆ SetMaxBoundaries()

void carla::traffic_manager::TrafficManagerLocal::SetMaxBoundaries ( const float  lower,
const float  upper 
)
virtual

Method to set limits for boundaries when respawning dormant vehicles.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 446 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetMaxBoundaries().

+ Here is the call graph for this function:

◆ SetOSMMode()

void carla::traffic_manager::TrafficManagerLocal::SetOSMMode ( const bool  mode_switch)
virtual

Method to set Open Street Map mode.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 410 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetOSMMode().

+ Here is the call graph for this function:

◆ SetPercentageIgnoreVehicles()

void carla::traffic_manager::TrafficManagerLocal::SetPercentageIgnoreVehicles ( const ActorPtr actor,
const float  perc 
)
virtual

Method to specify the % chance of ignoring collisions with any vehicle.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 378 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetPercentageIgnoreVehicles().

+ Here is the call graph for this function:

◆ SetPercentageIgnoreWalkers()

void carla::traffic_manager::TrafficManagerLocal::SetPercentageIgnoreWalkers ( const ActorPtr actor,
const float  perc 
)
virtual

Method to specify the % chance of ignoring collisions with any walker.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 374 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetPercentageIgnoreWalkers().

+ Here is the call graph for this function:

◆ SetPercentageRunningLight()

void carla::traffic_manager::TrafficManagerLocal::SetPercentageRunningLight ( const ActorPtr actor,
const float  perc 
)
virtual

Method to specify the % chance of running any traffic light.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 382 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetPercentageRunningLight().

+ Here is the call graph for this function:

◆ SetPercentageRunningSign()

void carla::traffic_manager::TrafficManagerLocal::SetPercentageRunningSign ( const ActorPtr actor,
const float  perc 
)
virtual

Method to specify the % chance of running any traffic sign.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 386 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetPercentageRunningSign().

+ Here is the call graph for this function:

◆ SetPercentageSpeedDifference()

void carla::traffic_manager::TrafficManagerLocal::SetPercentageSpeedDifference ( const ActorPtr actor,
const float  percentage 
)
virtual

Method to set a vehicle's % decrease in velocity with respect to the speed limit.

If less than 0, it's a % increase.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 329 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetPercentageSpeedDifference().

+ Here is the call graph for this function:

◆ SetRandomDeviceSeed()

void carla::traffic_manager::TrafficManagerLocal::SetRandomDeviceSeed ( const uint64_t  _seed)
virtual

Method to set randomization seed.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 488 of file TrafficManagerLocal.cpp.

References random_device, carla::client::World::ResetAllTrafficLights(), seed, and world.

+ Here is the call graph for this function:

◆ SetRandomLeftLaneChangePercentage()

void carla::traffic_manager::TrafficManagerLocal::SetRandomLeftLaneChangePercentage ( const ActorPtr actor,
const float  percentage 
)
virtual

Method to set % to randomly do a left lane change.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 394 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetRandomLeftLaneChangePercentage().

+ Here is the call graph for this function:

◆ SetRandomRightLaneChangePercentage()

void carla::traffic_manager::TrafficManagerLocal::SetRandomRightLaneChangePercentage ( const ActorPtr actor,
const float  percentage 
)
virtual

Method to set % to randomly do a right lane change.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 398 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetRandomRightLaneChangePercentage().

+ Here is the call graph for this function:

◆ SetRespawnDormantVehicles()

void carla::traffic_manager::TrafficManagerLocal::SetRespawnDormantVehicles ( const bool  mode_switch)
virtual

Method to set automatic respawn of dormant vehicles.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 438 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetRespawnDormantVehicles().

+ Here is the call graph for this function:

◆ SetSynchronousMode()

void carla::traffic_manager::TrafficManagerLocal::SetSynchronousMode ( bool  mode)
virtual

Method to switch traffic manager into synchronous execution.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 467 of file TrafficManagerLocal.cpp.

References carla::traffic_manager::Parameters::GetSynchronousMode(), parameters, carla::traffic_manager::Parameters::SetSynchronousMode(), step_begin, and step_begin_trigger.

+ Here is the call graph for this function:

◆ SetSynchronousModeTimeOutInMiliSecond()

void carla::traffic_manager::TrafficManagerLocal::SetSynchronousModeTimeOutInMiliSecond ( double  time)
virtual

Method to set Tick timeout for synchronous execution.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 476 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetSynchronousModeTimeOutInMiliSecond().

+ Here is the call graph for this function:

◆ SetUpdateVehicleLights()

void carla::traffic_manager::TrafficManagerLocal::SetUpdateVehicleLights ( const ActorPtr actor,
const bool  do_update 
)
virtual

Method to set the automatic management of the vehicle lights.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 350 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::SetUpdateVehicleLights().

+ Here is the call graph for this function:

◆ SetupLocalMap()

void carla::traffic_manager::TrafficManagerLocal::SetupLocalMap ( )

Method to setup InMemoryMap.

Definition at line 116 of file TrafficManagerLocal.cpp.

References episode_proxy, carla::client::World::GetMap(), local_map, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), carla::log_warning(), and world.

Referenced by Reset(), and TrafficManagerLocal().

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

◆ ShutDown()

void carla::traffic_manager::TrafficManagerLocal::ShutDown ( )
inlinevirtual

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 281 of file TrafficManagerLocal.h.

◆ Start()

void carla::traffic_manager::TrafficManagerLocal::Start ( )
virtual

To start the TrafficManager.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 135 of file TrafficManagerLocal.cpp.

References Run(), run_traffic_manger, and worker_thread.

Referenced by Reset(), and TrafficManagerLocal().

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

◆ Stop()

void carla::traffic_manager::TrafficManagerLocal::Stop ( void  )
virtual

◆ SynchronousTick()

bool carla::traffic_manager::TrafficManagerLocal::SynchronousTick ( )
virtual

Method to provide synchronous tick.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 251 of file TrafficManagerLocal.cpp.

References carla::traffic_manager::Parameters::GetSynchronousMode(), parameters, step_begin, step_begin_trigger, step_end, step_end_trigger, and step_execution_mutex.

+ Here is the call graph for this function:

◆ UnregisterVehicles()

void carla::traffic_manager::TrafficManagerLocal::UnregisterVehicles ( const std::vector< ActorPtr > &  actor_list)
virtual

This method unregisters a vehicle from traffic manager.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 321 of file TrafficManagerLocal.cpp.

References alsm, registration_mutex, and carla::traffic_manager::ALSM::RemoveActor().

+ Here is the call graph for this function:

◆ UpdateImportedRoute()

void carla::traffic_manager::TrafficManagerLocal::UpdateImportedRoute ( const ActorId actor_id,
const Route  route 
)
virtual

Method to update an already set route.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 434 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::UpdateImportedRoute().

+ Here is the call graph for this function:

◆ UpdateUploadPath()

void carla::traffic_manager::TrafficManagerLocal::UpdateUploadPath ( const ActorId actor_id,
const Path  path 
)
virtual

Method to update an already set list of points.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 422 of file TrafficManagerLocal.cpp.

References parameters, and carla::traffic_manager::Parameters::UpdateUploadPath().

+ Here is the call graph for this function:

Member Data Documentation

◆ alsm

ALSM carla::traffic_manager::TrafficManagerLocal::alsm
private

Definition at line 97 of file TrafficManagerLocal.h.

Referenced by Run(), and UnregisterVehicles().

◆ buffer_map

BufferMap carla::traffic_manager::TrafficManagerLocal::buffer_map
private

Structures to hold waypoint buffers for all vehicles.

Definition at line 72 of file TrafficManagerLocal.h.

Referenced by Stop().

◆ collision_frame

CollisionFrame carla::traffic_manager::TrafficManagerLocal::collision_frame
private

Array to hold output data of collision avoidance.

Definition at line 84 of file TrafficManagerLocal.h.

Referenced by Run(), and Stop().

◆ collision_stage

CollisionStage carla::traffic_manager::TrafficManagerLocal::collision_stage
private

Definition at line 93 of file TrafficManagerLocal.h.

Referenced by Run(), and Stop().

◆ control_frame

ControlFrame carla::traffic_manager::TrafficManagerLocal::control_frame
private

Array to hold output data of motion planning.

Definition at line 88 of file TrafficManagerLocal.h.

Referenced by Run(), and Stop().

◆ current_reserved_capacity

uint64_t carla::traffic_manager::TrafficManagerLocal::current_reserved_capacity {0u}
private

Variable to keep track of currently reserved array space for frames.

Definition at line 90 of file TrafficManagerLocal.h.

Referenced by Run(), and Stop().

◆ episode_proxy

carla::client::detail::EpisodeProxy carla::traffic_manager::TrafficManagerLocal::episode_proxy
private

CARLA client connection object.

Definition at line 59 of file TrafficManagerLocal.h.

Referenced by GetEpisodeProxy(), Reset(), Run(), SetupLocalMap(), and ~TrafficManagerLocal().

◆ lateral_highway_PID_parameters

std::vector<float> carla::traffic_manager::TrafficManagerLocal::lateral_highway_PID_parameters
private

Definition at line 57 of file TrafficManagerLocal.h.

◆ lateral_PID_parameters

std::vector<float> carla::traffic_manager::TrafficManagerLocal::lateral_PID_parameters
private

Definition at line 56 of file TrafficManagerLocal.h.

◆ local_map

LocalMapPtr carla::traffic_manager::TrafficManagerLocal::local_map
private

Pointer to local map cache.

Definition at line 70 of file TrafficManagerLocal.h.

Referenced by Release(), and SetupLocalMap().

◆ localization_frame

LocalizationFrame carla::traffic_manager::TrafficManagerLocal::localization_frame
private

Array to hold output data of localization stage.

Definition at line 82 of file TrafficManagerLocal.h.

Referenced by Run(), and Stop().

◆ localization_stage

LocalizationStage carla::traffic_manager::TrafficManagerLocal::localization_stage
private

Various stages representing core operations of traffic manager.

Definition at line 92 of file TrafficManagerLocal.h.

Referenced by GetActionBuffer(), GetNextAction(), Run(), and Stop().

◆ longitudinal_highway_PID_parameters

std::vector<float> carla::traffic_manager::TrafficManagerLocal::longitudinal_highway_PID_parameters
private

Definition at line 55 of file TrafficManagerLocal.h.

◆ longitudinal_PID_parameters

std::vector<float> carla::traffic_manager::TrafficManagerLocal::longitudinal_PID_parameters
private

PID controller parameters.

Definition at line 54 of file TrafficManagerLocal.h.

◆ marked_for_removal

std::vector<ActorId> carla::traffic_manager::TrafficManagerLocal::marked_for_removal
private

Definition at line 116 of file TrafficManagerLocal.h.

◆ motion_plan_stage

MotionPlanStage carla::traffic_manager::TrafficManagerLocal::motion_plan_stage
private

Definition at line 95 of file TrafficManagerLocal.h.

Referenced by Run(), and Stop().

◆ parameters

Parameters carla::traffic_manager::TrafficManagerLocal::parameters
private

◆ previous_update_instance

TimePoint carla::traffic_manager::TrafficManagerLocal::previous_update_instance
private

Time instance used to calculate dt in asynchronous mode.

Definition at line 78 of file TrafficManagerLocal.h.

Referenced by Run(), and Stop().

◆ random_device

RandomGenerator carla::traffic_manager::TrafficManagerLocal::random_device = RandomGenerator(seed)
private

Structure holding random devices per vehicle.

Definition at line 115 of file TrafficManagerLocal.h.

Referenced by SetRandomDeviceSeed().

◆ registered_vehicles

AtomicActorSet carla::traffic_manager::TrafficManagerLocal::registered_vehicles
private

Set of all actors registered with traffic manager.

Definition at line 63 of file TrafficManagerLocal.h.

Referenced by GetRegisteredVehiclesIDs(), RegisterVehicles(), Run(), and Stop().

◆ registered_vehicles_state

int carla::traffic_manager::TrafficManagerLocal::registered_vehicles_state
private

State counter to track changes in registered actors.

Definition at line 65 of file TrafficManagerLocal.h.

Referenced by Run(), Stop(), and TrafficManagerLocal().

◆ registration_mutex

std::mutex carla::traffic_manager::TrafficManagerLocal::registration_mutex
private

Mutex to prevent vehicle registration during frame array re-allocation.

Definition at line 118 of file TrafficManagerLocal.h.

Referenced by RegisterVehicles(), Run(), and UnregisterVehicles().

◆ run_traffic_manger

std::atomic<bool> carla::traffic_manager::TrafficManagerLocal::run_traffic_manger {true}
private

Switch to turn on / turn off traffic manager.

Definition at line 101 of file TrafficManagerLocal.h.

Referenced by Run(), Start(), and Stop().

◆ seed

uint64_t carla::traffic_manager::TrafficManagerLocal::seed {static_cast<uint64_t>(time(NULL))}
private

Randomization seed.

Definition at line 113 of file TrafficManagerLocal.h.

Referenced by SetRandomDeviceSeed().

◆ server

TrafficManagerServer carla::traffic_manager::TrafficManagerLocal::server
private

Traffic manager server instance.

Definition at line 99 of file TrafficManagerLocal.h.

Referenced by ~TrafficManagerLocal().

◆ simulation_state

SimulationState carla::traffic_manager::TrafficManagerLocal::simulation_state
private

Type containing the current state of all actors involved in the simulation.

Definition at line 76 of file TrafficManagerLocal.h.

Referenced by Stop().

◆ step_begin

std::atomic<bool> carla::traffic_manager::TrafficManagerLocal::step_begin {false}
private

Flags to signal step begin and end.

Definition at line 103 of file TrafficManagerLocal.h.

Referenced by Run(), SetSynchronousMode(), Stop(), and SynchronousTick().

◆ step_begin_trigger

std::condition_variable carla::traffic_manager::TrafficManagerLocal::step_begin_trigger
private

Condition variables for progressing synchronous execution.

Definition at line 108 of file TrafficManagerLocal.h.

Referenced by Run(), SetSynchronousMode(), Stop(), and SynchronousTick().

◆ step_end

std::atomic<bool> carla::traffic_manager::TrafficManagerLocal::step_end {false}
private

Definition at line 104 of file TrafficManagerLocal.h.

Referenced by Run(), Stop(), and SynchronousTick().

◆ step_end_trigger

std::condition_variable carla::traffic_manager::TrafficManagerLocal::step_end_trigger
private

Definition at line 109 of file TrafficManagerLocal.h.

Referenced by Run(), and SynchronousTick().

◆ step_execution_mutex

std::mutex carla::traffic_manager::TrafficManagerLocal::step_execution_mutex
private

Mutex for progressing synchronous execution.

Definition at line 106 of file TrafficManagerLocal.h.

Referenced by Run(), and SynchronousTick().

◆ tl_frame

TLFrame carla::traffic_manager::TrafficManagerLocal::tl_frame
private

Array to hold output data of traffic light response.

Definition at line 86 of file TrafficManagerLocal.h.

Referenced by Run(), and Stop().

◆ track_traffic

TrackTraffic carla::traffic_manager::TrafficManagerLocal::track_traffic
private

Object for tracking paths of the traffic vehicles.

Definition at line 74 of file TrafficManagerLocal.h.

Referenced by Stop().

◆ traffic_light_stage

TrafficLightStage carla::traffic_manager::TrafficManagerLocal::traffic_light_stage
private

Definition at line 94 of file TrafficManagerLocal.h.

Referenced by Run(), and Stop().

◆ vehicle_id_list

std::vector<ActorId> carla::traffic_manager::TrafficManagerLocal::vehicle_id_list
private

List of vehicles registered with the traffic manager in current update cycle.

Definition at line 68 of file TrafficManagerLocal.h.

Referenced by Run(), and Stop().

◆ vehicle_light_stage

VehicleLightStage carla::traffic_manager::TrafficManagerLocal::vehicle_light_stage
private

Definition at line 96 of file TrafficManagerLocal.h.

Referenced by Run().

◆ worker_thread

std::unique_ptr<std::thread> carla::traffic_manager::TrafficManagerLocal::worker_thread
private

Single worker thread for sequential execution of sub-components.

Definition at line 111 of file TrafficManagerLocal.h.

Referenced by Start(), and Stop().

◆ world

cc::World carla::traffic_manager::TrafficManagerLocal::world
private

CARLA client and object.

Definition at line 61 of file TrafficManagerLocal.h.

Referenced by Reset(), Run(), SetRandomDeviceSeed(), and SetupLocalMap().


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