CARLA
CollisionStage.cpp
Go to the documentation of this file.
1 
2 #include "carla/geom/Math.h"
3 
6 
8 
9 namespace carla {
10 namespace traffic_manager {
11 
12 using Point2D = bg::model::point<double, 2, bg::cs::cartesian>;
14 
15 using namespace constants::Collision;
17 
19  const std::vector<ActorId> &vehicle_id_list,
20  const SimulationState &simulation_state,
21  const BufferMap &buffer_map,
22  const TrackTraffic &track_traffic,
23  const Parameters &parameters,
24  CollisionFrame &output_array,
25  RandomGeneratorMap &random_devices)
26  : vehicle_id_list(vehicle_id_list),
27  simulation_state(simulation_state),
28  buffer_map(buffer_map),
29  track_traffic(track_traffic),
30  parameters(parameters),
31  output_array(output_array),
32  random_devices(random_devices) {}
33 
34 void CollisionStage::Update(const unsigned long index) {
35  ActorId obstacle_id = 0u;
36  bool collision_hazard = false;
37  float available_distance_margin = std::numeric_limits<float>::infinity();
38 
39  const ActorId ego_actor_id = vehicle_id_list.at(index);
40  if (simulation_state.ContainsActor(ego_actor_id)) {
41  const cg::Location ego_location = simulation_state.GetLocation(ego_actor_id);
42  const Buffer &ego_buffer = buffer_map.at(ego_actor_id);
43  const unsigned long look_ahead_index = GetTargetWaypoint(ego_buffer, JUNCTION_LOOK_AHEAD).second;
44  const float velocity = simulation_state.GetVelocity(ego_actor_id).Length();
45 
46  ActorIdSet overlapping_actors = track_traffic.GetOverlappingVehicles(ego_actor_id);
47  std::vector<ActorId> collision_candidate_ids;
48 
49  // Run through vehicles with overlapping paths and filter them;
51  float collision_radius_square = value;
52  if (velocity < 1.0f) {
53  collision_radius_square = SQUARE(COLLISION_RADIUS_STOP) + parameters.GetDistanceToLeadingVehicle(ego_actor_id);
54  }
55  for (ActorId overlapping_actor_id : overlapping_actors) {
56  // If actor is within maximum collision avoidance and vertical overlap range.
57  const cg::Location &overlapping_actor_location = simulation_state.GetLocation(overlapping_actor_id);
58  if (overlapping_actor_id != ego_actor_id
59  && cg::Math::DistanceSquared(overlapping_actor_location, ego_location) < collision_radius_square
60  && std::abs(ego_location.z - overlapping_actor_location.z) < VERTICAL_OVERLAP_THRESHOLD) {
61  collision_candidate_ids.push_back(overlapping_actor_id);
62  }
63  }
64 
65  // Sorting collision candidates in accending order of distance to current vehicle.
66  std::sort(collision_candidate_ids.begin(), collision_candidate_ids.end(),
67  [this, &ego_location](const ActorId &a_id_1, const ActorId &a_id_2) {
68  const cg::Location &e_loc = ego_location;
69  const cg::Location &loc_1 = simulation_state.GetLocation(a_id_1);
70  const cg::Location &loc_2 = simulation_state.GetLocation(a_id_2);
71  return (cg::Math::DistanceSquared(e_loc, loc_1) < cg::Math::DistanceSquared(e_loc, loc_2));
72  });
73 
74  // Check every actor in the vicinity if it poses a collision hazard.
75  for (auto iter = collision_candidate_ids.begin();
76  iter != collision_candidate_ids.end() && !collision_hazard;
77  ++iter) {
78  const ActorId other_actor_id = *iter;
79  const ActorType other_actor_type = simulation_state.GetType(other_actor_id);
80 
81  if (parameters.GetCollisionDetection(ego_actor_id, other_actor_id)
82  && buffer_map.find(ego_actor_id) != buffer_map.end()
83  && simulation_state.ContainsActor(other_actor_id)) {
84  std::pair<bool, float> negotiation_result = NegotiateCollision(ego_actor_id,
85  other_actor_id,
86  look_ahead_index);
87  if (negotiation_result.first) {
88  if ((other_actor_type == ActorType::Vehicle
89  && parameters.GetPercentageIgnoreVehicles(ego_actor_id) <= random_devices.at(ego_actor_id).next())
90  || (other_actor_type == ActorType::Pedestrian
91  && parameters.GetPercentageIgnoreWalkers(ego_actor_id) <= random_devices.at(ego_actor_id).next())) {
92  collision_hazard = true;
93  obstacle_id = other_actor_id;
94  available_distance_margin = negotiation_result.second;
95  }
96  }
97  }
98  }
99  }
100 
101  CollisionHazardData &output_element = output_array.at(index);
102  output_element.hazard_actor_id = obstacle_id;
103  output_element.hazard = collision_hazard;
104  output_element.available_distance_margin = available_distance_margin;
105 }
106 
107 void CollisionStage::RemoveActor(const ActorId actor_id) {
108  collision_locks.erase(actor_id);
109 }
110 
112  collision_locks.clear();
113 }
114 
116 
117  const float velocity = cg::Math::Dot(simulation_state.GetVelocity(actor_id), simulation_state.GetHeading(actor_id));
118  float bbox_extension;
119  // Using a linear function to calculate boundary length.
120  bbox_extension = BOUNDARY_EXTENSION_RATE * velocity + BOUNDARY_EXTENSION_MINIMUM;
121  // If a valid collision lock present, change boundary length to maintain lock.
122  if (collision_locks.find(actor_id) != collision_locks.end()) {
123  const CollisionLock &lock = collision_locks.at(actor_id);
124  float lock_boundary_length = static_cast<float>(lock.distance_to_lead_vehicle + LOCKING_DISTANCE_PADDING);
125  // Only extend boundary track vehicle if the leading vehicle
126  // if it is not further than velocity dependent extension by MAX_LOCKING_EXTENSION.
127  if ((lock_boundary_length - lock.initial_lock_distance) < MAX_LOCKING_EXTENSION) {
128  bbox_extension = lock_boundary_length;
129  }
130  }
131 
132  return bbox_extension;
133 }
134 
136  const ActorType actor_type = simulation_state.GetType(actor_id);
137  const cg::Vector3D heading_vector = simulation_state.GetHeading(actor_id);
138 
139  float forward_extension = 0.0f;
140  if (actor_type == ActorType::Pedestrian) {
141  // Extend the pedestrians bbox to "predict" where they'll be and avoid collisions.
142  forward_extension = simulation_state.GetVelocity(actor_id).Length() * WALKER_TIME_EXTENSION;
143  }
144 
145  cg::Vector3D dimensions = simulation_state.GetDimensions(actor_id);
146 
147  float bbox_x = dimensions.x;
148  float bbox_y = dimensions.y;
149 
150  const cg::Vector3D x_boundary_vector = heading_vector * (bbox_x + forward_extension);
151  const auto perpendicular_vector = cg::Vector3D(-heading_vector.y, heading_vector.x, 0.0f).MakeSafeUnitVector(EPSILON);
152  const cg::Vector3D y_boundary_vector = perpendicular_vector * (bbox_y + forward_extension);
153 
154  // Four corners of the vehicle in top view clockwise order (left-handed system).
155  const cg::Location location = simulation_state.GetLocation(actor_id);
156  LocationVector bbox_boundary = {
157  location + cg::Location(x_boundary_vector - y_boundary_vector),
158  location + cg::Location(-1.0f * x_boundary_vector - y_boundary_vector),
159  location + cg::Location(-1.0f * x_boundary_vector + y_boundary_vector),
160  location + cg::Location(x_boundary_vector + y_boundary_vector),
161  };
162 
163  return bbox_boundary;
164 }
165 
167  LocationVector geodesic_boundary;
168 
169  if (geodesic_boundary_map.find(actor_id) != geodesic_boundary_map.end()) {
170  geodesic_boundary = geodesic_boundary_map.at(actor_id);
171  } else {
172  const LocationVector bbox = GetBoundary(actor_id);
173 
174  if (buffer_map.find(actor_id) != buffer_map.end()) {
175  float bbox_extension = GetBoundingBoxExtention(actor_id);
176  const float specific_lead_distance = parameters.GetDistanceToLeadingVehicle(actor_id);
177  bbox_extension = std::max(specific_lead_distance, bbox_extension);
178  const float bbox_extension_square = SQUARE(bbox_extension);
179 
180  LocationVector left_boundary;
181  LocationVector right_boundary;
182  cg::Vector3D dimensions = simulation_state.GetDimensions(actor_id);
183  const float width = dimensions.y;
184  const float length = dimensions.x;
185 
186  const Buffer &waypoint_buffer = buffer_map.at(actor_id);
187  const TargetWPInfo target_wp_info = GetTargetWaypoint(waypoint_buffer, length);
188  const SimpleWaypointPtr boundary_start = target_wp_info.first;
189  const uint64_t boundary_start_index = target_wp_info.second;
190 
191  // At non-signalized junctions, we extend the boundary across the junction
192  // and in all other situations, boundary length is velocity-dependent.
193  SimpleWaypointPtr boundary_end = nullptr;
194  SimpleWaypointPtr current_point = waypoint_buffer.at(boundary_start_index);
195  bool reached_distance = false;
196  for (uint64_t j = boundary_start_index; !reached_distance && (j < waypoint_buffer.size()); ++j) {
197  if (boundary_start->DistanceSquared(current_point) > bbox_extension_square || j == waypoint_buffer.size() - 1) {
198  reached_distance = true;
199  }
200  if (boundary_end == nullptr
201  || cg::Math::Dot(boundary_end->GetForwardVector(), current_point->GetForwardVector()) < COS_10_DEGREES
202  || reached_distance) {
203 
204  const cg::Vector3D heading_vector = current_point->GetForwardVector();
205  const cg::Location location = current_point->GetLocation();
206  cg::Vector3D perpendicular_vector = cg::Vector3D(-heading_vector.y, heading_vector.x, 0.0f);
207  perpendicular_vector = perpendicular_vector.MakeSafeUnitVector(EPSILON);
208  // Direction determined for the left-handed system.
209  const cg::Vector3D scaled_perpendicular = perpendicular_vector * width;
210  left_boundary.push_back(location + cg::Location(scaled_perpendicular));
211  right_boundary.push_back(location + cg::Location(-1.0f * scaled_perpendicular));
212 
213  boundary_end = current_point;
214  }
215 
216  current_point = waypoint_buffer.at(j);
217  }
218 
219  // Reversing right boundary to construct clockwise (left-hand system)
220  // boundary. This is so because both left and right boundary vectors have
221  // the closest point to the vehicle at their starting index for the right
222  // boundary,
223  // we want to begin at the farthest point to have a clockwise trace.
224  std::reverse(right_boundary.begin(), right_boundary.end());
225  geodesic_boundary.insert(geodesic_boundary.end(), right_boundary.begin(), right_boundary.end());
226  geodesic_boundary.insert(geodesic_boundary.end(), bbox.begin(), bbox.end());
227  geodesic_boundary.insert(geodesic_boundary.end(), left_boundary.begin(), left_boundary.end());
228  } else {
229 
230  geodesic_boundary = bbox;
231  }
232 
233  geodesic_boundary_map.insert({actor_id, geodesic_boundary});
234  }
235 
236  return geodesic_boundary;
237 }
238 
240 
241  traffic_manager::Polygon boundary_polygon;
242  for (const cg::Location &location : boundary) {
243  bg::append(boundary_polygon.outer(), Point2D(location.x, location.y));
244  }
245  bg::append(boundary_polygon.outer(), Point2D(boundary.front().x, boundary.front().y));
246 
247  return boundary_polygon;
248 }
249 
251  const ActorId other_actor_id) {
252 
253 
254  std::pair<ActorId, ActorId> key_parts;
255  if (reference_vehicle_id < other_actor_id) {
256  key_parts = {reference_vehicle_id, other_actor_id};
257  } else {
258  key_parts = {other_actor_id, reference_vehicle_id};
259  }
260 
261  uint64_t actor_id_key = 0u;
262  actor_id_key |= key_parts.first;
263  actor_id_key <<= 32;
264  actor_id_key |= key_parts.second;
265 
266  GeometryComparison comparision_result{-1.0, -1.0, -1.0, -1.0};
267 
268  if (geometry_cache.find(actor_id_key) != geometry_cache.end()) {
269 
270  comparision_result = geometry_cache.at(actor_id_key);
271  double mref_veh_other = comparision_result.reference_vehicle_to_other_geodesic;
272  comparision_result.reference_vehicle_to_other_geodesic = comparision_result.other_vehicle_to_reference_geodesic;
273  comparision_result.other_vehicle_to_reference_geodesic = mref_veh_other;
274  } else {
275 
276  const Polygon reference_polygon = GetPolygon(GetBoundary(reference_vehicle_id));
277  const Polygon other_polygon = GetPolygon(GetBoundary(other_actor_id));
278 
279  const Polygon reference_geodesic_polygon = GetPolygon(GetGeodesicBoundary(reference_vehicle_id));
280 
281  const Polygon other_geodesic_polygon = GetPolygon(GetGeodesicBoundary(other_actor_id));
282 
283  const double reference_vehicle_to_other_geodesic = bg::distance(reference_polygon, other_geodesic_polygon);
284  const double other_vehicle_to_reference_geodesic = bg::distance(other_polygon, reference_geodesic_polygon);
285  const auto inter_geodesic_distance = bg::distance(reference_geodesic_polygon, other_geodesic_polygon);
286  const auto inter_bbox_distance = bg::distance(reference_polygon, other_polygon);
287 
288  comparision_result = {reference_vehicle_to_other_geodesic,
289  other_vehicle_to_reference_geodesic,
290  inter_geodesic_distance,
291  inter_bbox_distance};
292 
293  geometry_cache.insert({actor_id_key, comparision_result});
294  }
295 
296  return comparision_result;
297 }
298 
299 std::pair<bool, float> CollisionStage::NegotiateCollision(const ActorId reference_vehicle_id,
300  const ActorId other_actor_id,
301  const uint64_t reference_junction_look_ahead_index) {
302  // Output variables for the method.
303  bool hazard = false;
304  float available_distance_margin = std::numeric_limits<float>::infinity();
305 
306  const cg::Location reference_location = simulation_state.GetLocation(reference_vehicle_id);
307  const cg::Location other_location = simulation_state.GetLocation(other_actor_id);
308 
309  // Ego and other vehicle heading.
310  const cg::Vector3D reference_heading = simulation_state.GetHeading(reference_vehicle_id);
311  // Vector from ego position to position of the other vehicle.
312  cg::Vector3D reference_to_other = other_location - reference_location;
313  reference_to_other = reference_to_other.MakeSafeUnitVector(EPSILON);
314 
315  // Other vehicle heading.
316  const cg::Vector3D other_heading = simulation_state.GetHeading(other_actor_id);
317  // Vector from other vehicle position to ego position.
318  cg::Vector3D other_to_reference = reference_location - other_location;
319  other_to_reference = other_to_reference.MakeSafeUnitVector(EPSILON);
320 
321  float reference_vehicle_length = simulation_state.GetDimensions(reference_vehicle_id).x * SQUARE_ROOT_OF_TWO;
322  float other_vehicle_length = simulation_state.GetDimensions(other_actor_id).x * SQUARE_ROOT_OF_TWO;
323 
324  float inter_vehicle_distance = cg::Math::DistanceSquared(reference_location, other_location);
325  float ego_bounding_box_extension = GetBoundingBoxExtention(reference_vehicle_id);
326  float other_bounding_box_extension = GetBoundingBoxExtention(other_actor_id);
327  // Calculate minimum distance between vehicle to consider collision negotiation.
328  float inter_vehicle_length = reference_vehicle_length + other_vehicle_length;
329  float ego_detection_range = SQUARE(ego_bounding_box_extension + inter_vehicle_length);
330  float cross_detection_range = SQUARE(ego_bounding_box_extension + inter_vehicle_length + other_bounding_box_extension);
331 
332  // Conditions to consider collision negotiation.
333  bool other_vehicle_in_ego_range = inter_vehicle_distance < ego_detection_range;
334  bool other_vehicles_in_cross_detection_range = inter_vehicle_distance < cross_detection_range;
335  float reference_heading_to_other_dot = cg::Math::Dot(reference_heading, reference_to_other);
336  bool other_vehicle_in_front = reference_heading_to_other_dot > 0;
337  const Buffer &reference_vehicle_buffer = buffer_map.at(reference_vehicle_id);
338  SimpleWaypointPtr closest_point = reference_vehicle_buffer.front();
339  bool ego_inside_junction = closest_point->CheckJunction();
340  TrafficLightState reference_tl_state = simulation_state.GetTLS(reference_vehicle_id);
341  bool ego_at_traffic_light = reference_tl_state.at_traffic_light;
342  bool ego_stopped_by_light = reference_tl_state.tl_state != TLS::Green && reference_tl_state.tl_state != TLS::Off;
343  SimpleWaypointPtr look_ahead_point = reference_vehicle_buffer.at(reference_junction_look_ahead_index);
344  bool ego_at_junction_entrance = !closest_point->CheckJunction() && look_ahead_point->CheckJunction();
345 
346  // Conditions to consider collision negotiation.
347  if (!(ego_at_junction_entrance && ego_at_traffic_light && ego_stopped_by_light)
348  && ((ego_inside_junction && other_vehicles_in_cross_detection_range)
349  || (!ego_inside_junction && other_vehicle_in_front && other_vehicle_in_ego_range))) {
350  GeometryComparison geometry_comparison = GetGeometryBetweenActors(reference_vehicle_id, other_actor_id);
351 
352  // Conditions for collision negotiation.
353  bool geodesic_path_bbox_touching = geometry_comparison.inter_geodesic_distance < OVERLAP_THRESHOLD;
354  bool vehicle_bbox_touching = geometry_comparison.inter_bbox_distance < OVERLAP_THRESHOLD;
355  bool ego_path_clear = geometry_comparison.other_vehicle_to_reference_geodesic > OVERLAP_THRESHOLD;
356  bool other_path_clear = geometry_comparison.reference_vehicle_to_other_geodesic > OVERLAP_THRESHOLD;
357  bool ego_path_priority = geometry_comparison.reference_vehicle_to_other_geodesic < geometry_comparison.other_vehicle_to_reference_geodesic;
358  bool other_path_priority = geometry_comparison.reference_vehicle_to_other_geodesic > geometry_comparison.other_vehicle_to_reference_geodesic;
359  bool ego_angular_priority = reference_heading_to_other_dot< cg::Math::Dot(other_heading, other_to_reference);
360 
361  // Whichever vehicle's path is farthest away from the other vehicle gets priority to move.
362  bool lower_priority = !ego_path_priority && (other_path_priority || !ego_angular_priority);
363  bool blocked_by_other_or_lower_priority = !ego_path_clear || (other_path_clear && lower_priority);
364  bool yield_pre_crash = !vehicle_bbox_touching && blocked_by_other_or_lower_priority;
365  bool yield_post_crash = vehicle_bbox_touching && !ego_angular_priority;
366 
367  if (geodesic_path_bbox_touching && (yield_pre_crash || yield_post_crash)) {
368 
369  hazard = true;
370 
371  const float reference_lead_distance = parameters.GetDistanceToLeadingVehicle(reference_vehicle_id);
372  const float specific_distance_margin = std::max(reference_lead_distance, MIN_REFERENCE_DISTANCE);
373  available_distance_margin = static_cast<float>(std::max(geometry_comparison.reference_vehicle_to_other_geodesic
374  - static_cast<double>(specific_distance_margin), 0.0));
375 
376  ///////////////////////////////////// Collision locking mechanism /////////////////////////////////
377  // The idea is, when encountering a possible collision,
378  // we should ensure that the bounding box extension doesn't decrease too fast and loose collision tracking.
379  // This enables us to smoothly approach the lead vehicle.
380 
381  // When possible collision found, check if an entry for collision lock present.
382  if (collision_locks.find(reference_vehicle_id) != collision_locks.end()) {
383  CollisionLock &lock = collision_locks.at(reference_vehicle_id);
384  // Check if the same vehicle is under lock.
385  if (other_actor_id == lock.lead_vehicle_id) {
386  // If the body of the lead vehicle is touching the reference vehicle bounding box.
387  if (geometry_comparison.other_vehicle_to_reference_geodesic < OVERLAP_THRESHOLD) {
388  // Distance between the bodies of the vehicles.
389  lock.distance_to_lead_vehicle = geometry_comparison.inter_bbox_distance;
390  } else {
391  // Distance from reference vehicle body to other vehicle path polygon.
393  }
394  } else {
395  // If possible collision with a new vehicle, re-initialize with new lock entry.
396  lock = {geometry_comparison.inter_bbox_distance, geometry_comparison.inter_bbox_distance, other_actor_id};
397  }
398  } else {
399  // Insert and initialize lock entry if not present.
400  collision_locks.insert({reference_vehicle_id,
401  {geometry_comparison.inter_bbox_distance,
402  geometry_comparison.inter_bbox_distance,
403  other_actor_id}});
404  }
405  }
406  }
407 
408  // If no collision hazard detected, then flush collision lock held by the vehicle.
409  if (!hazard && collision_locks.find(reference_vehicle_id) != collision_locks.end()) {
410  collision_locks.erase(reference_vehicle_id);
411  }
412 
413  return {hazard, available_distance_margin};
414 }
415 
417  geodesic_boundary_map.clear();
418  geometry_cache.clear();
419 }
420 
421 } // namespace traffic_manager
422 } // namespace carla
bool GetCollisionDetection(const ActorId &reference_actor_id, const ActorId &other_actor_id) const
Method to query collision avoidance rule between a pair of vehicles.
Definition: Parameters.cpp:182
TargetWPInfo GetTargetWaypoint(const Buffer &waypoint_buffer, const float &target_point_distance)
GeometryComparison GetGeometryBetweenActors(const ActorId reference_vehicle_id, const ActorId other_actor_id)
Polygon GetPolygon(const LocationVector &boundary)
std::vector< cg::Location > LocationVector
LocationVector GetBoundary(const ActorId actor_id)
float GetBoundingBoxExtention(const ActorId actor_id)
LocationVector GetGeodesicBoundary(const ActorId actor_id)
void reverse(I begin, I end)
Definition: pugixml.cpp:7358
TrafficLightState GetTLS(const ActorId actor_id) const
This class holds the state of all the vehicles in the simlation.
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
cg::Vector3D GetDimensions(const ActorId actor_id) const
std::unordered_map< carla::rpc::ActorId, RandomGenerator > RandomGeneratorMap
std::unordered_set< ActorId > ActorIdSet
ActorType GetType(const ActorId actor_id) const
std::deque< std::shared_ptr< SimpleWaypoint > > Buffer
static auto DistanceSquared(const Vector3D &a, const Vector3D &b)
Definition: Math.h:66
std::unordered_map< carla::ActorId, Buffer > BufferMap
float Length() const
Definition: geom/Vector3D.h:49
CollisionStage(const std::vector< ActorId > &vehicle_id_list, const SimulationState &simulation_state, const BufferMap &buffer_map, const TrackTraffic &track_traffic, const Parameters &parameters, CollisionFrame &output_array, RandomGeneratorMap &random_devices)
cg::Location GetLocation(const ActorId actor_id) const
geom::Vector3D Vector3D
Definition: rpc/Vector3D.h:14
geom::Location Location
Definition: rpc/Location.h:14
#define SQUARE(a)
This file contains various constants used in traffic manager arranged into sensible namespaces for re...
Definition: Constants.h:13
void Update(const unsigned long index) override
carla::ActorId ActorId
bool ContainsActor(ActorId actor_id) const
void RemoveActor(const ActorId actor_id) override
ActorIdSet GetOverlappingVehicles(ActorId actor_id) const
float GetPercentageIgnoreVehicles(const ActorId &actor_id) const
Method to get % to ignore any vehicle.
Definition: Parameters.cpp:276
float GetDistanceToLeadingVehicle(const ActorId &actor_id) const
Method to query distance to leading vehicle for a given vehicle.
Definition: Parameters.cpp:231
cg::Vector3D GetHeading(const ActorId actor_id) const
const SimulationState & simulation_state
bg::model::point< double, 2, bg::cs::cartesian > Point2D
static auto Dot(const Vector3D &a, const Vector3D &b)
Definition: Math.h:58
std::shared_ptr< SimpleWaypoint > SimpleWaypointPtr
bg::model::polygon< bg::model::d2::point_xy< double > > Polygon
float GetPercentageIgnoreWalkers(const ActorId &actor_id) const
Method to get % to ignore any walker.
Definition: Parameters.cpp:265
const std::vector< ActorId > & vehicle_id_list
std::pair< SimpleWaypointPtr, uint64_t > TargetWPInfo
Method to return the wayPoints from the waypoint Buffer by using target point distance.
cg::Vector3D GetVelocity(const ActorId actor_id) const
Vector3D MakeSafeUnitVector(const float epsilon) const
Definition: geom/Vector3D.h:64
void sort(I begin, I end, const Pred &pred)
Definition: pugixml.cpp:7444
static constexpr double EPSILON
We use this epsilon to shift the waypoints away from the edges of the lane sections to avoid floating...
Definition: road/Map.cpp:31
std::vector< CollisionHazardData > CollisionFrame
std::pair< bool, float > NegotiateCollision(const ActorId reference_vehicle_id, const ActorId other_actor_id, const uint64_t reference_junction_look_ahead_index)