CARLA
 
载入中...
搜索中...
未找到
Constants.h
浏览该文件的文档.
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
16namespace carla {
17namespace traffic_manager {
18namespace constants {
19
20namespace Networking {
21static const uint64_t MIN_TRY_COUNT = 20u;
22static const unsigned short TM_DEFAULT_PORT = 8000u;
23static const int64_t TM_TIMEOUT = 2000; // ms
24} // namespace Networking
25
26namespace VehicleRemoval {
27static const float STOPPED_VELOCITY_THRESHOLD = 0.8f;
28static const double BLOCKED_TIME_THRESHOLD = 90.0;
29static const double RED_TL_BLOCKED_TIME_THRESHOLD = 180.0;
30static const double DELTA_TIME_BETWEEN_DESTRUCTIONS = 10.0;
31} // namespace VehicleRemoval
32
33namespace HybridMode {
34static const float HYBRID_MODE_DT_FL = 0.05f;
35static const double HYBRID_MODE_DT = 0.05;
36static const double INV_HYBRID_DT = 1.0 / HYBRID_MODE_DT;
37static const float PHYSICS_RADIUS = 50.0f;
38} // namespace HybridMode
39
40namespace SpeedThreshold {
41static const float HIGHWAY_SPEED = 60.0f / 3.6f;
42static const float AFTER_JUNCTION_MIN_SPEED = 5.0f / 3.6f;
43static const float INITIAL_PERCENTAGE_SPEED_DIFFERENCE = 0.0f;
44} // namespace SpeedThreshold
45
46namespace PathBufferUpdate {
47static const float MAX_START_DISTANCE = 20.0f;
48static const float MINIMUM_HORIZON_LENGTH = 15.0f;
49static const float HORIZON_RATE = 2.0f;
50static const float HIGH_SPEED_HORIZON_RATE = 4.0f;
51} // namespace PathBufferUpdate
52
53namespace WaypointSelection {
54static const float TARGET_WAYPOINT_TIME_HORIZON = 0.3f;
55static const float MIN_TARGET_WAYPOINT_DISTANCE = 3.0f;
56static const float JUNCTION_LOOK_AHEAD = 5.0f;
57static const float SAFE_DISTANCE_AFTER_JUNCTION = 4.0f;
58static const float MIN_JUNCTION_LENGTH = 8.0f;
60} // namespace WaypointSelection
61
62namespace LaneChange {
63static const float MINIMUM_LANE_CHANGE_DISTANCE = 20.0f;
64static const float MAXIMUM_LANE_OBSTACLE_DISTANCE = 50.0f;
65static const float MAXIMUM_LANE_OBSTACLE_CURVATURE = 0.6f;
66static const float INTER_LANE_CHANGE_DISTANCE = 10.0f;
67static const float MIN_WPT_DISTANCE = 5.0f;
68static const float MAX_WPT_DISTANCE = 20.0f;
69static const float MIN_LANE_CHANGE_SPEED = 5.0f;
70static const float FIFTYPERC = 50.0f;
71} // namespace LaneChange
72
73namespace Collision {
74static const float BOUNDARY_EXTENSION_MINIMUM = 2.5f;
75static const float BOUNDARY_EXTENSION_RATE = 4.35f;
76static const float COS_10_DEGREES = 0.9848f;
77static const float OVERLAP_THRESHOLD = 0.1f;
78static const float LOCKING_DISTANCE_PADDING = 4.0f;
79static const float COLLISION_RADIUS_STOP = 8.0f;
80static const float COLLISION_RADIUS_MIN = 20.0f;
81static const float COLLISION_RADIUS_RATE = 2.65f;
82static const float MAX_LOCKING_EXTENSION = 10.0f;
83static const float WALKER_TIME_EXTENSION = 1.5f;
84static const float SQUARE_ROOT_OF_TWO = 1.414f;
85static const float VERTICAL_OVERLAP_THRESHOLD = 4.0f;
86static const float EPSILON = 2.0f * std::numeric_limits<float>::epsilon();
87static const float MIN_REFERENCE_DISTANCE = 0.5f;
88static const float MIN_VELOCITY_COLL_RADIUS = 2.0f;
89static const float VEL_EXT_FACTOR = 0.36f;
90} // namespace Collision
91
92namespace FrameMemory {
93static const uint64_t INITIAL_SIZE = 50u;
94static const uint64_t GROWTH_STEP_SIZE = 50u;
95static const float INV_GROWTH_STEP_SIZE = 1.0f / static_cast<float>(GROWTH_STEP_SIZE);
96} // namespace FrameMemory
97
98namespace Map {
99static const float INFINITE_DISTANCE = std::numeric_limits<float>::max();
100static const float MAX_GEODESIC_GRID_LENGTH = 20.0f;
101static const float MAP_RESOLUTION = 5.0f;
102static const float INV_MAP_RESOLUTION = 1.0f / MAP_RESOLUTION;
103static const double MAX_WPT_DISTANCE = MAP_RESOLUTION/2.0 + SQUARE(MAP_RESOLUTION);
104static const float MAX_WPT_RADIANS = 0.087f; // 5º
105static float const DELTA = 25.0f;
106static float const Z_DELTA = 500.0f;
107static float const STRAIGHT_DEG = 19.0f;
108static const double MIN_LANE_WIDTH = 1.0f;
109} // namespace Map
110
111namespace TrafficLight {
112static const double MINIMUM_STOP_TIME = 2.0;
113static const double EXIT_JUNCTION_THRESHOLD = 0; // Dot product of 90º
114} // namespace TrafficLight
115
116namespace MotionPlan {
117static const float RELATIVE_APPROACH_SPEED = 12.0f / 3.6f;
118static const float MIN_FOLLOW_LEAD_DISTANCE = 2.0f;
119static const float CRITICAL_BRAKING_MARGIN = 0.2f;
120static const float EPSILON_RELATIVE_SPEED = 0.001f;
122static const float TWO_KM = 2000.0f;
123static const uint16_t ATTEMPTS_TO_TELEPORT = 5u;
124static const float LANDMARK_DETECTION_TIME = 3.5f;
125static const float TL_TARGET_VELOCITY = 15.0f / 3.6f;
126static const float STOP_TARGET_VELOCITY = 10.0f / 3.6f;
127static const float YIELD_TARGET_VELOCITY = 10.0f / 3.6f;
128static const float FRICTION = 0.6f;
129static const float GRAVITY = 9.81f;
130static const float PI = 3.1415927f;
131static const float PERC_MAX_SLOWDOWN = 0.08f;
132static const float FOLLOW_LEAD_FACTOR = 2.0f;
133} // namespace MotionPlan
134
135namespace VehicleLight {
136static const float SUN_ALTITUDE_DEGREES_BEFORE_DAWN = 15.0f;
137static const float SUN_ALTITUDE_DEGREES_AFTER_SUNSET = 165.0f;
138static const float SUN_ALTITUDE_DEGREES_JUST_AFTER_DAWN = 35.0f;
139static const float SUN_ALTITUDE_DEGREES_JUST_BEFORE_SUNSET = 145.0f;
140static const float HEAVY_PRECIPITATION_THRESHOLD = 80.0f;
141static const float FOG_DENSITY_THRESHOLD = 20.0f;
142static const float MAX_DISTANCE_LIGHT_CHECK = 225.0f;
143} // namespace VehicleLight
144
145namespace PID {
146static const float MAX_THROTTLE = 0.85f;
147static const float MAX_BRAKE = 0.7f;
148static const float MAX_STEERING = 0.8f;
149static const float MAX_STEERING_DIFF = 0.15f;
150static const float DT = 0.05f;
151static const float INV_DT = 1.0f / DT;
152static const std::vector<float> LONGITUDIAL_PARAM = {12.0f, 0.05f, 0.02f};
153static const std::vector<float> LONGITUDIAL_HIGHWAY_PARAM = {20.0f, 0.05f, 0.01f};
154static const std::vector<float> LATERAL_PARAM = {4.0f, 0.02f, 0.08f};
155static const std::vector<float> LATERAL_HIGHWAY_PARAM = {2.0f, 0.02f, 0.04f};
156} // namespace PID
157
158namespace TrackTraffic {
159static const uint64_t BUFFER_STEP_THROUGH = 5;
160static const float INV_BUFFER_STEP_THROUGH = 1.0f / static_cast<float>(BUFFER_STEP_THROUGH);
161} // namespace TrackTraffic
162
163} // namespace constants
164} // namespace traffic_manager
165} // namespace carla
#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:100
static const std::vector< float > LATERAL_HIGHWAY_PARAM
Definition Constants.h:155
static const std::vector< float > LONGITUDIAL_PARAM
Definition Constants.h:152
static const std::vector< float > LONGITUDIAL_HIGHWAY_PARAM
Definition Constants.h:153
static const std::vector< float > LATERAL_PARAM
Definition Constants.h:154
static const float SUN_ALTITUDE_DEGREES_JUST_BEFORE_SUNSET
Definition Constants.h:139
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133