This class has functionality for responding to traffic lights and managing entry into non-signalized junctions. More...
#include <TrafficLightStage.h>
Public Member Functions | |
void | RemoveActor (const ActorId actor_id) override |
void | Reset () override |
TrafficLightStage (const std::vector< ActorId > &vehicle_id_list, const SimulationState &Simulation_state, const BufferMap &buffer_map, const Parameters ¶meters, const cc::World &world, TLFrame &output_array, RandomGenerator &random_device) | |
void | Update (const unsigned long index) override |
Private Member Functions | |
void | AddActorToNonSignalisedJunction (const ActorId ego_actor_id, const JunctionID junction_id) |
Initialized the vehicle to the non-signalized junction maps. More... | |
JunctionID | GetAffectedJunctionId (const ActorId ego_actor_id) |
Get current affected junction id for the vehicle. More... | |
bool | HandleNonSignalisedJunction (const ActorId ego_actor_id, const JunctionID junction_id, cc::Timestamp timestamp) |
This controls all vehicle's interactions at non signalized junctions. More... | |
Private Member Functions inherited from carla::traffic_manager::Stage | |
Stage () | |
Stage (const Stage &) | |
virtual | ~Stage () |
Private Attributes | |
const BufferMap & | buffer_map |
cc::Timestamp | current_timestamp |
std::unordered_map< JunctionID, std::deque< ActorId > > | entering_vehicles_map |
Variables used to handle non signalized junctions. More... | |
TLFrame & | output_array |
const Parameters & | parameters |
RandomGenerator & | random_device |
const SimulationState & | simulation_state |
const std::vector< ActorId > & | vehicle_id_list |
std::unordered_map< ActorId, JunctionID > | vehicle_last_junction |
Map linking the vehicles with their current junction. Used for easy access to the previous two maps. More... | |
std::unordered_map< ActorId, cc::Timestamp > | vehicle_stop_time |
Map containing the timestamp at which the actor first stopped at a stop sign. More... | |
const cc::World & | world |
This class has functionality for responding to traffic lights and managing entry into non-signalized junctions.
Definition at line 15 of file TrafficLightStage.h.
carla::traffic_manager::TrafficLightStage::TrafficLightStage | ( | const std::vector< ActorId > & | vehicle_id_list, |
const SimulationState & | Simulation_state, | ||
const BufferMap & | buffer_map, | ||
const Parameters & | parameters, | ||
const cc::World & | world, | ||
TLFrame & | output_array, | ||
RandomGenerator & | random_device | ||
) |
Definition at line 15 of file TrafficLightStage.cpp.
|
private |
Initialized the vehicle to the non-signalized junction maps.
Definition at line 83 of file TrafficLightStage.cpp.
References entering_vehicles_map, RemoveActor(), and vehicle_last_junction.
Referenced by Update().
|
private |
Get current affected junction id for the vehicle.
Definition at line 132 of file TrafficLightStage.cpp.
References buffer_map, carla::traffic_manager::GetTargetWaypoint(), carla::traffic_manager::constants::WaypointSelection::JUNCTION_LOOK_AHEAD, and vehicle_last_junction.
Referenced by Update().
|
private |
This controls all vehicle's interactions at non signalized junctions.
Priorities are done by order of arrival and no two vehicle will enter the junction at the same time. Only once it is exiting can the next one enter. Additionally, all vehicles will always brake at the stop sign for a set amount of time.
Definition at line 104 of file TrafficLightStage.cpp.
References carla::client::Timestamp::elapsed_seconds, entering_vehicles_map, carla::traffic_manager::constants::MotionPlan::EPSILON_RELATIVE_SPEED, carla::traffic_manager::SimulationState::GetVelocity(), carla::geom::Vector3D::Length(), carla::traffic_manager::constants::TrafficLight::MINIMUM_STOP_TIME, simulation_state, and vehicle_stop_time.
Referenced by Update().
|
overridevirtual |
Implements carla::traffic_manager::Stage.
Definition at line 169 of file TrafficLightStage.cpp.
References entering_vehicles_map, vehicle_last_junction, and vehicle_stop_time.
Referenced by AddActorToNonSignalisedJunction(), carla::traffic_manager::ALSM::RemoveActor(), and Update().
|
overridevirtual |
Implements carla::traffic_manager::Stage.
Definition at line 187 of file TrafficLightStage.cpp.
References entering_vehicles_map, vehicle_last_junction, and vehicle_stop_time.
Referenced by carla::traffic_manager::TrafficManagerLocal::Stop().
|
overridevirtual |
Implements carla::traffic_manager::Stage.
Definition at line 31 of file TrafficLightStage.cpp.
References AddActorToNonSignalisedJunction(), carla::traffic_manager::TrafficLightState::at_traffic_light, current_timestamp, GetAffectedJunctionId(), carla::traffic_manager::Parameters::GetPercentageRunningLight(), carla::traffic_manager::Parameters::GetPercentageRunningSign(), carla::client::World::GetSnapshot(), carla::client::WorldSnapshot::GetTimestamp(), carla::traffic_manager::SimulationState::GetTLS(), carla::rpc::Green, HandleNonSignalisedJunction(), carla::traffic_manager::SimulationState::IsDormant(), carla::traffic_manager::RandomGenerator::next(), output_array, parameters, random_device, RemoveActor(), simulation_state, carla::traffic_manager::TrafficLightState::tl_state, vehicle_id_list, vehicle_last_junction, and world.
Referenced by carla::traffic_manager::TrafficManagerLocal::Run().
|
private |
Definition at line 19 of file TrafficLightStage.h.
Referenced by GetAffectedJunctionId().
|
private |
Definition at line 33 of file TrafficLightStage.h.
Referenced by Update().
|
private |
Variables used to handle non signalized junctions.
Map containing the vehicles entering a specific junction, ordered by time of arrival.
Definition at line 26 of file TrafficLightStage.h.
Referenced by AddActorToNonSignalisedJunction(), HandleNonSignalisedJunction(), RemoveActor(), and Reset().
|
private |
Definition at line 31 of file TrafficLightStage.h.
Referenced by Update().
|
private |
Definition at line 20 of file TrafficLightStage.h.
Referenced by Update().
|
private |
Definition at line 32 of file TrafficLightStage.h.
Referenced by Update().
|
private |
Definition at line 18 of file TrafficLightStage.h.
Referenced by HandleNonSignalisedJunction(), and Update().
|
private |
Definition at line 17 of file TrafficLightStage.h.
Referenced by Update().
|
private |
Map linking the vehicles with their current junction. Used for easy access to the previous two maps.
Definition at line 28 of file TrafficLightStage.h.
Referenced by AddActorToNonSignalisedJunction(), GetAffectedJunctionId(), RemoveActor(), Reset(), and Update().
|
private |
Map containing the timestamp at which the actor first stopped at a stop sign.
Definition at line 30 of file TrafficLightStage.h.
Referenced by HandleNonSignalisedJunction(), RemoveActor(), and Reset().
|
private |
Definition at line 21 of file TrafficLightStage.h.
Referenced by Update().