CARLA
Private Attributes | List of all members
AWheeledVehicleAIController Class Referencefinal

Wheeled vehicle controller with optional AI. More...

#include <WheeledVehicleAIController.h>

+ Inheritance diagram for AWheeledVehicleAIController:
+ Collaboration diagram for AWheeledVehicleAIController:

Public Member Functions

Constructor and destructor
 AWheeledVehicleAIController (const FObjectInitializer &ObjectInitializer)
 
 ~AWheeledVehicleAIController ()
 
Controller overrides
void OnPossess (APawn *aPawn) override
 
void OnUnPossess () override
 
void Tick (float DeltaTime) override
 
Possessed vehicle
bool IsPossessingAVehicle () const
 
ACarlaWheeledVehicleGetPossessedVehicle ()
 
const ACarlaWheeledVehicleGetPossessedVehicle () const
 
Control options
void SetStickyControl (bool bEnabled)
 
Road map
void SetRoadMap (URoadMap *InRoadMap)
 
URoadMapGetRoadMap ()
 
Random engine
URandomEngineGetRandomEngine ()
 
Traffic
float GetSpeedLimit () const
 Get current speed limit in km/h. More...
 
void SetSpeedLimit (float InSpeedLimit)
 Set vehicle's speed limit in km/h. More...
 
ETrafficLightState GetTrafficLightState () const
 Get traffic light state currently affecting this vehicle. More...
 
void SetTrafficLightState (ETrafficLightState InTrafficLightState)
 Set traffic light state currently affecting this vehicle. More...
 
ATrafficLightBaseGetTrafficLight () const
 Get traffic light currently affecting this vehicle. More...
 
void SetTrafficLight (ATrafficLightBase *InTrafficLight)
 Set traffic light currently affecting this vehicle. More...
 
void SetFixedRoute (const TArray< FVector > &Locations, bool bOverwriteCurrent=true)
 Set a fixed route to follow if autopilot is enabled. More...
 

Private Attributes

bool bAutopilotEnabled = false
 
bool bControlIsSticky = true
 
float MaximumSteerAngle = -1.0f
 
URandomEngineRandomEngine = nullptr
 
URoadMapRoadMap = nullptr
 
float SpeedLimit = 30.0f
 
std::queue< FVector > TargetLocations
 
ATrafficLightBaseTrafficLight
 
ETrafficLightState TrafficLightState = ETrafficLightState::Green
 
ACarlaWheeledVehicleVehicle = nullptr
 

Autopilot

bool IsAutopilotEnabled () const
 
void SetAutopilot (bool Enable, bool KeepState=false)
 
void ToggleAutopilot ()
 
void ConfigureAutopilot (const bool Enable, const bool KeepState=false)
 

Detailed Description

Wheeled vehicle controller with optional AI.

Definition at line 24 of file WheeledVehicleAIController.h.

Constructor & Destructor Documentation

◆ AWheeledVehicleAIController()

AWheeledVehicleAIController::AWheeledVehicleAIController ( const FObjectInitializer &  ObjectInitializer)

Definition at line 85 of file WheeledVehicleAIController.cpp.

References URandomEngine::GenerateRandomSeed(), RandomEngine, and URandomEngine::Seed().

+ Here is the call graph for this function:

◆ ~AWheeledVehicleAIController()

AWheeledVehicleAIController::~AWheeledVehicleAIController ( )

Definition at line 96 of file WheeledVehicleAIController.cpp.

Member Function Documentation

◆ ConfigureAutopilot()

void AWheeledVehicleAIController::ConfigureAutopilot ( const bool  Enable,
const bool  KeepState = false 
)
private

Definition at line 153 of file WheeledVehicleAIController.cpp.

References bAutopilotEnabled, ClearQueue(), ACarlaWheeledVehicle::SetAIVehicleState(), ACarlaWheeledVehicle::SetBrakeInput(), ACarlaWheeledVehicle::SetHandbrakeInput(), ACarlaWheeledVehicle::SetReverse(), ACarlaWheeledVehicle::SetSteeringInput(), ACarlaWheeledVehicle::SetThrottleInput(), TargetLocations, TrafficLightState, and Vehicle.

Referenced by OnPossess().

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

◆ GetPossessedVehicle() [1/2]

ACarlaWheeledVehicle* AWheeledVehicleAIController::GetPossessedVehicle ( )
inline

Definition at line 68 of file WheeledVehicleAIController.h.

References Vehicle.

◆ GetPossessedVehicle() [2/2]

const ACarlaWheeledVehicle* AWheeledVehicleAIController::GetPossessedVehicle ( ) const
inline

Definition at line 73 of file WheeledVehicleAIController.h.

References Vehicle.

◆ GetRandomEngine()

URandomEngine* AWheeledVehicleAIController::GetRandomEngine ( )
inline

Definition at line 118 of file WheeledVehicleAIController.h.

Referenced by ARoutePlanner::AssignRandomRoute().

+ Here is the caller graph for this function:

◆ GetRoadMap()

URoadMap* AWheeledVehicleAIController::GetRoadMap ( )
inline

Definition at line 104 of file WheeledVehicleAIController.h.

◆ GetSpeedLimit()

float AWheeledVehicleAIController::GetSpeedLimit ( ) const
inline

Get current speed limit in km/h.

Definition at line 167 of file WheeledVehicleAIController.h.

◆ GetTrafficLight()

ATrafficLightBase* AWheeledVehicleAIController::GetTrafficLight ( ) const
inline

Get traffic light currently affecting this vehicle.

Definition at line 195 of file WheeledVehicleAIController.h.

References TrafficLight.

◆ GetTrafficLightState()

ETrafficLightState AWheeledVehicleAIController::GetTrafficLightState ( ) const
inline

Get traffic light state currently affecting this vehicle.

Definition at line 181 of file WheeledVehicleAIController.h.

◆ IsAutopilotEnabled()

bool AWheeledVehicleAIController::IsAutopilotEnabled ( ) const
inline

Definition at line 133 of file WheeledVehicleAIController.h.

◆ IsPossessingAVehicle()

bool AWheeledVehicleAIController::IsPossessingAVehicle ( ) const
inline

Definition at line 62 of file WheeledVehicleAIController.h.

References Vehicle.

Referenced by OnPossess(), and Tick().

+ Here is the caller graph for this function:

◆ OnPossess()

void AWheeledVehicleAIController::OnPossess ( APawn aPawn)
override

Definition at line 102 of file WheeledVehicleAIController.cpp.

References bAutopilotEnabled, ConfigureAutopilot(), ACarlaWheeledVehicle::GetMaximumSteerAngle(), IsPossessingAVehicle(), MaximumSteerAngle, RoadMap, and Vehicle.

+ Here is the call graph for this function:

◆ OnUnPossess()

void AWheeledVehicleAIController::OnUnPossess ( )
override

Definition at line 124 of file WheeledVehicleAIController.cpp.

References Vehicle.

◆ SetAutopilot()

void AWheeledVehicleAIController::SetAutopilot ( bool  Enable,
bool  KeepState = false 
)
inline

Definition at line 139 of file WheeledVehicleAIController.h.

◆ SetFixedRoute()

void AWheeledVehicleAIController::SetFixedRoute ( const TArray< FVector > &  Locations,
bool  bOverwriteCurrent = true 
)

Set a fixed route to follow if autopilot is enabled.

Definition at line 178 of file WheeledVehicleAIController.cpp.

References ClearQueue(), and TargetLocations.

Referenced by ARoutePlanner::AssignRandomRoute().

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

◆ SetRoadMap()

void AWheeledVehicleAIController::SetRoadMap ( URoadMap InRoadMap)
inline

Definition at line 98 of file WheeledVehicleAIController.h.

◆ SetSpeedLimit()

void AWheeledVehicleAIController::SetSpeedLimit ( float  InSpeedLimit)
inline

Set vehicle's speed limit in km/h.

Definition at line 174 of file WheeledVehicleAIController.h.

◆ SetStickyControl()

void AWheeledVehicleAIController::SetStickyControl ( bool  bEnabled)
inline

Definition at line 85 of file WheeledVehicleAIController.h.

◆ SetTrafficLight()

void AWheeledVehicleAIController::SetTrafficLight ( ATrafficLightBase InTrafficLight)
inline

Set traffic light currently affecting this vehicle.

Definition at line 202 of file WheeledVehicleAIController.h.

References TrafficLight.

◆ SetTrafficLightState()

void AWheeledVehicleAIController::SetTrafficLightState ( ETrafficLightState  InTrafficLightState)
inline

Set traffic light state currently affecting this vehicle.

Definition at line 188 of file WheeledVehicleAIController.h.

◆ Tick()

void AWheeledVehicleAIController::Tick ( float  DeltaTime)
override

Definition at line 131 of file WheeledVehicleAIController.cpp.

References ACarlaWheeledVehicle::ApplyVehicleControl(), bAutopilotEnabled, bControlIsSticky, ACarlaWheeledVehicle::FlushVehicleControl(), IsPossessingAVehicle(), and Vehicle.

+ Here is the call graph for this function:

◆ ToggleAutopilot()

void AWheeledVehicleAIController::ToggleAutopilot ( )
inline

Definition at line 148 of file WheeledVehicleAIController.h.

Member Data Documentation

◆ bAutopilotEnabled

bool AWheeledVehicleAIController::bAutopilotEnabled = false
private

Definition at line 225 of file WheeledVehicleAIController.h.

Referenced by ConfigureAutopilot(), OnPossess(), and Tick().

◆ bControlIsSticky

bool AWheeledVehicleAIController::bControlIsSticky = true
private

Definition at line 228 of file WheeledVehicleAIController.h.

Referenced by Tick().

◆ MaximumSteerAngle

float AWheeledVehicleAIController::MaximumSteerAngle = -1.0f
private

Definition at line 237 of file WheeledVehicleAIController.h.

Referenced by OnPossess().

◆ RandomEngine

URandomEngine* AWheeledVehicleAIController::RandomEngine = nullptr
private

Definition at line 222 of file WheeledVehicleAIController.h.

Referenced by AWheeledVehicleAIController().

◆ RoadMap

URoadMap* AWheeledVehicleAIController::RoadMap = nullptr
private

Definition at line 219 of file WheeledVehicleAIController.h.

Referenced by OnPossess().

◆ SpeedLimit

float AWheeledVehicleAIController::SpeedLimit = 30.0f
private

Definition at line 231 of file WheeledVehicleAIController.h.

◆ TargetLocations

std::queue<FVector> AWheeledVehicleAIController::TargetLocations
private

Definition at line 242 of file WheeledVehicleAIController.h.

Referenced by ConfigureAutopilot(), and SetFixedRoute().

◆ TrafficLight

ATrafficLightBase* AWheeledVehicleAIController::TrafficLight
private

Definition at line 240 of file WheeledVehicleAIController.h.

◆ TrafficLightState

ETrafficLightState AWheeledVehicleAIController::TrafficLightState = ETrafficLightState::Green
private

Definition at line 234 of file WheeledVehicleAIController.h.

Referenced by ConfigureAutopilot().

◆ Vehicle

ACarlaWheeledVehicle* AWheeledVehicleAIController::Vehicle = nullptr
private

Definition at line 216 of file WheeledVehicleAIController.h.

Referenced by ConfigureAutopilot(), OnPossess(), OnUnPossess(), and Tick().


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