CARLA
Loading...
Searching...
No Matches
LocalizationStage.h
Go to the documentation of this file.
1
2#pragma once
3
4#include <memory>
5
14
15namespace carla {
16namespace traffic_manager {
17
18namespace cc = carla::client;
19
20using LocalMapPtr = std::shared_ptr<InMemoryMap>;
21using LaneChangeSWptMap = std::unordered_map<ActorId, SimpleWaypointPtr>;
23using Action = std::pair<RoadOption, WaypointPtr>;
24using ActionBuffer = std::vector<Action>;
25using Path = std::vector<cg::Location>;
26using Route = std::vector<uint8_t>;
27
28/// This class has functionality to maintain a horizon of waypoints ahead
29/// of the vehicle for it to follow.
30/// The class is also responsible for managing lane change decisions and
31/// modify the waypoint trajectory appropriately.
33private:
34 const std::vector<ActorId> &vehicle_id_list;
40 // Array of vehicles marked by stages for removal.
41 std::vector<ActorId>& marked_for_removal;
45 using SimpleWaypointPair = std::pair<SimpleWaypointPtr, SimpleWaypointPtr>;
46 std::unordered_map<ActorId, SimpleWaypointPair> vehicles_at_junction_entrance;
47 std::unordered_set<ActorId> large_vehicles_at_junction_entrance;
48 std::unordered_set<ActorId> large_vehicles_at_junction;
50 std::unordered_map<ActorId, std::pair<float, bool>> &large_vehicles;
51
53 const cg::Location vehicle_location,
54 const float vehicle_speed,
55 bool force, bool direction);
56
57 void ExtendAndFindSafeSpace(const ActorId actor_id,
58 const bool is_at_junction_entrance,
59 Buffer &waypoint_buffer);
60
62 const ActorId actor_id,
63 const bool is_at_junction_entrance,
64 Buffer &waypoint_buffer);
65
66 void ImportPath(Path &imported_path,
67 Buffer &waypoint_buffer,
68 const ActorId actor_id,
69 const float horizon_square);
70
71 void ImportRoute(Route &imported_actions,
72 Buffer &waypoint_buffer,
73 const ActorId actor_id,
74 const float horizon_square);
75
76public:
77 LocalizationStage(const std::vector<ActorId> &vehicle_id_list,
82 std::unordered_map<ActorId, std::pair<float, bool>> &large_vehicles,
84 std::vector<ActorId>& marked_for_removal,
87
88 void Update(const unsigned long index) override;
89
90 void RemoveActor(const ActorId actor_id) override;
91
92 void Reset() override;
93
94 Action ComputeNextAction(const ActorId &actor_id);
95
97
98};
99
100} // namespace traffic_manager
101} // namespace carla
This class has functionality to maintain a horizon of waypoints ahead of the vehicle for it to follow...
ActionBuffer ComputeActionBuffer(const ActorId &actor_id)
void ImportRoute(Route &imported_actions, Buffer &waypoint_buffer, const ActorId actor_id, const float horizon_square)
std::unordered_set< ActorId > large_vehicles_at_junction
void ImportPath(Path &imported_path, Buffer &waypoint_buffer, const ActorId actor_id, const float horizon_square)
void ExtendAndFindSafeSpace(const ActorId actor_id, const bool is_at_junction_entrance, Buffer &waypoint_buffer)
Action ComputeNextAction(const ActorId &actor_id)
std::unordered_map< ActorId, SimpleWaypointPair > vehicles_at_junction_entrance
const std::vector< ActorId > & vehicle_id_list
void HandleLargeVehicleJunction(const ActorId actor_id, const bool is_at_junction_entrance, Buffer &waypoint_buffer)
SimpleWaypointPtr AssignLaneChange(const ActorId actor_id, const cg::Location vehicle_location, const float vehicle_speed, bool force, bool direction)
void Update(const unsigned long index) override
void RemoveActor(const ActorId actor_id) override
std::unordered_map< ActorId, std::pair< float, bool > > & large_vehicles
std::pair< SimpleWaypointPtr, SimpleWaypointPtr > SimpleWaypointPair
std::unordered_set< ActorId > large_vehicles_at_junction_entrance
This class holds the state of all the vehicles in the simlation.
Stage type interface.
Definition Stage.h:12
carla::SharedPtr< cc::Waypoint > WaypointPtr
Definition InMemoryMap.h:45
std::deque< std::shared_ptr< SimpleWaypoint > > Buffer
std::shared_ptr< InMemoryMap > LocalMapPtr
Definition ALSM.h:38
std::unordered_set< ActorId > ActorIdSet
std::vector< uint8_t > Route
std::unordered_map< carla::ActorId, Buffer > BufferMap
std::vector< cg::Location > Path
std::unordered_map< ActorId, SimpleWaypointPtr > LaneChangeSWptMap
std::pair< RoadOption, WaypointPtr > Action
std::vector< Action > ActionBuffer
std::vector< LocalizationData > LocalizationFrame
std::shared_ptr< SimpleWaypoint > SimpleWaypointPtr
This file contains definitions of common data structures used in traffic manager.
std::shared_ptr< T > SharedPtr
Definition Memory.h:15