CARLA
 
载入中...
搜索中...
未找到
TrafficManagerLocal.cpp
浏览该文件的文档.
1// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#include <algorithm>
8
9#include "carla/Logging.h"
10
12
14
15namespace carla {
16namespace traffic_manager {
17
18using namespace constants::FrameMemory;
19
21 std::vector<float> longitudinal_PID_parameters,
22 std::vector<float> longitudinal_highway_PID_parameters,
23 std::vector<float> lateral_PID_parameters,
24 std::vector<float> lateral_highway_PID_parameters,
25 float perc_difference_from_limit,
26 cc::detail::EpisodeProxy &episode_proxy,
27 uint16_t &RPCportTM)
28
29 : longitudinal_PID_parameters(longitudinal_PID_parameters),
30 longitudinal_highway_PID_parameters(longitudinal_highway_PID_parameters),
31 lateral_PID_parameters(lateral_PID_parameters),
32 lateral_highway_PID_parameters(lateral_highway_PID_parameters),
33
34 episode_proxy(episode_proxy),
35 world(cc::World(episode_proxy)),
36
37 localization_stage(LocalizationStage(vehicle_id_list,
38 buffer_map,
39 simulation_state,
40 track_traffic,
41 local_map,
42 parameters,
43 marked_for_removal,
44 localization_frame,
45 random_device)),
46
47 collision_stage(CollisionStage(vehicle_id_list,
48 simulation_state,
49 buffer_map,
50 track_traffic,
51 parameters,
52 collision_frame,
53 random_device)),
54
55 traffic_light_stage(TrafficLightStage(vehicle_id_list,
56 simulation_state,
57 buffer_map,
58 parameters,
59 world,
60 tl_frame,
61 random_device)),
62
63 motion_plan_stage(MotionPlanStage(vehicle_id_list,
64 simulation_state,
65 parameters,
66 buffer_map,
67 track_traffic,
68 longitudinal_PID_parameters,
69 longitudinal_highway_PID_parameters,
70 lateral_PID_parameters,
71 lateral_highway_PID_parameters,
72 localization_frame,
73 collision_frame,
74 tl_frame,
75 world,
76 control_frame,
77 random_device,
78 local_map)),
79
80 vehicle_light_stage(VehicleLightStage(vehicle_id_list,
81 buffer_map,
82 parameters,
83 world,
84 control_frame)),
85
86 alsm(ALSM(registered_vehicles,
87 buffer_map,
88 track_traffic,
89 marked_for_removal,
90 parameters,
91 world,
92 local_map,
93 simulation_state,
94 localization_stage,
95 collision_stage,
96 traffic_light_stage,
97 motion_plan_stage,
98 vehicle_light_stage)),
99
100 server(TrafficManagerServer(RPCportTM, static_cast<carla::traffic_manager::TrafficManagerBase *>(this))) {
101
102 parameters.SetGlobalPercentageSpeedDifference(perc_difference_from_limit);
103
105
107
108 Start();
109}
110
112 episode_proxy.Lock()->DestroyTrafficManager(server.port());
113 Release();
114}
115
117 const carla::SharedPtr<const cc::Map> world_map = world.GetMap();
118 local_map = std::make_shared<InMemoryMap>(world_map);
119
120 auto files = episode_proxy.Lock()->GetRequiredFiles("TM");
121 if (!files.empty()) {
122 auto content = episode_proxy.Lock()->GetCacheFile(files[0], true);
123 if (content.size() != 0) {
124 local_map->Load(content);
125 } else {
126 log_warning("No InMemoryMap cache found. Setting up local map. This may take a while...");
127 local_map->SetUp();
128 }
129 } else {
130 log_warning("No InMemoryMap cache found. Setting up local map. This may take a while...");
131 local_map->SetUp();
132 }
133}
134
136 run_traffic_manger.store(true);
137 worker_thread = std::make_unique<std::thread>(&TrafficManagerLocal::Run, this);
138}
139
141
144 tl_frame.reserve(INITIAL_SIZE);
147
148 size_t last_frame = 0;
149 while (run_traffic_manger.load()) {
150
151 bool synchronous_mode = parameters.GetSynchronousMode();
152 bool hybrid_physics_mode = parameters.GetHybridPhysicsMode();
153 parameters.SetMaxBoundaries(20.0f, episode_proxy.Lock()->GetEpisodeSettings().actor_active_distance);
154
155 // Wait for external trigger to initiate cycle in synchronous mode.
156 if (synchronous_mode) {
157 std::unique_lock<std::mutex> lock(step_execution_mutex);
158 step_begin_trigger.wait(lock, [this]() {return step_begin.load() || !run_traffic_manger.load();});
159 step_begin.store(false);
160 }
161
162 // Skipping velocity update if elapsed time is less than 0.05s in asynchronous, hybrid mode.
163 if (!synchronous_mode && hybrid_physics_mode) {
164 TimePoint current_instance = chr::system_clock::now();
165 chr::duration<float> elapsed_time = current_instance - previous_update_instance;
166 chr::duration<float> time_to_wait = chr::duration<float>(HYBRID_MODE_DT) - elapsed_time;
167 if (time_to_wait > chr::duration<float>(0.0f)) {
168 std::this_thread::sleep_for(time_to_wait);
169 }
170 previous_update_instance = current_instance;
171 }
172
173 // Stop TM from processing the same frame more than once
174 if (!synchronous_mode) {
176 if (timestamp.frame == last_frame) {
177 continue;
178 }
179 last_frame = timestamp.frame;
180 }
181
182 std::unique_lock<std::mutex> registration_lock(registration_mutex);
183 // Updating simulation state, actor life cycle and performing necessary cleanup.
184 alsm.Update();
185
186 // Re-allocating inter-stage communication frames based on changed number of registered vehicles.
187 int current_registered_vehicles_state = registered_vehicles.GetState();
188 unsigned long number_of_vehicles = vehicle_id_list.size();
189 if (registered_vehicles_state != current_registered_vehicles_state || number_of_vehicles != registered_vehicles.Size()) {
191 number_of_vehicles = vehicle_id_list.size();
192
193 // Reserve more space if needed.
194 uint64_t growth_factor = static_cast<uint64_t>(static_cast<float>(number_of_vehicles) * INV_GROWTH_STEP_SIZE);
195 uint64_t new_frame_capacity = INITIAL_SIZE + GROWTH_STEP_SIZE * growth_factor;
196 if (new_frame_capacity > current_reserved_capacity) {
197 localization_frame.reserve(new_frame_capacity);
198 collision_frame.reserve(new_frame_capacity);
199 tl_frame.reserve(new_frame_capacity);
200 control_frame.reserve(new_frame_capacity);
201 }
202
204 }
205
206 // Reset frames for current cycle.
207 localization_frame.clear();
208 localization_frame.resize(number_of_vehicles);
209 collision_frame.clear();
210 collision_frame.resize(number_of_vehicles);
211 tl_frame.clear();
212 tl_frame.resize(number_of_vehicles);
213 control_frame.clear();
214 // Reserve two frames for each vehicle: one for the ApplyVehicleControl command,
215 // and one for the optional SetVehicleLightState command
216 control_frame.reserve(2 * number_of_vehicles);
217 // Resize to accomodate at least all ApplyVehicleControl commands,
218 // that will be inserted by the motion_plan_stage stage.
219 control_frame.resize(number_of_vehicles);
220
221 // Run core operation stages.
222 for (unsigned long index = 0u; index < vehicle_id_list.size(); ++index) {
224 }
225 for (unsigned long index = 0u; index < vehicle_id_list.size(); ++index) {
226 collision_stage.Update(index);
227 }
230 for (unsigned long index = 0u; index < vehicle_id_list.size(); ++index) {
234 }
235
236 registration_lock.unlock();
237
238 // Sending the current cycle's batch command to the simulator.
239 if (synchronous_mode) {
240 episode_proxy.Lock()->ApplyBatchSync(control_frame, false);
241 step_end.store(true);
242 step_end_trigger.notify_one();
243 } else {
244 if (control_frame.size() > 0){
245 episode_proxy.Lock()->ApplyBatchSync(control_frame, false);
246 }
247 }
248 }
249}
250
253 step_begin.store(true);
254 step_begin_trigger.notify_one();
255
256 std::unique_lock<std::mutex> lock(step_execution_mutex);
257 step_end_trigger.wait(lock, [this]() { return step_end.load(); });
258 step_end.store(false);
259 }
260 return true;
261}
262
264
265 run_traffic_manger.store(false);
267 step_begin_trigger.notify_one();
268 }
269
270 if (worker_thread) {
271 if (worker_thread->joinable()) {
272 worker_thread->join();
273 }
274 worker_thread.release();
275 }
276
277 vehicle_id_list.clear();
281 previous_update_instance = chr::system_clock::now();
283
289
290 buffer_map.clear();
291 localization_frame.clear();
292 collision_frame.clear();
293 tl_frame.clear();
294 control_frame.clear();
295
296 run_traffic_manger.store(true);
297 step_begin.store(false);
298 step_end.store(false);
299}
300
302
303 Stop();
304
305 local_map.reset();
306}
307
309 Release();
310 episode_proxy = episode_proxy.Lock()->GetCurrentEpisode();
313 Start();
314}
315
316void TrafficManagerLocal::RegisterVehicles(const std::vector<ActorPtr> &vehicle_list) {
317 std::lock_guard<std::mutex> registration_lock(registration_mutex);
318 registered_vehicles.Insert(vehicle_list);
319}
320
321void TrafficManagerLocal::UnregisterVehicles(const std::vector<ActorPtr> &actor_list) {
322 std::lock_guard<std::mutex> registration_lock(registration_mutex);
323 std::vector<ActorId> actor_id_list;
324 for (auto &actor : actor_list) {
325 alsm.RemoveActor(actor->GetId(), true);
326 }
327}
328
329void TrafficManagerLocal::SetPercentageSpeedDifference(const ActorPtr &actor, const float percentage) {
330 parameters.SetPercentageSpeedDifference(actor, percentage);
331}
332
336
337void TrafficManagerLocal::SetLaneOffset(const ActorPtr &actor, const float offset) {
338 parameters.SetLaneOffset(actor, offset);
339}
340
344
345void TrafficManagerLocal::SetDesiredSpeed(const ActorPtr &actor, const float value) {
346 parameters.SetDesiredSpeed(actor, value);
347}
348
349/// Method to set the automatic management of the vehicle lights
350void TrafficManagerLocal::SetUpdateVehicleLights(const ActorPtr &actor, const bool do_update) {
351 parameters.SetUpdateVehicleLights(actor, do_update);
352}
353
354void TrafficManagerLocal::SetCollisionDetection(const ActorPtr &reference_actor, const ActorPtr &other_actor, const bool detect_collision) {
355 parameters.SetCollisionDetection(reference_actor, other_actor, detect_collision);
356}
357
358void TrafficManagerLocal::SetForceLaneChange(const ActorPtr &actor, const bool direction) {
359 parameters.SetForceLaneChange(actor, direction);
360}
361
362void TrafficManagerLocal::SetAutoLaneChange(const ActorPtr &actor, const bool enable) {
363 parameters.SetAutoLaneChange(actor, enable);
364}
365
366void TrafficManagerLocal::SetDistanceToLeadingVehicle(const ActorPtr &actor, const float distance) {
368}
369
373
374void TrafficManagerLocal::SetPercentageIgnoreWalkers(const ActorPtr &actor, const float perc) {
376}
377
378void TrafficManagerLocal::SetPercentageIgnoreVehicles(const ActorPtr &actor, const float perc) {
380}
381
382void TrafficManagerLocal::SetPercentageRunningLight(const ActorPtr &actor, const float perc) {
384}
385
386void TrafficManagerLocal::SetPercentageRunningSign(const ActorPtr &actor, const float perc) {
388}
389
390void TrafficManagerLocal::SetKeepRightPercentage(const ActorPtr &actor, const float percentage) {
391 parameters.SetKeepRightPercentage(actor, percentage);
392}
393
394void TrafficManagerLocal::SetRandomLeftLaneChangePercentage(const ActorPtr &actor, const float percentage) {
396}
397
398void TrafficManagerLocal::SetRandomRightLaneChangePercentage(const ActorPtr &actor, const float percentage) {
400}
401
402void TrafficManagerLocal::SetHybridPhysicsMode(const bool mode_switch) {
403 parameters.SetHybridPhysicsMode(mode_switch);
404}
405
409
410void TrafficManagerLocal::SetOSMMode(const bool mode_switch) {
411 parameters.SetOSMMode(mode_switch);
412}
413
414void TrafficManagerLocal::SetCustomPath(const ActorPtr &actor, const Path path, const bool empty_buffer) {
415 parameters.SetCustomPath(actor, path, empty_buffer);
416}
417
418void TrafficManagerLocal::RemoveUploadPath(const ActorId &actor_id, const bool remove_path) {
419 parameters.RemoveUploadPath(actor_id, remove_path);
420}
421
422void TrafficManagerLocal::UpdateUploadPath(const ActorId &actor_id, const Path path) {
423 parameters.UpdateUploadPath(actor_id, path);
424}
425
426void TrafficManagerLocal::SetImportedRoute(const ActorPtr &actor, const Route route, const bool empty_buffer) {
427 parameters.SetImportedRoute(actor, route, empty_buffer);
428}
429
430void TrafficManagerLocal::RemoveImportedRoute(const ActorId &actor_id, const bool remove_path) {
431 parameters.RemoveImportedRoute(actor_id, remove_path);
432}
433
434void TrafficManagerLocal::UpdateImportedRoute(const ActorId &actor_id, const Route route) {
435 parameters.UpdateImportedRoute(actor_id, route);
436}
437
440}
441
442void TrafficManagerLocal::SetBoundariesRespawnDormantVehicles(const float lower_bound, const float upper_bound) {
443 parameters.SetBoundariesRespawnDormantVehicles(lower_bound, upper_bound);
444}
445
446void TrafficManagerLocal::SetMaxBoundaries(const float lower, const float upper) {
447 parameters.SetMaxBoundaries(lower, upper);
448}
449
453
457
459 for (auto &elem : tl_to_freeze) {
460 if (!elem->IsFrozen() || elem->GetState() != TLS::Red) {
461 return false;
462 }
463 }
464 return true;
465}
466
468 const bool previous_mode = parameters.GetSynchronousMode();
470 if (previous_mode && !mode) {
471 step_begin.store(true);
472 step_begin_trigger.notify_one();
473 }
474}
475
479
483
487
493
494} // namespace traffic_manager
495} // namespace carla
std::size_t frame
Number of frames elapsed since the simulator was launched.
Definition Timestamp.h:30
const Timestamp & GetTimestamp() const
Get timestamp of this snapshot.
WorldSnapshot GetSnapshot() const
Return a snapshot of the world at this moment.
Definition World.cpp:103
void ResetAllTrafficLights()
Definition World.cpp:225
SharedPtr< Map > GetMap() const
Return the map that describes this world.
Definition World.cpp:24
SharedPtrType Lock() const
Same as TryLock but never return nullptr.
ALSM: Agent Lifecycle and State Managerment This class has functionality to update the local cache of...
Definition ALSM.h:41
void RemoveActor(const ActorId actor_id, const bool registered_actor)
Definition ALSM.cpp:367
void Insert(std::vector< ActorPtr > actor_list)
This class has functionality to detect potential collision with a nearby actor.
void Update(const unsigned long index) override
This class has functionality to maintain a horizon of waypoints ahead of the vehicle for it to follow...
ActionBuffer ComputeActionBuffer(const ActorId &actor_id)
Action ComputeNextAction(const ActorId &actor_id)
void Update(const unsigned long index) override
void Update(const unsigned long index)
void SetLaneOffset(const ActorPtr &actor, const float offset)
Method to set a lane offset displacement from the center line.
void SetImportedRoute(const ActorPtr &actor, const Route route, const bool empty_buffer)
Method to set our own imported route.
void SetHybridPhysicsRadius(const float radius)
Method to set hybrid physics radius.
void UpdateUploadPath(const ActorId &actor_id, const Path path)
Method to update an already set list of points.
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.
void UpdateImportedRoute(const ActorId &actor_id, const Route route)
Method to update an already set route.
void SetGlobalLaneOffset(float const offset)
Method to set a global lane offset displacement from the center line.
void SetDistanceToLeadingVehicle(const ActorPtr &actor, const float distance)
Method to specify how much distance a vehicle should maintain to the leading vehicle.
void SetForceLaneChange(const ActorPtr &actor, const bool direction)
Method to force lane change on a vehicle.
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.
void RemoveImportedRoute(const ActorId &actor_id, const bool remove_path)
Method to remove a route.
void SetPercentageIgnoreVehicles(const ActorPtr &actor, const float perc)
Method to set % to ignore any vehicle.
void SetKeepRightPercentage(const ActorPtr &actor, const float percentage)
Method to set % to keep on the right lane.
void SetMaxBoundaries(const float lower, const float upper)
Method to set limits for boundaries when respawning vehicles.
void SetSynchronousModeTimeOutInMiliSecond(const double time)
Set Synchronous mode time out.
void SetHybridPhysicsMode(const bool mode_switch)
Method to set hybrid physics mode.
void SetCollisionDetection(const ActorPtr &reference_actor, const ActorPtr &other_actor, const bool detect_collision)
Method to set collision detection rules between vehicles.
void SetPercentageRunningLight(const ActorPtr &actor, const float perc)
Method to set % to run any traffic light.
void SetRespawnDormantVehicles(const bool mode_switch)
Method to set if we are automatically respawning vehicles.
void SetAutoLaneChange(const ActorPtr &actor, const bool enable)
Enable/disable automatic lane change on a 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.
void SetPercentageIgnoreWalkers(const ActorPtr &actor, const float perc)
Method to set % to ignore any vehicle.
void SetBoundariesRespawnDormantVehicles(const float lower_bound, const float upper_bound)
Method to set boundaries for respawning vehicles.
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.
void SetOSMMode(const bool mode_switch)
Method to set Open Street Map mode.
bool GetHybridPhysicsMode() const
Method to retrieve hybrid physics mode.
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.
This class has functionality for responding to traffic lights and managing entry into non-signalized ...
void Update(const unsigned long index) override
The function of this class is to integrate all the various stages of the traffic manager appropriatel...
int registered_vehicles_state
State counter to track changes in registered actors.
LocalizationStage localization_stage
Various stages representing core operations of traffic manager.
std::mutex step_execution_mutex
Mutex for progressing synchronous execution.
TimePoint previous_update_instance
Time instance used to calculate dt in asynchronous mode.
void SetDistanceToLeadingVehicle(const ActorPtr &actor, const float distance)
Method to specify how much distance a vehicle should maintain to the leading vehicle.
void SetLaneOffset(const ActorPtr &actor, const float offset)
Method to set a lane offset displacement from the center line.
AtomicActorSet registered_vehicles
Set of all actors registered with traffic manager.
void Reset()
To reset the traffic manager.
std::unique_ptr< std::thread > worker_thread
Single worker thread for sequential execution of sub-components.
void SetRespawnDormantVehicles(const bool mode_switch)
Method to set automatic respawn of dormant vehicles.
void SetRandomLeftLaneChangePercentage(const ActorPtr &actor, const float percentage)
Method to set % to randomly do a left lane change.
void SetGlobalPercentageSpeedDifference(float const percentage)
Method to set a global % decrease in velocity with respect to the speed limit.
void SetupLocalMap()
Method to setup InMemoryMap.
carla::client::detail::EpisodeProxy & GetEpisodeProxy()
Get CARLA episode information.
std::condition_variable step_begin_trigger
Condition variables for progressing synchronous execution.
ControlFrame control_frame
Array to hold output data of motion planning.
Parameters parameters
Parameterization object.
std::vector< ActorId > vehicle_id_list
List of vehicles registered with the traffic manager in current update cycle.
bool CheckAllFrozen(TLGroup tl_to_freeze)
Method to check if all traffic lights are frozen in a group.
void UpdateImportedRoute(const ActorId &actor_id, const Route route)
Method to update an already set route.
void SetRandomRightLaneChangePercentage(const ActorPtr &actor, const float percentage)
Method to set % to randomly do a right lane change.
void SetPercentageIgnoreVehicles(const ActorPtr &actor, const float perc)
Method to specify the % chance of ignoring collisions with any vehicle.
BufferMap buffer_map
Structures to hold waypoint buffers for all vehicles.
void SetForceLaneChange(const ActorPtr &actor, const bool direction)
Method to force lane change on a vehicle.
void RemoveImportedRoute(const ActorId &actor_id, const bool remove_path)
Method to remove a route.
void SetBoundariesRespawnDormantVehicles(const float lower_bound, const float upper_bound)
Method to set boundaries to respawn of dormant vehicles.
TrackTraffic track_traffic
Object for tracking paths of the traffic vehicles.
Action GetNextAction(const ActorId &actor_id)
Method to get the vehicle's next action.
void UpdateUploadPath(const ActorId &actor_id, const Path path)
Method to update an already set list of points.
CollisionFrame collision_frame
Array to hold output data of collision avoidance.
void SetHybridPhysicsMode(const bool mode_switch)
Method to set hybrid physics mode.
void SetCustomPath(const ActorPtr &actor, const Path path, const bool empty_buffer)
Method to set our own imported path.
void Run()
Initiates thread to run the TrafficManager sequentially.
TLFrame tl_frame
Array to hold output data of traffic light response.
TrafficManagerLocal(std::vector< float > longitudinal_PID_parameters, std::vector< float > longitudinal_highway_PID_parameters, std::vector< float > lateral_PID_parameters, std::vector< float > lateral_highway_PID_parameters, float perc_decrease_from_limit, cc::detail::EpisodeProxy &episode_proxy, uint16_t &RPCportTM)
Private constructor for singleton lifecycle management.
void SetPercentageRunningLight(const ActorPtr &actor, const float perc)
Method to specify the % chance of running any traffic light.
uint64_t current_reserved_capacity
Variable to keep track of currently reserved array space for frames.
LocalizationFrame localization_frame
Array to hold output data of localization stage.
void SetPercentageRunningSign(const ActorPtr &actor, const float perc)
Method to specify the % chance of running any traffic sign.
void SetCollisionDetection(const ActorPtr &reference_actor, const ActorPtr &other_actor, const bool detect_collision)
Method to set collision detection rules between vehicles.
void SetOSMMode(const bool mode_switch)
Method to set Open Street Map mode.
ActionBuffer GetActionBuffer(const ActorId &actor_id)
Method to get the vehicle's action buffer.
cc::World world
CARLA client and object.
bool SynchronousTick()
Method to provide synchronous tick.
void SetKeepRightPercentage(const ActorPtr &actor, const float percentage)
Method to set % to keep on the right lane.
std::vector< ActorId > GetRegisteredVehiclesIDs()
Get list of all registered vehicles.
void SetImportedRoute(const ActorPtr &actor, const Route route, const bool empty_buffer)
Method to set our own imported route.
LocalMapPtr local_map
Pointer to local map cache.
void SetMaxBoundaries(const float lower, const float upper)
Method to set limits for boundaries when respawning dormant vehicles.
void SetPercentageSpeedDifference(const ActorPtr &actor, const float percentage)
Method to set a vehicle's % decrease in velocity with respect to the speed limit.
void SetGlobalLaneOffset(float const offset)
Method to set a global lane offset displacement from the center line.
void SetDesiredSpeed(const ActorPtr &actor, const float value)
Set a vehicle's exact desired velocity.
void SetAutoLaneChange(const ActorPtr &actor, const bool enable)
Enable/disable automatic lane change on a vehicle.
carla::client::detail::EpisodeProxy episode_proxy
CARLA client connection object.
void SetGlobalDistanceToLeadingVehicle(const float distance)
Method to specify how much distance a vehicle should maintain to the Global leading vehicle.
std::atomic< bool > run_traffic_manger
Switch to turn on / turn off traffic manager.
RandomGenerator random_device
Structure holding random devices per vehicle.
SimulationState simulation_state
Type containing the current state of all actors involved in the simulation.
void RemoveUploadPath(const ActorId &actor_id, const bool remove_path)
Method to remove a list of points.
void SetPercentageIgnoreWalkers(const ActorPtr &actor, const float perc)
Method to specify the % chance of ignoring collisions with any walker.
void SetUpdateVehicleLights(const ActorPtr &actor, const bool do_update)
Method to set the automatic management of the vehicle lights
void RegisterVehicles(const std::vector< ActorPtr > &actor_list)
This method registers a vehicle with the traffic manager.
void UnregisterVehicles(const std::vector< ActorPtr > &actor_list)
This method unregisters a vehicle from traffic manager.
std::atomic< bool > step_begin
Flags to signal step begin and end.
void SetSynchronousMode(bool mode)
Method to switch traffic manager into synchronous execution.
void SetHybridPhysicsRadius(const float radius)
Method to set hybrid physics radius.
void Release()
To release the traffic manager.
void SetRandomDeviceSeed(const uint64_t _seed)
Method to set randomization seed.
std::mutex registration_mutex
Mutex to prevent vehicle registration during frame array re-allocation.
void SetSynchronousModeTimeOutInMiliSecond(double time)
Method to set Tick timeout for synchronous execution.
This class has functionality for turning on/off the vehicle lights according to the current vehicle s...
void Update(const unsigned long index) override
carla::SharedPtr< cc::Actor > ActorPtr
std::vector< uint8_t > Route
std::vector< cg::Location > Path
std::vector< Action > ActionBuffer
std::pair< RoadOption, WaypointPtr > Action
chr::time_point< chr::system_clock, chr::nanoseconds > TimePoint
std::vector< carla::SharedPtr< carla::client::TrafficLight > > TLGroup
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133
static void log_warning(Args &&... args)
Definition Logging.h:96
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
Definition Memory.h:20