CARLA
Loading...
Searching...
No Matches
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:

Public Member Functions

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

Private Member Functions

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

Private Attributes

ALSM alsm
 
BufferMap buffer_map
 Structures to hold waypoint buffers for all vehicles.
 
CollisionFrame collision_frame
 Array to hold output data of collision avoidance.
 
CollisionStage collision_stage
 
ControlFrame control_frame
 Array to hold output data of motion planning.
 
uint64_t current_reserved_capacity {0u}
 Variable to keep track of currently reserved array space for frames.
 
carla::client::detail::EpisodeProxy episode_proxy
 CARLA client connection object.
 
rpc::EpisodeSettings episode_settings
 Cached episode settings; they only change through world.apply_settings.
 
std::unordered_map< ActorId, std::pair< float, bool > > large_vehicles
 
size_t last_frame {0}
 Last processed frame.
 
double last_settings_update {-std::numeric_limits<double>::infinity()}
 Simulation time of the last episode settings refresh.
 
std::vector< float > lateral_highway_PID_parameters
 
std::vector< float > lateral_PID_parameters
 
LocalMapPtr local_map
 Pointer to local map cache.
 
LocalizationFrame localization_frame
 Array to hold output data of localization stage.
 
LocalizationStage localization_stage
 Various stages representing core operations of traffic manager.
 
std::vector< float > longitudinal_highway_PID_parameters
 
std::vector< float > longitudinal_PID_parameters
 PID controller parameters.
 
std::vector< ActorId > marked_for_removal
 
MotionPlanStage motion_plan_stage
 
Parameters parameters
 Parameterization object.
 
TimePoint previous_update_instance
 Time instance used to calculate dt in asynchronous mode.
 
RandomGenerator random_device = RandomGenerator(seed)
 Structure holding random devices per vehicle.
 
AtomicActorSet registered_vehicles
 Set of all actors registered with traffic manager.
 
int registered_vehicles_state
 State counter to track changes in registered actors.
 
std::mutex registration_mutex
 Mutex to prevent vehicle registration during frame array re-allocation.
 
std::atomic< bool > run_traffic_manger {true}
 Switch to turn on / turn off traffic manager.
 
uint64_t seed {static_cast<uint64_t>(time(NULL))}
 Randomization seed.
 
TrafficManagerServer server
 Traffic manager server instance.
 
SimulationState simulation_state
 Type containing the current state of all actors involved in the simulation.
 
TLFrame tl_frame
 Array to hold output data of traffic light response.
 
TrackTraffic track_traffic
 Object for tracking paths of the traffic vehicles.
 
TrafficLightStage traffic_light_stage
 
uint64_t unwaited_control_batches
 Starts at the limit so the first batch of an episode is waited for.
 
std::vector< ActorId > vehicle_id_list
 List of vehicles registered with the traffic manager in current update cycle.
 
VehicleLightStage vehicle_light_stage
 
std::unique_ptr< std::thread > worker_thread
 Single worker thread for sequential execution of sub-components.
 
cc::World world
 CARLA client and object.
 

Detailed Description

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

Definition at line 52 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 21 of file TrafficManagerLocal.cpp.

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

◆ ~TrafficManagerLocal()

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

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 533 of file TrafficManagerLocal.cpp.

◆ 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 529 of file TrafficManagerLocal.cpp.

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

◆ GetEpisodeProxy()

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

Get CARLA episode information.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 576 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 525 of file TrafficManagerLocal.cpp.

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

◆ GetRegisteredVehiclesIDs()

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

Get list of all registered vehicles.

Definition at line 580 of file TrafficManagerLocal.cpp.

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

◆ RegisterVehicles()

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

◆ Release()

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

To release the traffic manager.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 354 of file TrafficManagerLocal.cpp.

References local_map, and Stop().

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

◆ RemoveImportedRoute()

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

◆ 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 493 of file TrafficManagerLocal.cpp.

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

◆ Reset()

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

◆ Run()

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

Initiates thread to run the TrafficManager sequentially.

Definition at line 300 of file TrafficManagerLocal.cpp.

References carla::traffic_manager::Parameters::GetSynchronousMode(), parameters, run_traffic_manger, and Step().

Referenced by SetSynchronousMode(), and Start().

◆ 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 436 of file TrafficManagerLocal.cpp.

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

◆ 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 517 of file TrafficManagerLocal.cpp.

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

◆ 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 428 of file TrafficManagerLocal.cpp.

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

◆ 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 489 of file TrafficManagerLocal.cpp.

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

◆ 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 419 of file TrafficManagerLocal.cpp.

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

◆ 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 440 of file TrafficManagerLocal.cpp.

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

◆ 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 432 of file TrafficManagerLocal.cpp.

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

◆ 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 444 of file TrafficManagerLocal.cpp.

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

◆ 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 407 of file TrafficManagerLocal.cpp.

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

◆ SetGlobalLargeVehicleWideTurn()

void carla::traffic_manager::TrafficManagerLocal::SetGlobalLargeVehicleWideTurn ( const bool  enable)
virtual

Method to enable/disable the wide-turn manoeuvre globally for large vehicles.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 415 of file TrafficManagerLocal.cpp.

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

◆ 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 399 of file TrafficManagerLocal.cpp.

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

◆ 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 477 of file TrafficManagerLocal.cpp.

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

◆ 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 481 of file TrafficManagerLocal.cpp.

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

◆ 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 501 of file TrafficManagerLocal.cpp.

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

◆ SetKeepSlowLanePercentage()

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

Method to set % to keep on the slow lane.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 464 of file TrafficManagerLocal.cpp.

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

◆ 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 403 of file TrafficManagerLocal.cpp.

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

◆ SetLargeVehicleWideTurn()

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

Method to enable/disable the wide-turn manoeuvre for a single large vehicle.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 411 of file TrafficManagerLocal.cpp.

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

◆ 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 521 of file TrafficManagerLocal.cpp.

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

◆ 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 485 of file TrafficManagerLocal.cpp.

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

◆ 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 452 of file TrafficManagerLocal.cpp.

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

◆ 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 448 of file TrafficManagerLocal.cpp.

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

◆ 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 456 of file TrafficManagerLocal.cpp.

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

◆ 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 460 of file TrafficManagerLocal.cpp.

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

◆ 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 395 of file TrafficManagerLocal.cpp.

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

◆ 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 584 of file TrafficManagerLocal.cpp.

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

◆ 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 469 of file TrafficManagerLocal.cpp.

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

◆ 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 473 of file TrafficManagerLocal.cpp.

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

◆ 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 513 of file TrafficManagerLocal.cpp.

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

◆ SetSynchronousMode()

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

◆ 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 572 of file TrafficManagerLocal.cpp.

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

◆ 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 424 of file TrafficManagerLocal.cpp.

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

◆ SetupLocalMap()

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

◆ ShutDown()

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

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 295 of file TrafficManagerLocal.h.

◆ Start()

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

◆ Step()

void carla::traffic_manager::TrafficManagerLocal::Step ( )

To do one step of the TrafficManager.

Definition at line 166 of file TrafficManagerLocal.cpp.

References carla::rpc::EpisodeSettings::actor_active_distance, alsm, carla::traffic_manager::CollisionStage::ClearCycleCache(), collision_frame, collision_stage, control_frame, current_reserved_capacity, carla::client::Timestamp::elapsed_seconds, episode_proxy, episode_settings, carla::traffic_manager::constants::WorldInfoRefresh::EPISODE_SETTINGS_REFRESH_PERIOD, 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::FrameMemory::INITIAL_SIZE, carla::traffic_manager::constants::FrameMemory::INV_GROWTH_STEP_SIZE, carla::traffic_manager::constants::WorldInfoRefresh::IsBatchSyncDue(), carla::traffic_manager::constants::WorldInfoRefresh::IsRefreshDue(), last_frame, last_settings_update, localization_frame, localization_stage, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), carla::traffic_manager::constants::WorldInfoRefresh::MAX_UNWAITED_CONTROL_BATCHES, motion_plan_stage, parameters, previous_update_instance, registered_vehicles, registered_vehicles_state, registration_mutex, carla::traffic_manager::MotionPlanStage::SetCycleTimestamp(), carla::traffic_manager::Parameters::SetMaxBoundaries(), carla::traffic_manager::AtomicActorSet::Size(), carla::traffic_manager::constants::WorldInfoRefresh::SNAPSHOT_POLL_PERIOD, tl_frame, traffic_light_stage, unwaited_control_batches, carla::traffic_manager::ALSM::Update(), carla::traffic_manager::MotionPlanStage::Update(), carla::traffic_manager::CollisionStage::Update(), carla::traffic_manager::LocalizationStage::Update(), carla::traffic_manager::TrafficLightStage::Update(), carla::traffic_manager::VehicleLightStage::Update(), carla::traffic_manager::VehicleLightStage::UpdateWorldInfo(), vehicle_id_list, vehicle_light_stage, and world.

Referenced by Run(), and SynchronousTick().

◆ Stop()

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

◆ SynchronousTick()

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

Method to provide synchronous tick.

Implements carla::traffic_manager::TrafficManagerBase.

Definition at line 306 of file TrafficManagerLocal.cpp.

References carla::traffic_manager::Parameters::GetSynchronousMode(), parameters, and Step().

◆ 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 387 of file TrafficManagerLocal.cpp.

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

◆ 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 509 of file TrafficManagerLocal.cpp.

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

◆ 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 497 of file TrafficManagerLocal.cpp.

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

Member Data Documentation

◆ alsm

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

Definition at line 101 of file TrafficManagerLocal.h.

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

◆ buffer_map

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

Structures to hold waypoint buffers for all vehicles.

Definition at line 76 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 88 of file TrafficManagerLocal.h.

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

◆ collision_stage

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

Definition at line 97 of file TrafficManagerLocal.h.

Referenced by Step(), and Stop().

◆ control_frame

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

Array to hold output data of motion planning.

Definition at line 92 of file TrafficManagerLocal.h.

Referenced by Start(), Step(), 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 94 of file TrafficManagerLocal.h.

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

◆ episode_proxy

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

CARLA client connection object.

Definition at line 61 of file TrafficManagerLocal.h.

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

◆ episode_settings

rpc::EpisodeSettings carla::traffic_manager::TrafficManagerLocal::episode_settings
private

Cached episode settings; they only change through world.apply_settings.

Definition at line 111 of file TrafficManagerLocal.h.

Referenced by Step(), and Stop().

◆ large_vehicles

std::unordered_map<ActorId, std::pair<float, bool> > carla::traffic_manager::TrafficManagerLocal::large_vehicles
private

Definition at line 67 of file TrafficManagerLocal.h.

◆ last_frame

size_t carla::traffic_manager::TrafficManagerLocal::last_frame {0}
private

Last processed frame.

Definition at line 109 of file TrafficManagerLocal.h.

Referenced by Step(), and Stop().

◆ last_settings_update

double carla::traffic_manager::TrafficManagerLocal::last_settings_update {-std::numeric_limits<double>::infinity()}
private

Simulation time of the last episode settings refresh.

Definition at line 113 of file TrafficManagerLocal.h.

Referenced by Step(), and Stop().

◆ lateral_highway_PID_parameters

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

Definition at line 59 of file TrafficManagerLocal.h.

◆ lateral_PID_parameters

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

Definition at line 58 of file TrafficManagerLocal.h.

◆ local_map

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

Pointer to local map cache.

Definition at line 74 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 86 of file TrafficManagerLocal.h.

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

◆ localization_stage

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

Various stages representing core operations of traffic manager.

Definition at line 96 of file TrafficManagerLocal.h.

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

◆ longitudinal_highway_PID_parameters

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

Definition at line 57 of file TrafficManagerLocal.h.

◆ longitudinal_PID_parameters

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

PID controller parameters.

Definition at line 56 of file TrafficManagerLocal.h.

◆ marked_for_removal

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

Definition at line 121 of file TrafficManagerLocal.h.

◆ motion_plan_stage

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

Definition at line 99 of file TrafficManagerLocal.h.

Referenced by Step(), 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 82 of file TrafficManagerLocal.h.

Referenced by Step(), and Stop().

◆ random_device

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

Structure holding random devices per vehicle.

Definition at line 120 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 65 of file TrafficManagerLocal.h.

Referenced by GetRegisteredVehiclesIDs(), RegisterVehicles(), Step(), 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 69 of file TrafficManagerLocal.h.

Referenced by Step(), 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 123 of file TrafficManagerLocal.h.

Referenced by RegisterVehicles(), Step(), Stop(), 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 105 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 118 of file TrafficManagerLocal.h.

Referenced by SetRandomDeviceSeed().

◆ server

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

Traffic manager server instance.

Definition at line 103 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 80 of file TrafficManagerLocal.h.

Referenced by Stop().

◆ tl_frame

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

Array to hold output data of traffic light response.

Definition at line 90 of file TrafficManagerLocal.h.

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

◆ track_traffic

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

Object for tracking paths of the traffic vehicles.

Definition at line 78 of file TrafficManagerLocal.h.

Referenced by Stop().

◆ traffic_light_stage

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

Definition at line 98 of file TrafficManagerLocal.h.

Referenced by Step(), and Stop().

◆ unwaited_control_batches

uint64_t carla::traffic_manager::TrafficManagerLocal::unwaited_control_batches
private
Initial value:

Starts at the limit so the first batch of an episode is waited for.

Definition at line 115 of file TrafficManagerLocal.h.

Referenced by Step(), 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 72 of file TrafficManagerLocal.h.

Referenced by Step(), and Stop().

◆ vehicle_light_stage

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

Definition at line 100 of file TrafficManagerLocal.h.

Referenced by Step(), and Stop().

◆ 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 107 of file TrafficManagerLocal.h.

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

◆ world

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

CARLA client and object.

Definition at line 63 of file TrafficManagerLocal.h.

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


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