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 #include <iostream>
11 #include <vector>
12 
13 #define SQUARE(a) ((a) * (a))
14 #define RATE(MaxY, MinY, DiffX) (((MaxY) - (MinY)) / (DiffX))
15 
16 namespace carla {
17 namespace traffic_manager {
18 namespace constants {
19 
20 namespace Networking {
21 static const uint64_t MIN_TRY_COUNT = 20u;
22 static const unsigned short TM_DEFAULT_PORT = 8000u;
23 static const int64_t TM_TIMEOUT = 2000; // ms
24 } // namespace Networking
25 
26 namespace VehicleRemoval {
27 static const float STOPPED_VELOCITY_THRESHOLD = 0.8f;
28 static const double BLOCKED_TIME_THRESHOLD = 90.0;
29 static const double RED_TL_BLOCKED_TIME_THRESHOLD = 180.0;
30 static const double DELTA_TIME_BETWEEN_DESTRUCTIONS = 10.0;
31 } // namespace VehicleRemoval
32 
33 namespace HybridMode {
34 static const float HYBRID_MODE_DT_FL = 0.1f;
35 static const double HYBRID_MODE_DT = 0.1;
36 static const double INV_HYBRID_DT = 1.0 / HYBRID_MODE_DT;
37 static const float PHYSICS_RADIUS = 50.0f;
38 } // namespace HybridMode
39 
40 namespace SpeedThreshold {
41 static const float HIGHWAY_SPEED = 50.0f / 3.6f;
42 static const float AFTER_JUNCTION_MIN_SPEED = 5.0f / 3.6f;
43 static const float INITIAL_PERCENTAGE_SPEED_DIFFERENCE = 30.0f;
44 } // namespace SpeedThreshold
45 
46 namespace PathBufferUpdate {
47 static const float MAX_START_DISTANCE = 20.0f;
48 static const float MINIMUM_HORIZON_LENGTH = 20.0f;
49 static const float HORIZON_RATE = 1.45f;
50 } // namespace PathBufferUpdate
51 
52 namespace WaypointSelection {
53 static const float TARGET_WAYPOINT_TIME_HORIZON = 0.5f;
54 static const float TARGET_WAYPOINT_HORIZON_LENGTH = 1.0f;
55 static const float JUNCTION_LOOK_AHEAD = 5.0f;
56 static const float SAFE_DISTANCE_AFTER_JUNCTION = 4.0f;
57 static const float MIN_JUNCTION_LENGTH = 8.0f;
59 } // namespace WaypointSelection
60 
61 namespace LaneChange {
62 static const float MINIMUM_LANE_CHANGE_DISTANCE = 15.0f;
63 static const float MAXIMUM_LANE_OBSTACLE_DISTANCE = 50.0f;
64 static const float MAXIMUM_LANE_OBSTACLE_CURVATURE = 0.6f;
65 static const float INTER_LANE_CHANGE_DISTANCE = 10.0f;
66 } // namespace LaneChange
67 
68 namespace Collision {
69 static const float BOUNDARY_EXTENSION_MINIMUM = 2.5f;
70 static const float BOUNDARY_EXTENSION_RATE = 1.35f;
71 static const float COS_10_DEGREES = 0.9848f;
72 static const float OVERLAP_THRESHOLD = 0.1f;
73 static const float LOCKING_DISTANCE_PADDING = 4.0f;
74 static const float COLLISION_RADIUS_STOP = 8.0f;
75 static const float COLLISION_RADIUS_MIN = 20.0f;
76 static const float COLLISION_RADIUS_RATE = 0.65f;
77 static const float MAX_LOCKING_EXTENSION = 10.0f;
78 static const float WALKER_TIME_EXTENSION = 1.5f;
79 static const float SQUARE_ROOT_OF_TWO = 1.414f;
80 static const float VERTICAL_OVERLAP_THRESHOLD = 4.0f;
81 static const float EPSILON = 2.0f * std::numeric_limits<float>::epsilon();
82 static const float MIN_REFERENCE_DISTANCE = 1.0f;
83 } // namespace Collision
84 
85 namespace FrameMemory {
86 static const uint64_t INITIAL_SIZE = 50u;
87 static const uint64_t GROWTH_STEP_SIZE = 50u;
88 static const float INV_GROWTH_STEP_SIZE = 1.0f / static_cast<float>(GROWTH_STEP_SIZE);
89 } // namespace FrameMemory
90 
91 namespace Map {
92 static const float INFINITE_DISTANCE = std::numeric_limits<float>::max();
93 static const float MAX_GEODESIC_GRID_LENGTH = 20.0f;
94 static const float MAP_RESOLUTION = 5.0f;
95 static const float INV_MAP_RESOLUTION = 1.0f / MAP_RESOLUTION;
96 static const double MAX_WPT_DISTANCE = MAP_RESOLUTION/2.0 + SQUARE(MAP_RESOLUTION);
97 static const float MAX_WPT_RADIANS = 0.1745f; // 10ยบ
98 static float const DELTA = 25.0f;
99 static float const Z_DELTA = 500.0f;
100 } // namespace Map
101 
102 namespace TrafficLight {
103 static const uint64_t NO_SIGNAL_PASSTHROUGH_INTERVAL = 5u;
104 static const double DOUBLE_NO_SIGNAL_PASSTHROUGH_INTERVAL = 5.0;
105 } // namespace TrafficLight
106 
107 namespace MotionPlan {
108 static const float RELATIVE_APPROACH_SPEED = 10.0f / 3.6f;
109 static const float MIN_FOLLOW_LEAD_DISTANCE = 2.0f;
110 static const float MAX_FOLLOW_LEAD_DISTANCE = 5.0f;
111 static const float FOLLOW_DISTANCE_RATE = 0.1f;
112 static const float CRITICAL_BRAKING_MARGIN = 0.25f;
113 static const float EPSILON_RELATIVE_SPEED = 0.001f;
115 static const float TWO_KM = 2000.0f;
116 static const uint16_t ATTEMPTS_TO_TELEPORT = 5u;
117 static const float LANDMARK_DETECTION_TIME = 2.5f;
118 static const float TL_GREEN_TARGET_VELOCITY = 20.0f / 3.6f;
119 static const float TL_RED_TARGET_VELOCITY = 15.0f / 3.6f;
121 static const float STOP_TARGET_VELOCITY = 15.0f / 3.6f;
122 static const float YIELD_TARGET_VELOCITY = 15.0f / 3.6f;
123 static const float FRICTION = 0.6f;
124 static const float GRAVITY = 9.81f;
125 static const float PI = 3.1415927f;
126 } // namespace MotionPlan
127 
128 namespace PID {
129 static const float MAX_THROTTLE = 0.85f;
130 static const float MAX_BRAKE = 1.0f;
131 static const float MAX_STEERING = 0.8f;
132 static const float MAX_STEERING_DIFF = 0.15f;
133 static const float DT = 0.05f;
134 static const float INV_DT = 1.0f / DT;
135 static const std::vector<float> LONGITUDIAL_PARAM = {12.0f, 0.05f, 0.02f};
136 static const std::vector<float> LONGITUDIAL_HIGHWAY_PARAM = {20.0f, 0.05f, 0.01f};
137 static const std::vector<float> LATERAL_PARAM = {5.0f, 0.02f, 0.8f};
138 static const std::vector<float> LATERAL_HIGHWAY_PARAM = {3.0f, 0.02f, 0.4f};
139 } // namespace PID
140 
141 namespace TrackTraffic {
142 static const uint64_t BUFFER_STEP_THROUGH = 5;
143 static const float INV_BUFFER_STEP_THROUGH = 1.0f / static_cast<float>(BUFFER_STEP_THROUGH);
144 } // namespace TrackTraffic
145 
146 } // namespace constants
147 } // namespace traffic_manager
148 } // namespace carla
static const std::vector< float > LATERAL_HIGHWAY_PARAM
Definition: Constants.h:138
static const float MAX_WPT_RADIANS
Definition: Constants.h:97
static const float MAXIMUM_LANE_OBSTACLE_DISTANCE
Definition: Constants.h:63
static const float MAXIMUM_LANE_OBSTACLE_CURVATURE
Definition: Constants.h:64
static const unsigned short TM_DEFAULT_PORT
Definition: Constants.h:22
static const std::vector< float > LATERAL_PARAM
Definition: Constants.h:137
static const double DOUBLE_NO_SIGNAL_PASSTHROUGH_INTERVAL
Definition: Constants.h:104
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
static const float MAX_STEERING_DIFF
Definition: Constants.h:132
static const float INFINITE_DISTANCE
Definition: Constants.h:92
static const double MAX_WPT_DISTANCE
Definition: Constants.h:96
#define SQUARE(a)
This file contains various constants used in traffic manager arranged into sensible namespaces for re...
Definition: Constants.h:13
static const float MAX_GEODESIC_GRID_LENGTH
Definition: Constants.h:93
static const std::vector< float > LONGITUDIAL_HIGHWAY_PARAM
Definition: Constants.h:136
static const std::vector< float > LONGITUDIAL_PARAM
Definition: Constants.h:135
static const uint64_t NO_SIGNAL_PASSTHROUGH_INTERVAL
Definition: Constants.h:103
static const float INV_MAP_RESOLUTION
Definition: Constants.h:95