12 #include <unordered_map> 23 namespace traffic_manager {
29 using Path = std::vector<cg::Location>;
30 using Route = std::vector<uint8_t>;
43 float global_percentage_difference_from_limit = 0;
69 std::atomic<bool> synchronous_mode{
false};
71 std::atomic<float> distance_margin{2.0};
73 std::atomic<bool> hybrid_physics_mode{
false};
75 std::atomic<bool> respawn_dormant_vehicles{
false};
77 std::atomic<float> respawn_lower_bound{100.0};
79 std::atomic<float> respawn_upper_bound{1000.0};
85 std::atomic<float> hybrid_physics_radius {70.0};
87 std::atomic<bool> osm_mode {
true};
105 void SetPercentageSpeedDifference(
const ActorPtr &actor,
const float percentage);
109 void SetGlobalPercentageSpeedDifference(
float const percentage);
112 void SetCollisionDetection(
115 const bool detect_collision);
122 void SetAutoLaneChange(
const ActorPtr &actor,
const bool enable);
126 void SetDistanceToLeadingVehicle(
const ActorPtr &actor,
const float distance);
129 void SetPercentageRunningSign(
const ActorPtr &actor,
const float perc);
132 void SetPercentageRunningLight(
const ActorPtr &actor,
const float perc);
135 void SetPercentageIgnoreVehicles(
const ActorPtr &actor,
const float perc);
138 void SetPercentageIgnoreWalkers(
const ActorPtr &actor,
const float perc);
141 void SetKeepRightPercentage(
const ActorPtr &actor,
const float percentage);
144 void SetRandomLeftLaneChangePercentage(
const ActorPtr &actor,
const float percentage);
147 void SetRandomRightLaneChangePercentage(
const ActorPtr &actor,
const float percentage);
150 void SetUpdateVehicleLights(
const ActorPtr &actor,
const bool do_update);
153 void SetGlobalDistanceToLeadingVehicle(
const float dist);
156 void SetSynchronousModeTimeOutInMiliSecond(
const double time);
159 void SetHybridPhysicsMode(
const bool mode_switch);
162 void SetSynchronousMode(
const bool mode_switch =
true);
165 void SetHybridPhysicsRadius(
const float radius);
168 void SetOSMMode(
const bool mode_switch);
171 void SetRespawnDormantVehicles(
const bool mode_switch);
174 void SetBoundariesRespawnDormantVehicles(
const float lower_bound,
const float upper_bound);
177 void SetMaxBoundaries(
const float lower,
const float upper);
180 void SetCustomPath(
const ActorPtr &actor,
const Path path,
const bool empty_buffer);
183 void RemoveUploadPath(
const ActorId &actor_id,
const bool remove_path);
186 void UpdateUploadPath(
const ActorId &actor_id,
const Path path);
189 void SetImportedRoute(
const ActorPtr &actor,
const Route route,
const bool empty_buffer);
192 void RemoveImportedRoute(
const ActorId &actor_id,
const bool remove_path);
195 void UpdateImportedRoute(
const ActorId &actor_id,
const Route route);
200 float GetHybridPhysicsRadius()
const;
203 float GetVehicleTargetVelocity(
const ActorId &actor_id,
const float speed_limit)
const;
206 bool GetCollisionDetection(
const ActorId &reference_actor_id,
const ActorId &other_actor_id)
const;
212 float GetKeepRightPercentage(
const ActorId &actor_id);
215 float GetRandomLeftLaneChangePercentage(
const ActorId &actor_id);
218 float GetRandomRightLaneChangePercentage(
const ActorId &actor_id);
221 bool GetAutoLaneChange(
const ActorId &actor_id)
const;
224 float GetDistanceToLeadingVehicle(
const ActorId &actor_id)
const;
227 float GetPercentageRunningSign(
const ActorId &actor_id)
const;
230 float GetPercentageRunningLight(
const ActorId &actor_id)
const;
233 float GetPercentageIgnoreVehicles(
const ActorId &actor_id)
const;
236 float GetPercentageIgnoreWalkers(
const ActorId &actor_id)
const;
239 bool GetUpdateVehicleLights(
const ActorId &actor_id)
const;
242 bool GetSynchronousMode()
const;
245 double GetSynchronousModeTimeOutInMiliSecond()
const;
248 bool GetHybridPhysicsMode()
const;
251 bool GetRespawnDormantVehicles()
const;
254 float GetLowerBoundaryRespawnDormantVehicles()
const;
257 float GetUpperBoundaryRespawnDormantVehicles()
const;
260 bool GetOSMMode()
const;
263 bool GetUploadPath(
const ActorId &actor_id)
const;
269 bool GetUploadRoute(
const ActorId &actor_id)
const;
AtomicMap< ActorId, float > perc_run_traffic_sign
Map containing % of running a traffic sign.
AtomicMap< ActorId, bool > upload_route
Parameter specifying if importing a custom route.
float min_lower_bound
Minimum possible distance to respawn vehicles with respect to the hero vehicle.
carla::SharedPtr< cc::Actor > ActorPtr
AtomicMap< ActorId, float > perc_random_left
Map containing % of random left lane change.
std::vector< cg::Location > Path
AtomicMap< ActorId, bool > auto_lane_change
Map containing auto lane change commands.
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. ...
std::chrono::duration< double, std::milli > synchronous_time_out
Synchronous mode time out variable.
AtomicMap< ActorId, float > perc_run_traffic_light
Map containing % of running a traffic light.
AtomicMap< ActorId, ChangeLaneInfo > force_lane_change
Map containing force lane change commands.
float max_upper_bound
Maximum possible distance to respawn vehicles with respect to the hero vehicle.
AtomicMap< ActorId, float > perc_keep_right
Map containing % of keep right rule.
AtomicMap< ActorId, Route > custom_route
Structure to hold all custom routes.
AtomicMap< ActorId, float > percentage_difference_from_speed_limit
Target velocity map for individual vehicles.
AtomicMap< ActorId, bool > auto_update_vehicle_lights
Map containing the automatic vehicle lights update flag.
AtomicMap< ActorId, bool > upload_path
Parameter specifying if importing a custom path.
AtomicMap< ActorId, Path > custom_path
Structure to hold all custom paths.
AtomicMap< ActorId, float > distance_to_leading_vehicle
Map containing distance to leading vehicle command.
std::vector< uint8_t > Route
AtomicMap< ActorId, float > perc_random_right
Map containing % of random right lane change.
AtomicMap< ActorId, float > perc_ignore_walkers
Map containing % of ignoring walkers.
AtomicMap< ActorId, std::shared_ptr< AtomicActorSet > > ignore_collision
Map containing a set of actors to be ignored during collision detection.
AtomicMap< ActorId, float > perc_ignore_vehicles
Map containing % of ignoring vehicles.