18 namespace traffic_manager {
57 return (
_port > 1023);
63 if (tm_ptr !=
nullptr) {
71 if (tm_ptr !=
nullptr) {
79 if (tm_ptr !=
nullptr) {
87 if (tm_ptr !=
nullptr) {
95 if (tm_ptr !=
nullptr) {
103 if (tm_ptr !=
nullptr) {
111 if (tm_ptr !=
nullptr) {
119 if (tm_ptr !=
nullptr) {
126 if (tm_ptr !=
nullptr) {
134 if (tm_ptr !=
nullptr) {
142 if(tm_ptr !=
nullptr){
150 if(tm_ptr !=
nullptr){
158 if(tm_ptr !=
nullptr){
166 if(tm_ptr !=
nullptr){
175 if(tm_ptr !=
nullptr){
184 if(tm_ptr !=
nullptr){
192 if(tm_ptr !=
nullptr){
201 if(tm_ptr !=
nullptr){
210 if(tm_ptr !=
nullptr){
218 if(tm_ptr !=
nullptr){
226 if(tm_ptr !=
nullptr){
235 if(tm_ptr !=
nullptr){
243 if(tm_ptr !=
nullptr){
252 if(tm_ptr !=
nullptr){
260 if(tm_ptr !=
nullptr){
268 if(tm_ptr !=
nullptr){
276 if(tm_ptr !=
nullptr){
284 if(tm_ptr !=
nullptr){
292 if(tm_ptr !=
nullptr){
300 if(tm_ptr !=
nullptr){
308 if(tm_ptr !=
nullptr){
317 if(tm_ptr !=
nullptr){
325 if(tm_ptr !=
nullptr){
333 if(tm_ptr !=
nullptr){
341 if(tm_ptr !=
nullptr){
349 if(tm_ptr !=
nullptr){
360 if (tm_ptr !=
nullptr) {
371 if (tm_ptr !=
nullptr) {
373 return action_buffer;
375 return action_buffer;
390 std::lock_guard<std::mutex> lock(
_mutex);
398 static std::map<uint16_t, TrafficManagerBase*>
_tm_map;
virtual void SetHybridPhysicsMode(const bool mode_switch)=0
Method to set hybrid physics mode.
void SetSynchronousModeTimeOutInMiliSecond(double time)
Method to set tick timeout for synchronous execution.
virtual void SetAutoLaneChange(const ActorPtr &actor, const bool enable)=0
Enable/disable automatic lane change on a vehicle.
void SetPercentageIgnoreVehicles(const ActorPtr &actor, const float perc)
Method to specify the % chance of ignoring collisions with any vehicle.
virtual void SetForceLaneChange(const ActorPtr &actor, const bool direction)=0
Method to force 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.
virtual bool SynchronousTick()=0
Method to provide synchronous tick.
static const unsigned short TM_DEFAULT_PORT
void SetDistanceToLeadingVehicle(const ActorPtr &actor, const float distance)
Method to specify how much distance a vehicle should maintain to the leading vehicle.
carla::SharedPtr< cc::Actor > ActorPtr
virtual void SetGlobalDistanceToLeadingVehicle(const float dist)=0
Method to set Global Distance to Leading Vehicle.
virtual void SetPercentageIgnoreWalkers(const ActorPtr &actor, const float perc)=0
Method to specify the % chance of ignoring collisions with any walker.
std::vector< cg::Location > Path
bool CreateTrafficManagerClient(carla::client::detail::EpisodeProxy episode_proxy, uint16_t port)
virtual void SetMaxBoundaries(const float lower, const float upper)=0
Method to set limits for boundaries when respawning vehicles.
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
This file contains definitions of common data structures used in traffic manager. ...
static std::map< uint16_t, TrafficManagerBase * > _tm_map
virtual void SetPercentageSpeedDifference(const ActorPtr &actor, const float percentage)=0
Set a vehicle's % decrease in velocity with respect to the speed limit.
void SetPercentageRunningLight(const ActorPtr &actor, const float perc)
Method to specify the % chance of running a light.
void RegisterVehicles(const std::vector< ActorPtr > &actor_list)
This method registers a vehicle with the traffic manager.
virtual void UnregisterVehicles(const std::vector< ActorPtr > &actor_list)=0
This method unregisters a vehicle from traffic manager.
void SetGlobalDistanceToLeadingVehicle(const float distance)
Method to Set Global distance to Leading vehicle.
void SetPercentageSpeedDifference(const ActorPtr &actor, const float percentage)
Set a vehicle's % decrease in velocity with respect to the speed limit.
TrafficManager & operator=(const TrafficManager &)=default
void SetRandomLeftLaneChangePercentage(const ActorPtr &actor, const float percentage)
Method to set % to randomly do a left lane change.
void SetRandomDeviceSeed(const uint64_t seed)
Method to set randomization seed.
virtual Action GetNextAction(const ActorId &actor_id)=0
Method to get the vehicle's next action.
void SetAutoLaneChange(const ActorPtr &actor, const bool enable)
Enable/disable automatic lane change on a vehicle.
virtual void SetRandomLeftLaneChangePercentage(const ActorPtr &actor, const float percentage)=0
Method to set % to randomly do a left lane change.
virtual void RemoveImportedRoute(const ActorId &actor_id, const bool remove_path)=0
Method to remove a route.
virtual void SetImportedRoute(const ActorPtr &actor, const Route route, const bool empty_buffer)=0
Method to set our own imported route.
void UpdateUploadPath(const ActorId &actor_id, const Path path)
Method to update an already set path.
std::pair< RoadOption, WaypointPtr > Action
void SetKeepRightPercentage(const ActorPtr &actor, const float percentage)
Method to set % to keep on the right lane.
void SetPercentageIgnoreWalkers(const ActorPtr &actor, const float perc)
Method to specify the % chance of ignoring collisions with any walker.
virtual void SetOSMMode(const bool mode_switch)=0
Method to set Open Street Map mode.
void UnregisterVehicles(const std::vector< ActorPtr > &actor_list)
This method unregisters a vehicle from traffic manager.
ActionBuffer GetActionBuffer(const ActorId &actor_id)
Method to get the action buffer.
virtual void RemoveUploadPath(const ActorId &actor_id, const bool remove_path)=0
Method to remove a path.
virtual void SetGlobalPercentageSpeedDifference(float const percentage)=0
Set a global % decrease in velocity with respect to the speed limit.
void SetRandomRightLaneChangePercentage(const ActorPtr &actor, const float percentage)
Method to set % to randomly do a right lane change.
virtual void SetKeepRightPercentage(const ActorPtr &actor, const float percentage)=0
Method to set % to keep on the right lane.
This class integrates all the various stages of the traffic manager appropriately using messengers...
bool SynchronousTick()
Method to provide synchronous tick.
void SetHybridPhysicsMode(const bool mode_switch)
This method sets the hybrid physics mode.
void SetDesiredSpeed(const ActorPtr &actor, const float value)
Set a vehicle's exact desired velocity.
void SetImportedRoute(const ActorPtr &actor, const Route route, const bool empty_buffer)
Method to set our own imported route.
void SetRespawnDormantVehicles(const bool mode_switch)
Method to set if we are automatically respawning vehicles.
The function of this class is to integrate all the various stages of the traffic manager appropriatel...
virtual void SetDistanceToLeadingVehicle(const ActorPtr &actor, const float distance)=0
Method to specify how much distance a vehicle should maintain to the leading vehicle.
virtual void SetUpdateVehicleLights(const ActorPtr &actor, const bool do_update)=0
Method to set the automatic management of the vehicle lights.
virtual void SetPercentageIgnoreVehicles(const ActorPtr &actor, const float perc)=0
Method to specify the % chance of ignoring collisions with any vehicle.
void SetSynchronousMode(bool mode)
Method to switch traffic manager into synchronous execution.
virtual void SetCustomPath(const ActorPtr &actor, const Path path, const bool empty_buffer)=0
Method to set our own imported path.
virtual void SetGlobalLaneOffset(float const offset)=0
Method to set a global lane offset displacement from the center line.
std::vector< uint8_t > Route
void UpdateImportedRoute(const ActorId &actor_id, const Route route)
Method to update an already set route.
void SetGlobalPercentageSpeedDifference(float const percentage)
Set a global % decrease in velocity with respect to the speed limit.
void SetMaxBoundaries(const float lower, const float upper)
Method to set boundaries for respawning vehicles.
void SetPercentageRunningSign(const ActorPtr &actor, const float perc)
Method to specify the % chance of running a sign.
void SetForceLaneChange(const ActorPtr &actor, const bool direction)
Method to force lane change on a vehicle.
TrafficManager(const TrafficManager &other)
virtual void SetRespawnDormantVehicles(const bool mode_switch)=0
Method to set automatic respawn of dormant vehicles.
TrafficManagerBase * GetTM(uint16_t port) const
void SetCustomPath(const ActorPtr &actor, const Path path, const bool empty_buffer)
Method to set our own imported path.
virtual void UpdateUploadPath(const ActorId &actor_id, const Path path)=0
Method to update an already set path.
virtual void SetCollisionDetection(const ActorPtr &reference_actor, const ActorPtr &other_actor, const bool detect_collision)=0
Method to set collision detection rules between vehicles.
void SetUpdateVehicleLights(const ActorPtr &actor, const bool do_update)
Set the automatic management of the vehicle lights.
void SetBoundariesRespawnDormantVehicles(const float lower_bound, const float upper_bound)
Method to set boundaries for respawning vehicles.
virtual void SetPercentageRunningLight(const ActorPtr &actor, const float perc)=0
Method to specify the % chance of running any traffic light.
void SetGlobalLaneOffset(float const offset)
Method to set a global lane offset displacement from the center line.
void RemoveUploadPath(const ActorId &actor_id, const bool remove_path)
Method to remove a path.
Action GetNextAction(const ActorId &actor_id)
Method to get the next action.
void SetLaneOffset(const ActorPtr &actor, const float offset)
Method to set a lane offset displacement from the center line.
virtual void UpdateImportedRoute(const ActorId &actor_id, const Route route)=0
Method to update an already set route.
void RemoveImportedRoute(const ActorId &actor_id, const bool remove_path)
Method to remove a route.
virtual void SetHybridPhysicsRadius(const float radius)=0
Method to set hybrid physics radius.
virtual void SetLaneOffset(const ActorPtr &actor, const float offset)=0
Method to set a lane offset displacement from the center line.
virtual void SetRandomDeviceSeed(const uint64_t seed)=0
Method to set randomization seed.
virtual void SetDesiredSpeed(const ActorPtr &actor, const float value)=0
Set a vehicle's exact desired velocity.
std::vector< Action > ActionBuffer
virtual void SetSynchronousModeTimeOutInMiliSecond(double time)=0
Method to set Tick timeout for synchronous execution.
virtual void SetBoundariesRespawnDormantVehicles(const float lower_bound, const float upper_bound)=0
Method to set boundaries for respawning vehicles.
void CreateTrafficManagerServer(carla::client::detail::EpisodeProxy episode_proxy, uint16_t port)
virtual void SetPercentageRunningSign(const ActorPtr &actor, const float perc)=0
Method to specify the % chance of running any traffic sign.
void SetOSMMode(const bool mode_switch)
Method to set Open Street Map mode.
virtual ActionBuffer GetActionBuffer(const ActorId &actor_id)=0
Method to get the vehicle's action buffer.
virtual void SetSynchronousMode(bool mode)=0
Method to switch traffic manager into synchronous execution.
virtual void RegisterVehicles(const std::vector< ActorPtr > &actor_list)=0
This method registers a vehicle with the traffic manager.
virtual void SetRandomRightLaneChangePercentage(const ActorPtr &actor, const float percentage)=0
Method to set % to randomly do a right lane change.
void SetHybridPhysicsRadius(const float radius)
This method sets the hybrid physics radius.