30 float new_percentage = std::min(100.0f, percentage);
38 const auto entry = std::make_pair(actor->GetId(), offset);
44 float new_value = std::max(0.0f, value);
52 float new_percentage = std::min(100.0f, percentage);
61 const auto entry = std::make_pair(actor->GetId(), enable);
70 const ActorId reference_id = reference_actor->GetId();
71 const ActorId other_id = other_actor->GetId();
73 if (detect_collision) {
75 std::shared_ptr<AtomicActorSet> actor_set =
ignore_collision.GetValue(reference_id);
76 if (actor_set->Contains(other_id)) {
77 actor_set->Remove({other_id});
82 std::shared_ptr<AtomicActorSet> actor_set =
ignore_collision.GetValue(reference_id);
83 if (!actor_set->Contains(other_id)) {
84 actor_set->Insert({other_actor});
87 std::shared_ptr<AtomicActorSet> actor_set = std::make_shared<AtomicActorSet>();
88 actor_set->Insert({other_actor});
89 auto entry = std::make_pair(reference_id, actor_set);
98 const auto entry = std::make_pair(actor->GetId(), lane_change_info);
104 const auto entry = std::make_pair(actor->GetId(), percentage);
111 const auto entry = std::make_pair(actor->GetId(), percentage);
117 const auto entry = std::make_pair(actor->GetId(), percentage);
124 const auto entry = std::make_pair(actor->GetId(), do_update);
130 const auto entry = std::make_pair(actor->GetId(), enable);
136 float new_distance = std::max(0.0f, distance);
137 const auto entry = std::make_pair(actor->GetId(), new_distance);
157 const auto entry = std::make_pair(actor->GetId(), new_perc);
164 const auto entry = std::make_pair(actor->GetId(), new_perc);
171 const auto entry = std::make_pair(actor->GetId(), new_perc);
178 const auto entry = std::make_pair(actor->GetId(), new_perc);
183 float new_radius = std::max(radius, 0.0f);
192 const auto entry = std::make_pair(actor->GetId(), path);
194 const auto entry2 = std::make_pair(actor->GetId(), empty_buffer);
208 const auto entry = std::make_pair(actor_id, path);
213 const auto entry = std::make_pair(actor->GetId(), route);
215 const auto entry2 = std::make_pair(actor->GetId(), empty_buffer);
229 const auto entry = std::make_pair(actor_id, route);
258 return speed_limit * (1.0f - percentage_difference / 100.0f);
283 bool avoid_collision =
true;
287 avoid_collision =
false;
290 return avoid_collision;
303 return change_lane_info;
308 float percentage = -1.0f;
319 float percentage = -1.0f;
330 float percentage = -1.0f;
341 bool auto_lane_change_policy =
true;
347 return auto_lane_change_policy;
352 float specific_distance_margin = 0.0f;
359 return specific_distance_margin;
364 float percentage = 0.0f;
375 float percentage = 0.0f;
386 float percentage = 0.0f;
396 bool do_update =
false;
407 float percentage = 0.0f;
429 bool custom_path_bool =
false;
435 return custom_path_bool;
440 Path custom_path_import;
446 return custom_path_import;
452 bool custom_route_bool =
false;
458 return custom_route_bool;
463 Route custom_route_import;
469 return custom_route_import;
static constexpr T Clamp(T a, T min=T(0), T max=T(1))
void RemoveEntry(const Key &key)
const Value & GetValue(const Key &key) const
bool Contains(const Key &key) const
void AddEntry(const std::pair< Key, Value > &entry)
float GetRandomLeftLaneChangePercentage(const ActorId &actor_id)
Method to query percentage probability of a random right lane change for a vehicle.
void SetGlobalLargeVehicleWideTurn(const bool enable)
Method to enable/disable the wide-turn manoeuvre globally for all large vehicles.
float GetPercentageIgnoreWalkers(const ActorId &actor_id) const
Method to get % to ignore any walker.
AtomicMap< ActorId, ChangeLaneInfo > force_lane_change
Map containing force lane change commands.
ChangeLaneInfo GetForceLaneChange(const ActorId &actor_id)
Method to query lane change command for a vehicle.
AtomicMap< ActorId, bool > auto_lane_change
Map containing auto lane change commands.
bool GetLargeVehicleWideTurn(const ActorId &actor_id) const
Method to query whether the wide-turn manoeuvre is enabled for a large vehicle (per-vehicle override,...
float GetLaneOffset(const ActorId &actor_id) const
Method to query lane offset for a vehicle.
AtomicMap< ActorId, bool > upload_path
Parameter specifying if importing a custom path.
void SetLaneOffset(const ActorPtr &actor, const float offset)
Method to set a lane offset displacement from the center line.
float GetDistanceToLeadingVehicle(const ActorId &actor_id) const
Method to query distance to leading vehicle for a given vehicle.
void SetKeepSlowLanePercentage(const ActorPtr &actor, const float percentage)
Method to set % to keep on the slow lane.
void SetImportedRoute(const ActorPtr &actor, const Route route, const bool empty_buffer)
Method to set our own imported route.
bool GetCollisionDetection(const ActorId &reference_actor_id, const ActorId &other_actor_id) const
Method to query collision avoidance rule between a pair of vehicles.
void SetHybridPhysicsRadius(const float radius)
Method to set hybrid physics radius.
Route GetImportedRoute(const ActorId &actor_id) const
Method to get a custom route.
float global_lane_offset
Global lane offset.
float global_percentage_difference_from_limit
Global target velocity limit % difference.
std::atomic< bool > synchronous_mode
Synchronous mode switch.
float GetKeepSlowLanePercentage(const ActorId &actor_id)
Method to query percentage probability of keep slow lane rule for a vehicle.
double GetSynchronousModeTimeOutInMiliSecond() const
Get synchronous mode time out.
std::atomic< float > distance_margin
Distance margin.
std::chrono::duration< double, std::milli > synchronous_time_out
Synchronous mode time out variable.
std::atomic< float > hybrid_physics_radius
Hybrid physics radius.
bool GetUploadRoute(const ActorId &actor_id) const
Method to get if we are uploading a route.
AtomicMap< ActorId, bool > large_vehicle_wide_turn
Per-vehicle enable flag for the large-vehicle wide-turn manoeuvre.
void UpdateUploadPath(const ActorId &actor_id, const Path path)
Method to update an already set list of points.
bool GetOSMMode() const
Method to get Open Street Map mode.
void SetRandomLeftLaneChangePercentage(const ActorPtr &actor, const float percentage)
Method to set % to randomly do a left lane change.
void SetGlobalDistanceToLeadingVehicle(const float dist)
Method to set the distance to leading vehicle for all registered vehicles.
AtomicMap< ActorId, float > perc_random_left
Map containing % of random left lane change.
AtomicMap< ActorId, float > perc_ignore_walkers
Map containing % of ignoring walkers.
float GetHybridPhysicsRadius() const
Method to retrieve hybrid physics radius.
void UpdateImportedRoute(const ActorId &actor_id, const Route route)
Method to update an already set route.
float GetVehicleTargetVelocity(const ActorId &actor_id, const float speed_limit) const
Method to query target velocity for a vehicle.
void SetGlobalLaneOffset(float const offset)
Method to set a global lane offset displacement from the center line.
AtomicMap< ActorId, float > exact_desired_speed
Target velocity map for individual vehicles, based on a desired velocity.
AtomicMap< ActorId, bool > upload_route
Parameter specifying if importing a custom route.
bool GetUploadPath(const ActorId &actor_id) const
Method to get if we are uploading a path.
void SetDistanceToLeadingVehicle(const ActorPtr &actor, const float distance)
Method to specify how much distance a vehicle should maintain to the leading vehicle.
float GetRandomRightLaneChangePercentage(const ActorId &actor_id)
Method to query percentage probability of a random left lane change for a vehicle.
void SetForceLaneChange(const ActorPtr &actor, const bool direction)
Method to force lane change on a vehicle.
AtomicMap< ActorId, float > perc_run_traffic_light
Map containing % of running a traffic light.
void SetPercentageRunningSign(const ActorPtr &actor, const float perc)
Method to set % to run any traffic sign.
void SetCustomPath(const ActorPtr &actor, const Path path, const bool empty_buffer)
Method to set our own imported path.
std::atomic< bool > hybrid_physics_mode
Hybrid physics mode switch.
void RemoveImportedRoute(const ActorId &actor_id, const bool remove_path)
Method to remove a route.
bool GetAutoLaneChange(const ActorId &actor_id) const
Method to query auto lane change rule for a vehicle.
void SetPercentageIgnoreVehicles(const ActorPtr &actor, const float perc)
Method to set % to ignore any vehicle.
void SetSynchronousModeTimeOutInMiliSecond(const double time)
Set Synchronous mode time out.
void SetHybridPhysicsMode(const bool mode_switch)
Method to set hybrid physics mode.
AtomicMap< ActorId, float > perc_random_right
Map containing % of random right lane change.
float GetPercentageRunningSign(const ActorId &actor_id) const
Method to get % to run any traffic light.
void SetCollisionDetection(const ActorPtr &reference_actor, const ActorPtr &other_actor, const bool detect_collision)
Method to set collision detection rules between vehicles.
AtomicMap< ActorId, std::shared_ptr< AtomicActorSet > > ignore_collision
Map containing a set of actors to be ignored during collision detection.
AtomicMap< ActorId, float > perc_keep_slow_lane
Map containing % of keep slow lane rule.
void SetPercentageRunningLight(const ActorPtr &actor, const float perc)
Method to set % to run any traffic light.
AtomicMap< ActorId, float > perc_run_traffic_sign
Map containing % of running a traffic sign.
std::atomic< bool > osm_mode
Parameter specifying Open Street Map mode.
Path GetCustomPath(const ActorId &actor_id) const
Method to get a custom path.
void SetAutoLaneChange(const ActorPtr &actor, const bool enable)
Enable/disable automatic lane change on a vehicle.
AtomicMap< ActorId, float > distance_to_leading_vehicle
Map containing distance to leading vehicle command.
float GetPercentageIgnoreVehicles(const ActorId &actor_id) const
Method to get % to ignore any vehicle.
void SetDesiredSpeed(const ActorPtr &actor, const float value)
Set a vehicle's exact desired velocity.
void RemoveUploadPath(const ActorId &actor_id, const bool remove_path)
Method to remove a list of points.
bool GetSynchronousMode() const
Method to get synchronous mode.
void SetGlobalPercentageSpeedDifference(float const percentage)
Set a global % decrease in velocity with respect to the speed limit.
AtomicMap< ActorId, float > lane_offset
Lane offset map for individual vehicles.
void SetPercentageIgnoreWalkers(const ActorPtr &actor, const float perc)
Method to set % to ignore any vehicle.
float GetPercentageRunningLight(const ActorId &actor_id) const
Method to get % to run any traffic light.
bool global_large_vehicle_wide_turn
Global enable flag for the large-vehicle wide-turn manoeuvre.
bool GetUpdateVehicleLights(const ActorId &actor_id) const
Method to get if the vehicle lights should be updates automatically.
void SetRandomRightLaneChangePercentage(const ActorPtr &actor, const float percentage)
Method to set % to randomly do a right lane change.
void SetPercentageSpeedDifference(const ActorPtr &actor, const float percentage)
Set a vehicle's % decrease in velocity with respect to the speed limit.
AtomicMap< ActorId, bool > auto_update_vehicle_lights
Map containing the automatic vehicle lights update flag.
AtomicMap< ActorId, Route > custom_route
Structure to hold all custom routes.
AtomicMap< ActorId, float > perc_ignore_vehicles
Map containing % of ignoring vehicles.
AtomicMap< ActorId, float > percentage_difference_from_speed_limit
Target velocity map for individual vehicles, based on a % diffrerence from speed limit.
void SetOSMMode(const bool mode_switch)
Method to set Open Street Map mode.
AtomicMap< ActorId, Path > custom_path
Structure to hold all custom paths.
bool GetHybridPhysicsMode() const
Method to retrieve hybrid physics mode.
void SetLargeVehicleWideTurn(const ActorPtr &actor, const bool enable)
Method to enable/disable the wide-turn manoeuvre for a single large vehicle (bus/truck).
void SetSynchronousMode(const bool mode_switch=true)
Method to set synchronous mode.
void SetUpdateVehicleLights(const ActorPtr &actor, const bool do_update)
Method to set the automatic vehicle light state update flag.
carla::SharedPtr< cc::Actor > ActorPtr
std::vector< uint8_t > Route
std::vector< cg::Location > Path
This file contains definitions of common data structures used in traffic manager.