12 #include <unordered_map> 23 namespace traffic_manager {
29 using Path = std::vector<cg::Location>;
30 using Route = std::vector<uint8_t>;
47 float global_percentage_difference_from_limit = 0;
49 float global_lane_offset = 0;
75 std::atomic<bool> synchronous_mode{
false};
77 std::atomic<float> distance_margin{2.0};
79 std::atomic<bool> hybrid_physics_mode{
false};
81 std::atomic<bool> respawn_dormant_vehicles{
false};
83 std::atomic<float> respawn_lower_bound{100.0};
85 std::atomic<float> respawn_upper_bound{1000.0};
91 std::atomic<float> hybrid_physics_radius {70.0};
93 std::atomic<bool> osm_mode {
true};
111 void SetPercentageSpeedDifference(
const ActorPtr &actor,
const float percentage);
115 void SetLaneOffset(
const ActorPtr &actor,
const float offset);
118 void SetDesiredSpeed(
const ActorPtr &actor,
const float value);
122 void SetGlobalPercentageSpeedDifference(
float const percentage);
126 void SetGlobalLaneOffset(
float const offset);
129 void SetCollisionDetection(
132 const bool detect_collision);
139 void SetAutoLaneChange(
const ActorPtr &actor,
const bool enable);
143 void SetDistanceToLeadingVehicle(
const ActorPtr &actor,
const float distance);
146 void SetPercentageRunningSign(
const ActorPtr &actor,
const float perc);
149 void SetPercentageRunningLight(
const ActorPtr &actor,
const float perc);
152 void SetPercentageIgnoreVehicles(
const ActorPtr &actor,
const float perc);
155 void SetPercentageIgnoreWalkers(
const ActorPtr &actor,
const float perc);
158 void SetKeepRightPercentage(
const ActorPtr &actor,
const float percentage);
161 void SetRandomLeftLaneChangePercentage(
const ActorPtr &actor,
const float percentage);
164 void SetRandomRightLaneChangePercentage(
const ActorPtr &actor,
const float percentage);
167 void SetUpdateVehicleLights(
const ActorPtr &actor,
const bool do_update);
170 void SetGlobalDistanceToLeadingVehicle(
const float dist);
173 void SetSynchronousModeTimeOutInMiliSecond(
const double time);
176 void SetHybridPhysicsMode(
const bool mode_switch);
179 void SetSynchronousMode(
const bool mode_switch =
true);
182 void SetHybridPhysicsRadius(
const float radius);
185 void SetOSMMode(
const bool mode_switch);
188 void SetRespawnDormantVehicles(
const bool mode_switch);
191 void SetBoundariesRespawnDormantVehicles(
const float lower_bound,
const float upper_bound);
194 void SetMaxBoundaries(
const float lower,
const float upper);
197 void SetCustomPath(
const ActorPtr &actor,
const Path path,
const bool empty_buffer);
200 void RemoveUploadPath(
const ActorId &actor_id,
const bool remove_path);
203 void UpdateUploadPath(
const ActorId &actor_id,
const Path path);
206 void SetImportedRoute(
const ActorPtr &actor,
const Route route,
const bool empty_buffer);
209 void RemoveImportedRoute(
const ActorId &actor_id,
const bool remove_path);
212 void UpdateImportedRoute(
const ActorId &actor_id,
const Route route);
217 float GetHybridPhysicsRadius()
const;
220 float GetVehicleTargetVelocity(
const ActorId &actor_id,
const float speed_limit)
const;
223 float GetLaneOffset(
const ActorId &actor_id)
const;
226 bool GetCollisionDetection(
const ActorId &reference_actor_id,
const ActorId &other_actor_id)
const;
232 float GetKeepRightPercentage(
const ActorId &actor_id);
235 float GetRandomLeftLaneChangePercentage(
const ActorId &actor_id);
238 float GetRandomRightLaneChangePercentage(
const ActorId &actor_id);
241 bool GetAutoLaneChange(
const ActorId &actor_id)
const;
244 float GetDistanceToLeadingVehicle(
const ActorId &actor_id)
const;
247 float GetPercentageRunningSign(
const ActorId &actor_id)
const;
250 float GetPercentageRunningLight(
const ActorId &actor_id)
const;
253 float GetPercentageIgnoreVehicles(
const ActorId &actor_id)
const;
256 float GetPercentageIgnoreWalkers(
const ActorId &actor_id)
const;
259 bool GetUpdateVehicleLights(
const ActorId &actor_id)
const;
262 bool GetSynchronousMode()
const;
265 double GetSynchronousModeTimeOutInMiliSecond()
const;
268 bool GetHybridPhysicsMode()
const;
271 bool GetRespawnDormantVehicles()
const;
274 float GetLowerBoundaryRespawnDormantVehicles()
const;
277 float GetUpperBoundaryRespawnDormantVehicles()
const;
280 bool GetOSMMode()
const;
283 bool GetUploadPath(
const ActorId &actor_id)
const;
289 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.
AtomicMap< ActorId, float > exact_desired_speed
Target velocity map for individual vehicles, based on a desired velocity.
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, based on a % diffrerence from speed limit.
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.
AtomicMap< ActorId, float > lane_offset
Lane offset map for individual vehicles.