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