CARLA
Constants.h
Go to the documentation of this file.
1 
2 /// This file contains various constants used in traffic manager
3 /// arranged into sensible namespaces for re-usability across
4 /// different files.
5 
6 #pragma once
7 
8 #include <limits>
9 #include <stdint.h>
10 
11 #define SQUARE(a) ((a) * (a))
12 #define RATE(MaxY, MinY, DiffX) (((MaxY) - (MinY)) / (DiffX))
13 
14 namespace carla {
15 namespace traffic_manager {
16 namespace constants {
17 
18 namespace Networking {
19 static const uint64_t MIN_TRY_COUNT = 20u;
20 static const unsigned short TM_DEFAULT_PORT = 8000u;
21 static const int64_t TM_TIMEOUT = 2000; // ms
22 } // namespace Networking
23 
24 namespace VehicleRemoval {
25 static const float STOPPED_VELOCITY_THRESHOLD = 0.8f;
26 static const double BLOCKED_TIME_THRESHOLD = 90.0;
27 static const double RED_TL_BLOCKED_TIME_THRESHOLD = 180.0;
28 static const double DELTA_TIME_BETWEEN_DESTRUCTIONS = 10.0;
29 } // namespace VehicleRemoval
30 
31 namespace HybridMode {
32 static const float HYBRID_MODE_DT_FL = 0.05f;
33 static const double HYBRID_MODE_DT = 0.05;
34 static const double INV_HYBRID_DT = 1.0 / HYBRID_MODE_DT;
35 static const float PHYSICS_RADIUS = 50.0f;
36 } // namespace HybridMode
37 
38 namespace SpeedThreshold {
39 static const float HIGHWAY_SPEED = 50.0f / 3.6f;
40 static const float ARBITRARY_MAX_SPEED = 100.0f / 3.6f;
41 static const float AFTER_JUNCTION_MIN_SPEED = 5.0f / 3.6f;
42 } // namespace SpeedThreshold
43 
44 namespace PathBufferUpdate {
45 static const float MAX_START_DISTANCE = 30.0f;
46 static const float MINIMUM_HORIZON_LENGTH = 30.0f;
47 static const float MAXIMUM_HORIZON_LENGTH = 60.0f;
48 static const float HORIZON_RATE = RATE(MAXIMUM_HORIZON_LENGTH,
49  MINIMUM_HORIZON_LENGTH,
51 } // namespace PathBufferUpdate
52 
53 namespace WaypointSelection {
54 static const float TARGET_WAYPOINT_TIME_HORIZON = 1.0f;
55 static const float TARGET_WAYPOINT_HORIZON_LENGTH = 2.5f;
56 static const float JUNCTION_LOOK_AHEAD = 10.0f;
57 static const float SAFE_DISTANCE_AFTER_JUNCTION = 10.0f;
58 static const float MIN_JUNCTION_LENGTH = 5.0f;
60 } // namespace WaypointSelection
61 
62 namespace LaneChange {
63 static const float MINIMUM_LANE_CHANGE_DISTANCE = 15.0f;
64 static const float MAXIMUM_LANE_OBSTACLE_DISTANCE = 50.0f;
65 static const float MAXIMUM_LANE_OBSTACLE_CURVATURE = 0.6f;
66 static const float INTER_LANE_CHANGE_DISTANCE = 10.0f;
67 } // namespace LaneChange
68 
69 namespace Collision {
70 static const float BOUNDARY_EXTENSION_MAXIMUM = 50.0f;
71 static const float BOUNDARY_EXTENSION_MINIMUM = 2.0f;
72 static const float BOUNDARY_EXTENSION_RATE = RATE(BOUNDARY_EXTENSION_MAXIMUM,
73  BOUNDARY_EXTENSION_MINIMUM,
75 static const float COS_10_DEGREES = 0.9848f;
76 static const float EPSILON_VELOCITY = 0.1f;
77 static const float LOCKING_DISTANCE_PADDING = 4.0f;
78 static const float MAX_COLLISION_RADIUS = 100.0f;
79 static const float MAX_LOCKING_EXTENSION = 10.0f;
80 static const float WALKER_TIME_EXTENSION = 1.5f;
81 static const float SQUARE_ROOT_OF_TWO = 1.414f;
82 static const float VERTICAL_OVERLAP_THRESHOLD = 4.0f;
83 static const float EPSILON = 2.0f * std::numeric_limits<float>::epsilon();
84 } // namespace Collision
85 
86 namespace FrameMemory {
87 static const uint64_t INITIAL_SIZE = 50u;
88 static const uint64_t GROWTH_STEP_SIZE = 50u;
89 static const float INV_GROWTH_STEP_SIZE = 1.0f / static_cast<float>(GROWTH_STEP_SIZE);
90 } // namespace FrameMemory
91 
92 namespace Map {
93 static const float INFINITE_DISTANCE = std::numeric_limits<float>::max();
94 static const float GRID_SIZE = 4.0f;
95 static const float PED_GRID_SIZE = 10.0f;
96 static const float MAX_GEODESIC_GRID_LENGTH = 20.0f;
97 static const double MAP_RESOLUTION = 0.1;
98 static const float INV_MAP_RESOLUTION = 10.0f;
99 } // namespace Map
100 
101 namespace TrafficLight {
102 static const uint64_t NO_SIGNAL_PASSTHROUGH_INTERVAL = 5u;
103 static const double DOUBLE_NO_SIGNAL_PASSTHROUGH_INTERVAL = 5.0;
104 } // namespace TrafficLight
105 
106 namespace MotionPlan {
107 static const float RELATIVE_APPROACH_SPEED = 10.0f / 3.6f;
108 static const float MIN_FOLLOW_LEAD_DISTANCE = 5.0f;
109 static const float MAX_FOLLOW_LEAD_DISTANCE = 10.0f;
110 static const float FOLLOW_DISTANCE_RATE = RATE(MAX_FOLLOW_LEAD_DISTANCE,
111  MIN_FOLLOW_LEAD_DISTANCE,
113 static const float CRITICAL_BRAKING_MARGIN = 0.25f;
114 static const float EPSILON_RELATIVE_SPEED = 0.001f;
116 } // namespace MotionPlan
117 
118 namespace PID {
119 static const float MAX_THROTTLE = 0.7f;
120 static const float MAX_BRAKE = 1.0f;
121 static const float VELOCITY_INTEGRAL_MAX = 5.0f;
122 static const float VELOCITY_INTEGRAL_MIN = -5.0f;
123 static const float DT = 0.05f;
124 static const float INV_DT = 1.0f / DT;
125 } // namespace PID
126 
127 namespace TrackTraffic {
128 static const uint64_t BUFFER_STEP_THROUGH = 10;
129 static const float INV_BUFFER_STEP_THROUGH = 0.1f;
130 } // namespace TrackTraffic
131 
132 } // namespace constants
133 } // namespace traffic_manager
134 } // namespace carla
#define RATE(MaxY, MinY, DiffX)
Definition: Constants.h:12
static const float MAXIMUM_LANE_OBSTACLE_DISTANCE
Definition: Constants.h:64
static const float MAXIMUM_LANE_OBSTACLE_CURVATURE
Definition: Constants.h:65
static const unsigned short TM_DEFAULT_PORT
Definition: Constants.h:20
static const double DOUBLE_NO_SIGNAL_PASSTHROUGH_INTERVAL
Definition: Constants.h:103
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99
static const float INFINITE_DISTANCE
Definition: Constants.h:93
static const float MAX_GEODESIC_GRID_LENGTH
Definition: Constants.h:96
static const double MAP_RESOLUTION
Definition: Constants.h:97
static const float VELOCITY_INTEGRAL_MAX
Definition: Constants.h:121
static const uint64_t NO_SIGNAL_PASSTHROUGH_INTERVAL
Definition: Constants.h:102
static const float VELOCITY_INTEGRAL_MIN
Definition: Constants.h:122
static const float INV_MAP_RESOLUTION
Definition: Constants.h:98