CARLA
 
载入中...
搜索中...
未找到
MotionPlanStage.h
浏览该文件的文档.
1
2/// This file has functionality for motion planning based on information
3/// from localization, collision avoidance and traffic light response.
4
5#pragma once
6
15
16namespace carla {
17namespace traffic_manager {
18
19using LocalMapPtr = std::shared_ptr<InMemoryMap>;
20using TLMap = std::unordered_map<std::string, SharedPtr<client::Actor>>;
21
23private:
24 const std::vector<ActorId> &vehicle_id_list;
29 // PID paramenters for various road conditions.
30 const std::vector<float> urban_longitudinal_parameters;
31 const std::vector<float> highway_longitudinal_parameters;
32 const std::vector<float> urban_lateral_parameters;
33 const std::vector<float> highway_lateral_parameters;
38 // Structure holding the controller state for registered vehicles.
39 std::unordered_map<ActorId, StateEntry> pid_state_map;
40 // Structure to keep track of duration between teleportation
41 // in hybrid physics mode.
42 std::unordered_map<ActorId, cc::Timestamp> teleportation_instance;
47
48 std::pair<bool, float> CollisionHandling(const CollisionHazardData &collision_hazard,
49 const bool tl_hazard,
50 const cg::Vector3D ego_velocity,
51 const cg::Vector3D ego_heading,
52 const float max_target_velocity);
53
54 bool SafeAfterJunction(const LocalizationData &localization,
55 const bool tl_hazard,
56 const bool collision_emergency_stop);
57
58 float GetLandmarkTargetVelocity(const SimpleWaypoint& waypoint,
59 const cg::Location vehicle_location,
60 const ActorId actor_id,
61 float max_target_velocity);
62
63 float GetTurnTargetVelocity(const Buffer &waypoint_buffer,
64 float max_target_velocity);
65
66 float GetThreePointCircleRadius(cg::Location first_location,
67 cg::Location middle_location,
68 cg::Location last_location);
69
70public:
71 MotionPlanStage(const std::vector<ActorId> &vehicle_id_list,
74 const BufferMap &buffer_map,
76 const std::vector<float> &urban_longitudinal_parameters,
77 const std::vector<float> &highway_longitudinal_parameters,
78 const std::vector<float> &urban_lateral_parameters,
79 const std::vector<float> &highway_lateral_parameters,
82 const TLFrame &tl_frame,
83 const cc::World &world,
86 const LocalMapPtr &local_map);
87
88 void Update(const unsigned long index);
89
90 void RemoveActor(const ActorId actor_id);
91
92 void Reset();
93};
94
95} // namespace traffic_manager
96} // namespace carla
const std::vector< float > urban_longitudinal_parameters
const LocalizationFrame & localization_frame
const std::vector< float > highway_lateral_parameters
std::unordered_map< ActorId, cc::Timestamp > teleportation_instance
float GetThreePointCircleRadius(cg::Location first_location, cg::Location middle_location, cg::Location last_location)
bool SafeAfterJunction(const LocalizationData &localization, const bool tl_hazard, const bool collision_emergency_stop)
void Update(const unsigned long index)
MotionPlanStage(const std::vector< ActorId > &vehicle_id_list, SimulationState &simulation_state, const Parameters &parameters, const BufferMap &buffer_map, TrackTraffic &track_traffic, const std::vector< float > &urban_longitudinal_parameters, const std::vector< float > &highway_longitudinal_parameters, const std::vector< float > &urban_lateral_parameters, const std::vector< float > &highway_lateral_parameters, const LocalizationFrame &localization_frame, const CollisionFrame &collision_frame, const TLFrame &tl_frame, const cc::World &world, ControlFrame &output_array, RandomGenerator &random_device, const LocalMapPtr &local_map)
const std::vector< float > highway_longitudinal_parameters
const std::vector< ActorId > & vehicle_id_list
float GetLandmarkTargetVelocity(const SimpleWaypoint &waypoint, const cg::Location vehicle_location, const ActorId actor_id, float max_target_velocity)
float GetTurnTargetVelocity(const Buffer &waypoint_buffer, float max_target_velocity)
void RemoveActor(const ActorId actor_id)
const std::vector< float > urban_lateral_parameters
std::unordered_map< ActorId, StateEntry > pid_state_map
std::pair< bool, float > CollisionHandling(const CollisionHazardData &collision_hazard, const bool tl_hazard, const cg::Vector3D ego_velocity, const cg::Vector3D ego_heading, const float max_target_velocity)
This is a simple wrapper class on Carla's waypoint object.
This class holds the state of all the vehicles in the simlation.
Stage type interface.
Definition Stage.h:12
std::vector< carla::rpc::Command > ControlFrame
std::vector< bool > TLFrame
std::deque< std::shared_ptr< SimpleWaypoint > > Buffer
std::vector< CollisionHazardData > CollisionFrame
std::shared_ptr< InMemoryMap > LocalMapPtr
Definition ALSM.h:36
std::vector< LocalizationData > LocalizationFrame
std::unordered_map< carla::ActorId, Buffer > BufferMap
std::unordered_map< std::string, SharedPtr< client::Actor > > TLMap
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133