CARLA
 
载入中...
搜索中...
未找到
LocalizationStage.h
浏览该文件的文档.
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;
48
50 const cg::Location vehicle_location,
51 const float vehicle_speed,
52 bool force, bool direction);
53
54 void ExtendAndFindSafeSpace(const ActorId actor_id,
55 const bool is_at_junction_entrance,
56 Buffer &waypoint_buffer);
57
58 void ImportPath(Path &imported_path,
59 Buffer &waypoint_buffer,
60 const ActorId actor_id,
61 const float horizon_square);
62
63 void ImportRoute(Route &imported_actions,
64 Buffer &waypoint_buffer,
65 const ActorId actor_id,
66 const float horizon_square);
67
68public:
69 LocalizationStage(const std::vector<ActorId> &vehicle_id_list,
75 std::vector<ActorId>& marked_for_removal,
78
79 void Update(const unsigned long index) override;
80
81 void RemoveActor(const ActorId actor_id) override;
82
83 void Reset() override;
84
85 Action ComputeNextAction(const ActorId &actor_id);
86
88
89};
90
91} // namespace traffic_manager
92} // 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)
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, RandomGenerator &random_device)
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
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::pair< SimpleWaypointPtr, SimpleWaypointPtr > SimpleWaypointPair
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::vector< uint8_t > Route
std::vector< cg::Location > Path
std::unordered_map< ActorId, SimpleWaypointPtr > LaneChangeSWptMap
std::vector< Action > ActionBuffer
std::deque< std::shared_ptr< SimpleWaypoint > > Buffer
std::shared_ptr< InMemoryMap > LocalMapPtr
Definition ALSM.h:36
std::shared_ptr< SimpleWaypoint > SimpleWaypointPtr
std::pair< RoadOption, WaypointPtr > Action
std::unordered_set< ActorId > ActorIdSet
std::vector< LocalizationData > LocalizationFrame
std::unordered_map< carla::ActorId, Buffer > BufferMap
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133
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