|
CARLA
|
This class integrates all the various stages of the traffic manager appropriately using messengers. More...
#include <TrafficManager.h>
Public Member Functions | |
| ActionBuffer | GetActionBuffer (const ActorId &actor_id) |
| Method to get the action buffer. | |
| Action | GetNextAction (const ActorId &actor_id) |
| Method to get the next action. | |
| bool | IsValidPort () const |
| TrafficManager & | operator= (const TrafficManager &)=default |
| TrafficManager & | operator= (TrafficManager &&)=default |
| uint16_t | Port () const |
| void | RegisterVehicles (const std::vector< ActorPtr > &actor_list) |
| This method registers a vehicle with 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 path. | |
| void | SetAutoLaneChange (const ActorPtr &actor, const bool enable) |
| Enable/disable automatic lane change on a vehicle. | |
| 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 Set Global distance to 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) |
| Set a global % decrease in velocity with respect to the speed limit. | |
| void | SetHybridPhysicsMode (const bool mode_switch) |
| This method sets the hybrid physics mode. | |
| void | SetHybridPhysicsRadius (const float radius) |
| This method sets the 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 | 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 a light. | |
| void | SetPercentageRunningSign (const ActorPtr &actor, const float perc) |
| Method to specify the % chance of running a sign. | |
| void | SetPercentageSpeedDifference (const ActorPtr &actor, const float percentage) |
| 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 | 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) |
| Set the automatic management of the vehicle lights. | |
| void | ShutDown () |
| bool | SynchronousTick () |
| Method to provide synchronous tick. | |
| TrafficManager () | |
| TrafficManager (carla::client::detail::EpisodeProxy episode_proxy, uint16_t port=TM_DEFAULT_PORT) | |
| Public constructor for singleton life cycle management. | |
| TrafficManager (const TrafficManager &other) | |
| TrafficManager (TrafficManager &&)=default | |
| 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 path. | |
Static Public Member Functions | |
| static void | Release () |
| static void | RequestReset (uint64_t episode_id, std::function< void()> on_done) |
| Non-blocking: reset all TMs once per episode on the reset thread, then call on_done. | |
| static void | Reset (uint64_t episode_id) |
| static void | Tick () |
Private Member Functions | |
| bool | CreateTrafficManagerClient (carla::client::detail::EpisodeProxy episode_proxy, uint16_t port) |
| void | CreateTrafficManagerServer (carla::client::detail::EpisodeProxy episode_proxy, uint16_t port) |
| TrafficManagerBase * | GetTM (uint16_t port) const |
Private Attributes | |
| uint16_t | _port = 0 |
Static Private Attributes | |
| static std::mutex | _mutex |
| static std::map< uint16_t, TrafficManagerBase * > | _tm_map |
This class integrates all the various stages of the traffic manager appropriately using messengers.
Definition at line 27 of file TrafficManager.h.
|
explicit |
Public constructor for singleton life cycle management.
Definition at line 43 of file TrafficManager.cpp.
References _port, CreateTrafficManagerClient(), CreateTrafficManagerServer(), and GetTM().
Referenced by operator=(), operator=(), TrafficManager(), and TrafficManager().
|
inline |
Definition at line 35 of file TrafficManager.h.
References _port, and TrafficManager().
|
inline |
Definition at line 39 of file TrafficManager.h.
Referenced by carla::client::Client::GetInstanceTM().
|
default |
References TrafficManager().
|
private |
Get TM server info (Remote IP & PORT)
Set remote TM server IP and port
Try to connect to remote TM server
Check memory allocated or not
Try to reset all traffic lights
Set the pointer of the instance
If Connection error occurred
Clear previously allocated memory
Definition at line 292 of file TrafficManager.cpp.
References _tm_map, carla::traffic_manager::TrafficManagerRemote::HealthCheckRemoteTM(), carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), and carla::traffic_manager::TrafficManagerRemote::TrafficManagerRemote().
Referenced by TrafficManager().
|
private |
Define local constants
Create local instance of TM
Get TM server info (Local IP & PORT)
Set this client as the TM to server
Set the pointer of the instance
Definition at line 198 of file TrafficManager.cpp.
References _tm_map, IP_DATA_BUFFER_SIZE, carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), SOCK_INVALID_INDEX, and carla::traffic_manager::TrafficManagerLocal::TrafficManagerLocal().
Referenced by TrafficManager().
|
inline |
Method to get the action buffer.
Definition at line 367 of file TrafficManager.h.
References _port, carla::traffic_manager::TrafficManagerBase::GetActionBuffer(), and GetTM().
Method to get the next action.
Definition at line 356 of file TrafficManager.h.
References _port, carla::traffic_manager::TrafficManagerBase::GetNextAction(), and GetTM().
|
inlineprivate |
Definition at line 388 of file TrafficManager.h.
References _mutex, and _tm_map.
Referenced by GetActionBuffer(), GetNextAction(), RegisterVehicles(), RemoveImportedRoute(), RemoveUploadPath(), SetAutoLaneChange(), SetCollisionDetection(), SetCustomPath(), SetDesiredSpeed(), SetDistanceToLeadingVehicle(), SetForceLaneChange(), SetGlobalDistanceToLeadingVehicle(), SetGlobalLaneOffset(), SetGlobalLargeVehicleWideTurn(), SetGlobalPercentageSpeedDifference(), SetHybridPhysicsMode(), SetHybridPhysicsRadius(), SetImportedRoute(), SetKeepSlowLanePercentage(), SetLaneOffset(), SetLargeVehicleWideTurn(), SetOSMMode(), SetPercentageIgnoreVehicles(), SetPercentageIgnoreWalkers(), SetPercentageRunningLight(), SetPercentageRunningSign(), SetPercentageSpeedDifference(), SetRandomDeviceSeed(), SetRandomLeftLaneChangePercentage(), SetRandomRightLaneChangePercentage(), SetSynchronousModeTimeOutInMiliSecond(), SetUpdateVehicleLights(), SynchronousTick(), TrafficManager(), UnregisterVehicles(), UpdateImportedRoute(), and UpdateUploadPath().
|
inline |
Definition at line 59 of file TrafficManager.h.
References _port.
|
default |
References TrafficManager().
|
default |
References Release(), RequestReset(), Reset(), Tick(), and TrafficManager().
|
inline |
Definition at line 55 of file TrafficManager.h.
References _port.
|
inline |
This method registers a vehicle with the traffic manager.
Definition at line 137 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::RegisterVehicles().
Referenced by carla::client::Vehicle::SetAutopilot().
|
static |
Definition at line 66 of file TrafficManager.cpp.
References _mutex, _tm_map, and carla::traffic_manager::AppendReleased().
Referenced by carla::client::detail::Episode::OnEpisodeStarted(), and operator=().
|
inline |
Method to remove a route.
Definition at line 105 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::RemoveImportedRoute().
|
inline |
Method to remove a path.
Definition at line 81 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::RemoveUploadPath().
|
static |
Non-blocking: reset all TMs once per episode on the reset thread, then call on_done.
Definition at line 194 of file TrafficManager.cpp.
Referenced by carla::client::detail::Episode::OnEpisodeChanged(), and operator=().
|
static |
Definition at line 83 of file TrafficManager.cpp.
References _mutex, _tm_map, and carla::traffic_manager::AppendReleased().
Referenced by operator=().
|
inline |
Enable/disable automatic lane change on a vehicle.
Definition at line 238 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetAutoLaneChange().
|
inline |
Method to set collision detection rules between vehicles.
Definition at line 221 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetCollisionDetection().
|
inline |
Method to set our own imported path.
Definition at line 73 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetCustomPath().
|
inline |
Set a vehicle's exact desired velocity.
Definition at line 171 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetDesiredSpeed().
|
inline |
Method to specify how much distance a vehicle should maintain to the leading vehicle.
Definition at line 247 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetDistanceToLeadingVehicle().
|
inline |
Method to force lane change on a vehicle.
Direction flag can be set to true for left and false for right.
Definition at line 230 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetForceLaneChange().
|
inline |
Method to Set Global distance to Leading vehicle.
Definition at line 314 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetGlobalDistanceToLeadingVehicle().
|
inline |
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.
Definition at line 189 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetGlobalLaneOffset().
|
inline |
Method to enable/disable the wide-turn manoeuvre globally for large vehicles.
Definition at line 205 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetGlobalLargeVehicleWideTurn().
|
inline |
Set a global % decrease in velocity with respect to the speed limit.
If less than 0, it's a % increase.
Definition at line 180 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetGlobalPercentageSpeedDifference().
|
inline |
This method sets the hybrid physics mode.
Definition at line 121 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetHybridPhysicsMode().
|
inline |
This method sets the hybrid physics radius.
Definition at line 129 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetHybridPhysicsRadius().
|
inline |
Method to set our own imported route.
Definition at line 97 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetImportedRoute().
|
inline |
Method to set % to keep on the slow lane.
Definition at line 322 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetKeepSlowLanePercentage().
|
inline |
Method to set a lane offset displacement from the center line.
Positive values imply a right offset while negative ones mean a left one.
Definition at line 163 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetLaneOffset().
|
inline |
Method to enable/disable the wide-turn manoeuvre for a single large vehicle.
Definition at line 197 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetLargeVehicleWideTurn().
|
inline |
Method to set Open Street Map mode.
Definition at line 65 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetOSMMode().
|
inline |
Method to specify the % chance of ignoring collisions with any vehicle.
Definition at line 263 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetPercentageIgnoreVehicles().
|
inline |
Method to specify the % chance of ignoring collisions with any walker.
Definition at line 255 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetPercentageIgnoreWalkers().
|
inline |
Method to specify the % chance of running a light.
Definition at line 279 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetPercentageRunningLight().
|
inline |
Method to specify the % chance of running a sign.
Definition at line 271 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetPercentageRunningSign().
|
inline |
Set a vehicle's % decrease in velocity with respect to the speed limit.
If less than 0, it's a % increase.
Definition at line 154 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetPercentageSpeedDifference().
|
inline |
Method to set randomization seed.
Definition at line 346 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetRandomDeviceSeed().
|
inline |
Method to set % to randomly do a left lane change.
Definition at line 330 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetRandomLeftLaneChangePercentage().
|
inline |
Method to set % to randomly do a right lane change.
Definition at line 338 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetRandomRightLaneChangePercentage().
|
inline |
Method to switch traffic manager into synchronous execution.
Definition at line 287 of file TrafficManager.h.
|
inline |
Method to set tick timeout for synchronous execution.
Definition at line 297 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetSynchronousModeTimeOutInMiliSecond().
|
inline |
Set the automatic management of the vehicle lights.
Definition at line 213 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SetUpdateVehicleLights().
| void carla::traffic_manager::TrafficManager::ShutDown | ( | ) |
Definition at line 105 of file TrafficManager.cpp.
References _mutex, _port, _tm_map, carla::traffic_manager::AppendReleased(), and carla::traffic_manager::TrafficManagerBase::ShutDown().
|
inline |
Method to provide synchronous tick.
Definition at line 305 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::SynchronousTick().
|
static |
Definition at line 94 of file TrafficManager.cpp.
References _mutex, _tm_map, and carla::traffic_manager::AppendReleased().
Referenced by operator=(), and carla::client::detail::SynchronizeFrame().
|
inline |
This method unregisters a vehicle from traffic manager.
Definition at line 145 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::UnregisterVehicles().
Referenced by carla::client::Vehicle::SetAutopilot().
|
inline |
Method to update an already set route.
Definition at line 113 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::UpdateImportedRoute().
|
inline |
Method to update an already set path.
Definition at line 89 of file TrafficManager.h.
References _port, GetTM(), and carla::traffic_manager::TrafficManagerBase::UpdateUploadPath().
|
staticprivate |
Definition at line 398 of file TrafficManager.h.
Referenced by GetTM(), Release(), Reset(), SetSynchronousMode(), ShutDown(), and Tick().
|
private |
Definition at line 400 of file TrafficManager.h.
Referenced by GetActionBuffer(), GetNextAction(), IsValidPort(), Port(), RegisterVehicles(), RemoveImportedRoute(), RemoveUploadPath(), SetAutoLaneChange(), SetCollisionDetection(), SetCustomPath(), SetDesiredSpeed(), SetDistanceToLeadingVehicle(), SetForceLaneChange(), SetGlobalDistanceToLeadingVehicle(), SetGlobalLaneOffset(), SetGlobalLargeVehicleWideTurn(), SetGlobalPercentageSpeedDifference(), SetHybridPhysicsMode(), SetHybridPhysicsRadius(), SetImportedRoute(), SetKeepSlowLanePercentage(), SetLaneOffset(), SetLargeVehicleWideTurn(), SetOSMMode(), SetPercentageIgnoreVehicles(), SetPercentageIgnoreWalkers(), SetPercentageRunningLight(), SetPercentageRunningSign(), SetPercentageSpeedDifference(), SetRandomDeviceSeed(), SetRandomLeftLaneChangePercentage(), SetRandomRightLaneChangePercentage(), SetSynchronousMode(), SetSynchronousModeTimeOutInMiliSecond(), SetUpdateVehicleLights(), ShutDown(), SynchronousTick(), TrafficManager(), TrafficManager(), UnregisterVehicles(), UpdateImportedRoute(), and UpdateUploadPath().
|
staticprivate |
Definition at line 397 of file TrafficManager.h.
Referenced by CreateTrafficManagerClient(), CreateTrafficManagerServer(), GetTM(), Release(), Reset(), SetSynchronousMode(), ShutDown(), and Tick().