CARLA
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
carla::traffic_manager::LocalizationStage Class Reference

This class has functionality to maintain a horizon of waypoints ahead of the vehicle for it to follow. More...

#include <LocalizationStage.h>

+ Inheritance diagram for carla::traffic_manager::LocalizationStage:
+ Collaboration diagram for carla::traffic_manager::LocalizationStage:

Public Member Functions

 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)
 
void RemoveActor (const ActorId actor_id) override
 
void Reset () override
 
void Update (const unsigned long index) override
 

Private Types

using SimpleWaypointPair = std::pair< SimpleWaypointPtr, SimpleWaypointPtr >
 

Private Member Functions

SimpleWaypointPtr AssignLaneChange (const ActorId actor_id, const cg::Location vehicle_location, const float vehicle_speed, bool force, bool direction)
 
void DrawBuffer (Buffer &buffer)
 
void ExtendAndFindSafeSpace (const ActorId actor_id, const bool is_at_junction_entrance, Buffer &waypoint_buffer)
 
- Private Member Functions inherited from carla::traffic_manager::Stage
 Stage ()
 
 Stage (const Stage &)
 
virtual ~Stage ()
 

Private Attributes

BufferMapbuffer_map
 
LaneChangeLocationMap last_lane_change_location
 
const LocalMapPtrlocal_map
 
std::vector< ActorId > & marked_for_removal
 
LocalizationFrameoutput_array
 
Parametersparameters
 
RandomGeneratorMaprandom_devices
 
const SimulationStatesimulation_state
 
TrackTraffictrack_traffic
 
const std::vector< ActorId > & vehicle_id_list
 
ActorIdSet vehicles_at_junction
 
std::unordered_map< ActorId, SimpleWaypointPairvehicles_at_junction_entrance
 

Detailed Description

This class has functionality to maintain a horizon of waypoints ahead of the vehicle for it to follow.

The class is also responsible for managing lane change decisions and modify the waypoint trajectory appropriately.

Definition at line 27 of file LocalizationStage.h.

Member Typedef Documentation

◆ SimpleWaypointPair

Definition at line 40 of file LocalizationStage.h.

Constructor & Destructor Documentation

◆ LocalizationStage()

carla::traffic_manager::LocalizationStage::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 
)

Definition at line 14 of file LocalizationStage.cpp.

Member Function Documentation

◆ AssignLaneChange()

SimpleWaypointPtr carla::traffic_manager::LocalizationStage::AssignLaneChange ( const ActorId  actor_id,
const cg::Location  vehicle_location,
const float  vehicle_speed,
bool  force,
bool  direction 
)
private

Definition at line 294 of file LocalizationStage.cpp.

References buffer_map, carla::geom::Math::Clamp(), carla::geom::Math::DistanceSquared(), carla::geom::Math::Dot(), carla::traffic_manager::TrackTraffic::GetOverlappingVehicles(), carla::traffic_manager::TrackTraffic::GetPassingVehicles(), carla::traffic_manager::constants::LaneChange::MAXIMUM_LANE_OBSTACLE_CURVATURE, carla::traffic_manager::constants::LaneChange::MAXIMUM_LANE_OBSTACLE_DISTANCE, carla::traffic_manager::constants::LaneChange::MINIMUM_LANE_CHANGE_DISTANCE, SQUARE, and track_traffic.

Referenced by Update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DrawBuffer()

void carla::traffic_manager::LocalizationStage::DrawBuffer ( Buffer buffer)
private

◆ ExtendAndFindSafeSpace()

void carla::traffic_manager::LocalizationStage::ExtendAndFindSafeSpace ( const ActorId  actor_id,
const bool  is_at_junction_entrance,
Buffer waypoint_buffer 
)
private

Definition at line 196 of file LocalizationStage.cpp.

References carla::traffic_manager::constants::WaypointSelection::MIN_JUNCTION_LENGTH, carla::traffic_manager::PushWaypoint(), carla::traffic_manager::constants::WaypointSelection::SAFE_DISTANCE_AFTER_JUNCTION, SQUARE, track_traffic, and vehicles_at_junction_entrance.

Referenced by Update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveActor()

void carla::traffic_manager::LocalizationStage::RemoveActor ( const ActorId  actor_id)
overridevirtual

Implements carla::traffic_manager::Stage.

Definition at line 284 of file LocalizationStage.cpp.

References last_lane_change_location, and vehicles_at_junction.

Referenced by carla::traffic_manager::ALSM::RemoveActor().

+ Here is the caller graph for this function:

◆ Reset()

void carla::traffic_manager::LocalizationStage::Reset ( void  )
overridevirtual

Implements carla::traffic_manager::Stage.

Definition at line 289 of file LocalizationStage.cpp.

References last_lane_change_location, and vehicles_at_junction.

Referenced by carla::traffic_manager::TrafficManagerLocal::Stop().

+ Here is the caller graph for this function:

◆ Update()

void carla::traffic_manager::LocalizationStage::Update ( const unsigned long  index)
overridevirtual

Implements carla::traffic_manager::Stage.

Definition at line 34 of file LocalizationStage.cpp.

References AssignLaneChange(), buffer_map, carla::traffic_manager::ChangeLaneInfo::change_lane, carla::traffic_manager::DeviationDotProduct(), carla::traffic_manager::ChangeLaneInfo::direction, carla::geom::Math::DistanceSquared(), ExtendAndFindSafeSpace(), carla::traffic_manager::Parameters::GetAutoLaneChange(), carla::traffic_manager::Parameters::GetForceLaneChange(), carla::traffic_manager::SimulationState::GetHeading(), carla::traffic_manager::Parameters::GetKeepRightPercentage(), carla::traffic_manager::SimulationState::GetLocation(), carla::traffic_manager::Parameters::GetOSMMode(), carla::traffic_manager::GetTargetWaypoint(), carla::traffic_manager::SimulationState::GetVelocity(), carla::traffic_manager::constants::PathBufferUpdate::HIGH_SPEED_HORIZON_RATE, carla::traffic_manager::constants::SpeedThreshold::HIGHWAY_SPEED, carla::traffic_manager::constants::PathBufferUpdate::HORIZON_RATE, carla::traffic_manager::constants::LaneChange::INTER_LANE_CHANGE_DISTANCE, carla::traffic_manager::LocalizationData::is_at_junction_entrance, carla::traffic_manager::LocalizationData::junction_end_point, carla::traffic_manager::constants::WaypointSelection::JUNCTION_LOOK_AHEAD, last_lane_change_location, carla::geom::Vector3D::Length(), local_map, marked_for_removal, carla::traffic_manager::constants::PathBufferUpdate::MAX_START_DISTANCE, carla::traffic_manager::constants::PathBufferUpdate::MINIMUM_HORIZON_LENGTH, output_array, parameters, carla::traffic_manager::PopWaypoint(), carla::traffic_manager::PushWaypoint(), random_devices, carla::traffic_manager::LocalizationData::safe_point, simulation_state, SQUARE, carla::geom::Vector3D::SquaredLength(), track_traffic, carla::traffic_manager::TrackTraffic::UpdateGridPosition(), vehicle_id_list, and vehicles_at_junction_entrance.

Referenced by carla::traffic_manager::TrafficManagerLocal::Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ buffer_map

BufferMap& carla::traffic_manager::LocalizationStage::buffer_map
private

Definition at line 30 of file LocalizationStage.h.

Referenced by AssignLaneChange(), and Update().

◆ last_lane_change_location

LaneChangeLocationMap carla::traffic_manager::LocalizationStage::last_lane_change_location
private

Definition at line 38 of file LocalizationStage.h.

Referenced by RemoveActor(), Reset(), and Update().

◆ local_map

const LocalMapPtr& carla::traffic_manager::LocalizationStage::local_map
private

Definition at line 33 of file LocalizationStage.h.

Referenced by Update().

◆ marked_for_removal

std::vector<ActorId>& carla::traffic_manager::LocalizationStage::marked_for_removal
private

Definition at line 36 of file LocalizationStage.h.

Referenced by Update().

◆ output_array

LocalizationFrame& carla::traffic_manager::LocalizationStage::output_array
private

Definition at line 37 of file LocalizationStage.h.

Referenced by Update().

◆ parameters

Parameters& carla::traffic_manager::LocalizationStage::parameters
private

Definition at line 34 of file LocalizationStage.h.

Referenced by Update().

◆ random_devices

RandomGeneratorMap& carla::traffic_manager::LocalizationStage::random_devices
private

Definition at line 42 of file LocalizationStage.h.

Referenced by Update().

◆ simulation_state

const SimulationState& carla::traffic_manager::LocalizationStage::simulation_state
private

Definition at line 31 of file LocalizationStage.h.

Referenced by Update().

◆ track_traffic

TrackTraffic& carla::traffic_manager::LocalizationStage::track_traffic
private

Definition at line 32 of file LocalizationStage.h.

Referenced by AssignLaneChange(), ExtendAndFindSafeSpace(), and Update().

◆ vehicle_id_list

const std::vector<ActorId>& carla::traffic_manager::LocalizationStage::vehicle_id_list
private

Definition at line 29 of file LocalizationStage.h.

Referenced by Update().

◆ vehicles_at_junction

ActorIdSet carla::traffic_manager::LocalizationStage::vehicles_at_junction
private

Definition at line 39 of file LocalizationStage.h.

Referenced by RemoveActor(), and Reset().

◆ vehicles_at_junction_entrance

std::unordered_map<ActorId, SimpleWaypointPair> carla::traffic_manager::LocalizationStage::vehicles_at_junction_entrance
private

Definition at line 41 of file LocalizationStage.h.

Referenced by ExtendAndFindSafeSpace(), and Update().


The documentation for this class was generated from the following files: