CARLA
Public Member Functions | Private Member Functions | Private Attributes | List of all members
UTrafficLightController Class Reference

Maps a controller from OpenDrive. More...

#include <TrafficLightController.h>

+ Inheritance diagram for UTrafficLightController:
+ Collaboration diagram for UTrafficLightController:

Public Member Functions

void AddCarlaActorTrafficLight (FCarlaActor *CarlaActor)
 
void AddTrafficLight (UTrafficLightComponent *TrafficLight)
 
bool AdvanceTimeAndCycleFinished (float DeltaTime)
 
void EmptyTrafficLights ()
 
const FString & GetControllerId () const
 
ETrafficLightState GetCurrentLightState () const
 
const FTrafficLightStageGetCurrentState () const
 
float GetElapsedTime () const
 
float GetGreenTime () const
 
ATrafficLightGroupGetGroup ()
 
const ATrafficLightGroupGetGroup () const
 
float GetRedTime () const
 
int GetSequence () const
 
const TArray< UTrafficLightComponent * > & GetTrafficLights ()
 
float GetYellowTime () const
 
bool IsCycleFinished () const
 
float NextState ()
 
void RemoveCarlaActorTrafficLight (FCarlaActor *CarlaActor)
 
void RemoveTrafficLight (UTrafficLightComponent *TrafficLight)
 
void ResetState ()
 
void SetControllerId (const FString &Id)
 
void SetCurrentLightState (ETrafficLightState NewState)
 
void SetElapsedTime (float InElapsedTime)
 
void SetGreenTime (float NewTime)
 
void SetGroup (ATrafficLightGroup *Group)
 
void SetRedTime (float NewTime)
 
void SetSequence (int InSequence)
 
void SetStates (TArray< FTrafficLightStage > States)
 
void SetTrafficLightsState (ETrafficLightState NewState)
 
void SetYellowTime (float NewTime)
 
void StartCycle ()
 
 UTrafficLightController ()
 

Private Member Functions

float GetStateTime (const ETrafficLightState State) const
 
void SetStateTime (const ETrafficLightState State, float NewTime)
 

Private Attributes

FString ControllerId = ""
 
ETrafficLightState CurrentLightState = ETrafficLightState::Green
 
int CurrentState = 0
 
float ElapsedTime = 0
 
TArray< FTrafficLightStageLightStates
 
int Sequence = 0
 
TArray< FCarlaActor * > TrafficLightCarlaActors
 
ATrafficLightGroupTrafficLightGroup
 
TArray< UTrafficLightComponent * > TrafficLights
 

Detailed Description

Maps a controller from OpenDrive.

Controls the asociated traffic lights and contains its cycles

Definition at line 36 of file TrafficLightController.h.

Constructor & Destructor Documentation

◆ UTrafficLightController()

UTrafficLightController::UTrafficLightController ( )

Definition at line 9 of file TrafficLightController.cpp.

Member Function Documentation

◆ AddCarlaActorTrafficLight()

void UTrafficLightController::AddCarlaActorTrafficLight ( FCarlaActor CarlaActor)

Definition at line 77 of file TrafficLightController.cpp.

References TrafficLightCarlaActors.

◆ AddTrafficLight()

void UTrafficLightController::AddTrafficLight ( UTrafficLightComponent *  TrafficLight)

Definition at line 66 of file TrafficLightController.cpp.

References TrafficLights.

Referenced by ATrafficLightManager::RegisterLightComponentFromOpenDRIVE().

+ Here is the caller graph for this function:

◆ AdvanceTimeAndCycleFinished()

bool UTrafficLightController::AdvanceTimeAndCycleFinished ( float  DeltaTime)

Definition at line 32 of file TrafficLightController.cpp.

References ElapsedTime, GetCurrentState(), IsCycleFinished(), and NextState().

Referenced by ATrafficLightGroup::Tick().

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

◆ EmptyTrafficLights()

void UTrafficLightController::EmptyTrafficLights ( )

Definition at line 60 of file TrafficLightController.cpp.

References TrafficLightCarlaActors, and TrafficLights.

◆ GetControllerId()

const FString & UTrafficLightController::GetControllerId ( ) const

Definition at line 87 of file TrafficLightController.cpp.

References ControllerId.

◆ GetCurrentLightState()

ETrafficLightState UTrafficLightController::GetCurrentLightState ( ) const
inline

Definition at line 128 of file TrafficLightController.h.

◆ GetCurrentState()

const FTrafficLightStage & UTrafficLightController::GetCurrentState ( ) const

Definition at line 20 of file TrafficLightController.cpp.

References CurrentState, and LightStates.

Referenced by AdvanceTimeAndCycleFinished(), NextState(), ResetState(), and StartCycle().

+ Here is the caller graph for this function:

◆ GetElapsedTime()

float UTrafficLightController::GetElapsedTime ( ) const

Definition at line 185 of file TrafficLightController.cpp.

References ElapsedTime.

Referenced by FFrameData::AddTrafficLightState(), ACarlaRecorder::AddTrafficLightState(), and FWorldObserver_GetActorState().

+ Here is the caller graph for this function:

◆ GetGreenTime()

float UTrafficLightController::GetGreenTime ( ) const

Definition at line 147 of file TrafficLightController.cpp.

References GetStateTime().

Referenced by FWorldObserver_GetActorState().

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

◆ GetGroup() [1/2]

ATrafficLightGroup * UTrafficLightController::GetGroup ( )

Definition at line 200 of file TrafficLightController.cpp.

References TrafficLightGroup.

Referenced by FFrameData::AddTrafficLightState(), ACarlaRecorder::AddTrafficLightState(), CarlaReplayerHelper::ProcessReplayerStateTrafficLight(), and FFrameData::ProcessReplayerStateTrafficLight().

+ Here is the caller graph for this function:

◆ GetGroup() [2/2]

const ATrafficLightGroup * UTrafficLightController::GetGroup ( ) const

Definition at line 205 of file TrafficLightController.cpp.

References TrafficLightGroup.

◆ GetRedTime()

float UTrafficLightController::GetRedTime ( ) const

Definition at line 157 of file TrafficLightController.cpp.

References GetStateTime().

Referenced by FWorldObserver_GetActorState().

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

◆ GetSequence()

int UTrafficLightController::GetSequence ( ) const

Definition at line 115 of file TrafficLightController.cpp.

References Sequence.

◆ GetStateTime()

float UTrafficLightController::GetStateTime ( const ETrafficLightState  State) const
private

Definition at line 173 of file TrafficLightController.cpp.

References LightStates.

Referenced by GetGreenTime(), GetRedTime(), and GetYellowTime().

+ Here is the caller graph for this function:

◆ GetTrafficLights()

const TArray< UTrafficLightComponent * > & UTrafficLightController::GetTrafficLights ( )

Definition at line 55 of file TrafficLightController.cpp.

References TrafficLights.

◆ GetYellowTime()

float UTrafficLightController::GetYellowTime ( ) const

Definition at line 152 of file TrafficLightController.cpp.

References GetStateTime().

Referenced by FWorldObserver_GetActorState().

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

◆ IsCycleFinished()

bool UTrafficLightController::IsCycleFinished ( ) const

Definition at line 97 of file TrafficLightController.cpp.

References CurrentState, and LightStates.

Referenced by AdvanceTimeAndCycleFinished().

+ Here is the caller graph for this function:

◆ NextState()

float UTrafficLightController::NextState ( )

Definition at line 25 of file TrafficLightController.cpp.

References CurrentState, GetCurrentState(), LightStates, SetTrafficLightsState(), State, and FTrafficLightStage::Time.

Referenced by AdvanceTimeAndCycleFinished().

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

◆ RemoveCarlaActorTrafficLight()

void UTrafficLightController::RemoveCarlaActorTrafficLight ( FCarlaActor CarlaActor)

Definition at line 82 of file TrafficLightController.cpp.

References TrafficLightCarlaActors.

◆ RemoveTrafficLight()

void UTrafficLightController::RemoveTrafficLight ( UTrafficLightComponent *  TrafficLight)

Definition at line 72 of file TrafficLightController.cpp.

References TrafficLights.

◆ ResetState()

void UTrafficLightController::ResetState ( )

Definition at line 125 of file TrafficLightController.cpp.

References CurrentState, ElapsedTime, GetCurrentState(), LightStates, SetTrafficLightsState(), and State.

Referenced by ATrafficLightManager::RegisterLightComponentFromOpenDRIVE(), and SetStates().

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

◆ SetControllerId()

void UTrafficLightController::SetControllerId ( const FString &  Id)

Definition at line 92 of file TrafficLightController.cpp.

References ControllerId.

◆ SetCurrentLightState()

void UTrafficLightController::SetCurrentLightState ( ETrafficLightState  NewState)
inline

Definition at line 132 of file TrafficLightController.h.

Referenced by SetTrafficLightsState().

+ Here is the caller graph for this function:

◆ SetElapsedTime()

void UTrafficLightController::SetElapsedTime ( float  InElapsedTime)

Definition at line 190 of file TrafficLightController.cpp.

References ElapsedTime.

Referenced by CarlaReplayerHelper::ProcessReplayerStateTrafficLight(), and FFrameData::ProcessReplayerStateTrafficLight().

+ Here is the caller graph for this function:

◆ SetGreenTime()

void UTrafficLightController::SetGreenTime ( float  NewTime)

Definition at line 142 of file TrafficLightController.cpp.

References SetStateTime().

Referenced by ATrafficLightBase::SetGreenTime().

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

◆ SetGroup()

void UTrafficLightController::SetGroup ( ATrafficLightGroup Group)

Definition at line 195 of file TrafficLightController.cpp.

References TrafficLightGroup.

Referenced by ATrafficLightGroup::AddController().

+ Here is the caller graph for this function:

◆ SetRedTime()

void UTrafficLightController::SetRedTime ( float  NewTime)

Definition at line 137 of file TrafficLightController.cpp.

References SetStateTime().

Referenced by ATrafficLightBase::SetRedTime().

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

◆ SetSequence()

void UTrafficLightController::SetSequence ( int  InSequence)

Definition at line 120 of file TrafficLightController.cpp.

References Sequence.

◆ SetStates()

void UTrafficLightController::SetStates ( TArray< FTrafficLightStage States)

Definition at line 14 of file TrafficLightController.cpp.

References LightStates, and ResetState().

+ Here is the call graph for this function:

◆ SetStateTime()

void UTrafficLightController::SetStateTime ( const ETrafficLightState  State,
float  NewTime 
)
private

Definition at line 162 of file TrafficLightController.cpp.

References LightStates.

Referenced by SetGreenTime(), SetRedTime(), and SetYellowTime().

+ Here is the caller graph for this function:

◆ SetTrafficLightsState()

void UTrafficLightController::SetTrafficLightsState ( ETrafficLightState  NewState)

Definition at line 102 of file TrafficLightController.cpp.

References SetCurrentLightState(), TrafficLightCarlaActors, and TrafficLights.

Referenced by NextState(), ResetState(), and StartCycle().

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

◆ SetYellowTime()

void UTrafficLightController::SetYellowTime ( float  NewTime)

Definition at line 132 of file TrafficLightController.cpp.

References SetStateTime().

Referenced by ATrafficLightBase::SetYellowTime().

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

◆ StartCycle()

void UTrafficLightController::StartCycle ( )

Definition at line 48 of file TrafficLightController.cpp.

References CurrentState, ElapsedTime, GetCurrentState(), SetTrafficLightsState(), and State.

Referenced by ATrafficLightGroup::NextController(), and ATrafficLightGroup::ResetGroup().

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

Member Data Documentation

◆ ControllerId

FString UTrafficLightController::ControllerId = ""
private

Definition at line 144 of file TrafficLightController.h.

Referenced by GetControllerId(), and SetControllerId().

◆ CurrentLightState

ETrafficLightState UTrafficLightController::CurrentLightState = ETrafficLightState::Green
private

Definition at line 172 of file TrafficLightController.h.

◆ CurrentState

int UTrafficLightController::CurrentState = 0
private

◆ ElapsedTime

float UTrafficLightController::ElapsedTime = 0
private

◆ LightStates

TArray<FTrafficLightStage> UTrafficLightController::LightStates
private
Initial value:
= {
{10, ETrafficLightState::Green},
{ 3, ETrafficLightState::Yellow},
{ 2, ETrafficLightState::Red}
}

Definition at line 151 of file TrafficLightController.h.

Referenced by GetCurrentState(), GetStateTime(), IsCycleFinished(), NextState(), ResetState(), SetStates(), and SetStateTime().

◆ Sequence

int UTrafficLightController::Sequence = 0
private

Definition at line 167 of file TrafficLightController.h.

Referenced by GetSequence(), and SetSequence().

◆ TrafficLightCarlaActors

TArray<FCarlaActor *> UTrafficLightController::TrafficLightCarlaActors
private

◆ TrafficLightGroup

ATrafficLightGroup* UTrafficLightController::TrafficLightGroup
private

Definition at line 163 of file TrafficLightController.h.

Referenced by GetGroup(), and SetGroup().

◆ TrafficLights

TArray<UTrafficLightComponent *> UTrafficLightController::TrafficLights
private

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