CARLA
LocalizationStage.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <memory>
5 
7 
16 
17 namespace carla {
18 namespace traffic_manager {
19 
20 namespace cc = carla::client;
21 
22 using LocalMapPtr = std::shared_ptr<InMemoryMap>;
23 using LaneChangeLocationMap = std::unordered_map<ActorId, cg::Location>;
24 
25 /// This class has functionality to maintain a horizon of waypoints ahead
26 /// of the vehicle for it to follow.
27 /// The class is also responsible for managing lane change decisions and
28 /// modify the waypoint trajectory appropriately.
30 private:
31  const std::vector<ActorId> &vehicle_id_list;
37  // Array of vehicles marked by stages for removal.
38  std::vector<ActorId>& marked_for_removal;
43  using SimpleWaypointPair = std::pair<SimpleWaypointPtr, SimpleWaypointPtr>;
44  std::unordered_map<ActorId, SimpleWaypointPair> vehicles_at_junction_entrance;
46 
48  const cg::Location vehicle_location,
49  const float vehicle_speed,
50  bool force, bool direction);
51 
52  void DrawBuffer(Buffer &buffer);
53 
54  void ExtendAndFindSafeSpace(const ActorId actor_id,
55  const bool is_at_junction_entrance,
56  Buffer &waypoint_buffer);
57 
58 public:
59  LocalizationStage(const std::vector<ActorId> &vehicle_id_list,
60  BufferMap &buffer_map,
61  const SimulationState &simulation_state,
62  TrackTraffic &track_traffic,
63  const LocalMapPtr &local_map,
64  Parameters &parameters,
65  std::vector<ActorId>& marked_for_removal,
66  LocalizationFrame &output_array,
67  cc::DebugHelper &debug_helper,
68  RandomGeneratorMap &random_devices);
69 
70  void Update(const unsigned long index) override;
71 
72  void RemoveActor(const ActorId actor_id) override;
73 
74  void Reset() override;
75 };
76 
77 } // namespace traffic_manager
78 } // namespace carla
std::unordered_map< ActorId, SimpleWaypointPair > vehicles_at_junction_entrance
LocalizationStage(const std::vector< ActorId > &vehicle_id_list, BufferMap &buffer_map, const SimulationState &simulation_state, TrackTraffic &track_traffic, const LocalMapPtr &local_map, Parameters &parameters, std::vector< ActorId > &marked_for_removal, LocalizationFrame &output_array, cc::DebugHelper &debug_helper, RandomGeneratorMap &random_devices)
void ExtendAndFindSafeSpace(const ActorId actor_id, const bool is_at_junction_entrance, Buffer &waypoint_buffer)
std::shared_ptr< InMemoryMap > LocalMapPtr
Definition: ALSM.h:35
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:99
std::unordered_map< carla::rpc::ActorId, RandomGenerator > RandomGeneratorMap
std::unordered_set< ActorId > ActorIdSet
std::deque< std::shared_ptr< SimpleWaypoint > > Buffer
const std::vector< ActorId > & vehicle_id_list
SimpleWaypointPtr AssignLaneChange(const ActorId actor_id, const cg::Location vehicle_location, const float vehicle_speed, bool force, bool direction)
std::unordered_map< carla::ActorId, Buffer > BufferMap
carla::ActorId ActorId
void RemoveActor(const ActorId actor_id) override
void Update(const unsigned long index) override
Stage type interface.
Definition: Stage.h:12
std::vector< LocalizationData > LocalizationFrame
std::shared_ptr< SimpleWaypoint > SimpleWaypointPtr
std::unordered_map< ActorId, cg::Location > LaneChangeLocationMap
std::pair< SimpleWaypointPtr, SimpleWaypointPtr > SimpleWaypointPair
This class has functionality to maintain a horizon of waypoints ahead of the vehicle for it to follow...