The function of this class is to integrate all the various stages of the traffic manager appropriately using messengers. More...
#include <TrafficManagerRemote.h>
Public Member Functions | |
ActionBuffer | GetActionBuffer (const ActorId &actor_id) |
Method to get the vehicle's action buffer. More... | |
carla::client::detail::EpisodeProxy & | GetEpisodeProxy () |
Get CARLA episode information. More... | |
Action | GetNextAction (const ActorId &actor_id) |
Method to get the vehicle's next action. More... | |
void | HealthCheckRemoteTM () |
Method to check server is alive or not. 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 path. More... | |
void | Reset () |
To reset the traffic manager. 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 for respawning 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 Global Distance. 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 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... | |
virtual void | ShutDown () |
void | Start () |
To start the TrafficManager. More... | |
void | Stop () |
To stop the TrafficManager. More... | |
bool | SynchronousTick () |
Method to provide synchronous tick. More... | |
TrafficManagerRemote (const std::pair< std::string, uint16_t > &_serverTM, carla::client::detail::EpisodeProxy &episodeProxy) | |
Constructor store remote location information. 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 path. More... | |
virtual | ~TrafficManagerRemote () |
Destructor. More... | |
Public Member Functions inherited from carla::traffic_manager::TrafficManagerBase | |
TrafficManagerBase () | |
Protected constructor for singleton lifecycle management. More... | |
virtual | ~TrafficManagerBase () |
Destructor. More... | |
Private Attributes | |
std::condition_variable | _cv |
bool | _keep_alive = true |
std::mutex | _mutex |
TrafficManagerClient | client |
Remote client using the IP and port information it connects to as remote RPC traffic manager server. More... | |
carla::client::detail::EpisodeProxy | episodeProxyTM |
CARLA client connection object. More... | |
The function of this class is to integrate all the various stages of the traffic manager appropriately using messengers.
Definition at line 28 of file TrafficManagerRemote.h.
carla::traffic_manager::TrafficManagerRemote::TrafficManagerRemote | ( | const std::pair< std::string, uint16_t > & | _serverTM, |
carla::client::detail::EpisodeProxy & | episodeProxy | ||
) |
Constructor store remote location information.
Definition at line 16 of file TrafficManagerRemote.cpp.
References Start().
|
virtual |
Destructor.
Definition at line 27 of file TrafficManagerRemote.cpp.
References Release().
|
virtual |
Method to get the vehicle's action buffer.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 280 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::GetActionBuffer().
|
virtual |
Get CARLA episode information.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 292 of file TrafficManagerRemote.cpp.
References episodeProxyTM.
|
virtual |
Method to get the vehicle's next action.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 276 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::GetNextAction().
void carla::traffic_manager::TrafficManagerRemote::HealthCheckRemoteTM | ( | ) |
Method to check server is alive or not.
Definition at line 288 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::HealthCheckRemoteTM().
Referenced by carla::traffic_manager::TrafficManager::CreateTrafficManagerClient().
|
virtual |
This method registers a vehicle with the traffic manager.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 92 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::RegisterVehicle().
|
virtual |
To release the traffic manager.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 79 of file TrafficManagerRemote.cpp.
References Stop().
Referenced by ~TrafficManagerRemote().
|
virtual |
Method to remove a route.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 244 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::RemoveImportedRoute().
|
virtual |
Method to remove a path.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 230 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::RemoveUploadPath().
|
virtual |
To reset the traffic manager.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 83 of file TrafficManagerRemote.cpp.
References episodeProxyTM, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), Start(), and Stop().
|
virtual |
Enable/disable automatic lane change on a vehicle.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 153 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetAutoLaneChange().
|
virtual |
Method to set boundaries for respawning vehicles.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 256 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetBoundariesRespawnDormantVehicles().
|
virtual |
Method to set collision detection rules between vehicles.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 140 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetCollisionDetection().
|
virtual |
Method to set our own imported path.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 224 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetCustomPath().
|
virtual |
Set a vehicle's exact desired velocity.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 114 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetDesiredSpeed().
|
virtual |
Method to specify how much distance a vehicle should maintain to the leading vehicle.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 159 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetDistanceToLeadingVehicle().
|
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 147 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetForceLaneChange().
|
virtual |
Method to specify Global Distance.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 165 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetGlobalDistanceToLeadingVehicle().
|
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 130 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetGlobalLaneOffset().
|
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 120 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetGlobalPercentageSpeedDifference().
|
virtual |
Method to set hybrid physics mode.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 212 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetHybridPhysicsMode().
|
virtual |
Method to set hybrid physics radius.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 216 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetHybridPhysicsRadius().
|
virtual |
Method to set our own imported route.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 238 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetImportedRoute().
|
virtual |
Method to set % to keep on the right lane.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 194 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetKeepRightPercentage().
|
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 124 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetLaneOffset().
|
virtual |
Method to set limits for boundaries when respawning vehicles.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 260 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetMaxBoundaries().
|
virtual |
Method to set Open Street Map mode.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 220 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetOSMMode().
|
virtual |
Method to specify the % chance of ignoring collisions with any vehicle.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 176 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetPercentageIgnoreVehicles().
|
virtual |
Method to specify the % chance of ignoring collisions with any walker.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 170 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetPercentageIgnoreWalkers().
|
virtual |
Method to specify the % chance of running any traffic light.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 182 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetPercentageRunningLight().
|
virtual |
Method to specify the % chance of running any traffic sign.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 188 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetPercentageRunningSign().
|
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 108 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetPercentageSpeedDifference().
|
virtual |
Method to set randomization seed.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 296 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetRandomDeviceSeed().
|
virtual |
Method to set % to randomly do a left lane change.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 200 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetRandomLeftLaneChangePercentage().
|
virtual |
Method to set % to randomly do a right lane change.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 206 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetRandomRightLaneChangePercentage().
|
virtual |
Method to set automatic respawn of dormant vehicles.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 252 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetRespawnDormantVehicles().
|
virtual |
Method to switch traffic manager into synchronous execution.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 268 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetSynchronousMode().
|
virtual |
Method to set Tick timeout for synchronous execution.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 272 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetSynchronousModeTimeOutInMiliSecond().
|
virtual |
Method to set the automatic management of the vehicle lights.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 134 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::SetUpdateVehicleLights().
|
virtual |
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 264 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::ShutDown().
|
virtual |
To start the TrafficManager.
Until connection active
Create error msg
TSet the error message
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 31 of file TrafficManagerRemote.cpp.
References _cv, _keep_alive, client, episodeProxyTM, carla::traffic_manager::TrafficManagerClient::getServerDetails(), carla::traffic_manager::TrafficManagerClient::HealthCheckRemoteTM(), carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), and carla::traffic_manager::constants::Networking::TM_TIMEOUT.
Referenced by Reset(), and TrafficManagerRemote().
|
virtual |
To stop the TrafficManager.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 70 of file TrafficManagerRemote.cpp.
References _cv, _keep_alive, _mutex, and carla::traffic_manager::constants::Networking::TM_TIMEOUT.
Referenced by Release(), and Reset().
|
virtual |
Method to provide synchronous tick.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 284 of file TrafficManagerRemote.cpp.
|
virtual |
This method unregisters a vehicle from traffic manager.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 100 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::UnregisterVehicle().
|
virtual |
Method to update an already set route.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 248 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::UpdateImportedRoute().
|
virtual |
Method to update an already set path.
Implements carla::traffic_manager::TrafficManagerBase.
Definition at line 234 of file TrafficManagerRemote.cpp.
References client, and carla::traffic_manager::TrafficManagerClient::UpdateUploadPath().
|
private |
Definition at line 187 of file TrafficManagerRemote.h.
|
private |
Definition at line 191 of file TrafficManagerRemote.h.
|
private |
Definition at line 189 of file TrafficManagerRemote.h.
Referenced by Stop().
|
private |
Remote client using the IP and port information it connects to as remote RPC traffic manager server.
Definition at line 182 of file TrafficManagerRemote.h.
Referenced by GetActionBuffer(), GetNextAction(), HealthCheckRemoteTM(), RegisterVehicles(), RemoveImportedRoute(), RemoveUploadPath(), SetAutoLaneChange(), SetBoundariesRespawnDormantVehicles(), SetCollisionDetection(), SetCustomPath(), SetDesiredSpeed(), SetDistanceToLeadingVehicle(), SetForceLaneChange(), SetGlobalDistanceToLeadingVehicle(), SetGlobalLaneOffset(), SetGlobalPercentageSpeedDifference(), SetHybridPhysicsMode(), SetHybridPhysicsRadius(), SetImportedRoute(), SetKeepRightPercentage(), SetLaneOffset(), SetMaxBoundaries(), SetOSMMode(), SetPercentageIgnoreVehicles(), SetPercentageIgnoreWalkers(), SetPercentageRunningLight(), SetPercentageRunningSign(), SetPercentageSpeedDifference(), SetRandomDeviceSeed(), SetRandomLeftLaneChangePercentage(), SetRandomRightLaneChangePercentage(), SetRespawnDormantVehicles(), SetSynchronousMode(), SetSynchronousModeTimeOutInMiliSecond(), SetUpdateVehicleLights(), ShutDown(), Start(), UnregisterVehicles(), UpdateImportedRoute(), and UpdateUploadPath().
|
private |
CARLA client connection object.
Definition at line 185 of file TrafficManagerRemote.h.
Referenced by GetEpisodeProxy(), Reset(), and Start().