CARLA
Loading...
Searching...
No Matches
AWheeledVehicleAIController Class Referencefinal

Wheeled vehicle controller with optional AI. More...

#include <WheeledVehicleAIController.h>

Inheritance 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
ACarlaWheeledVehicle * GetPossessedVehicle ()
const ACarlaWheeledVehicle * GetPossessedVehicle () const
Control options
void SetStickyControl (bool bEnabled)
Road map
void SetRoadMap (URoadMap *InRoadMap)
URoadMap * GetRoadMap ()
Random engine
URandomEngine * GetRandomEngine ()
Traffic
float GetSpeedLimit () const
 Get current speed limit in km/h.
void SetSpeedLimit (float InSpeedLimit)
 Set vehicle's speed limit in km/h.
ETrafficLightState GetTrafficLightState () const
 Get traffic light state currently affecting this vehicle.
void SetTrafficLightState (ETrafficLightState InTrafficLightState)
 Set traffic light state currently affecting this vehicle.
ATrafficLightBase * GetTrafficLight () const
 Get traffic light currently affecting this vehicle.
void SetTrafficLight (ATrafficLightBase *InTrafficLight)
 Set traffic light currently affecting this vehicle.
void SetFixedRoute (const TArray< FVector > &Locations, bool bOverwriteCurrent=true)
 Set a fixed route to follow if autopilot is enabled.

Private Attributes

bool bAutopilotEnabled = false
bool bControlIsSticky = true
float MaximumSteerAngle = -1.0f
URandomEngine * RandomEngine = nullptr
URoadMap * RoadMap = nullptr
float SpeedLimit = 30.0f
std::queue< FVector > TargetLocations
ATrafficLightBase * TrafficLight
ETrafficLightState TrafficLightState = ETrafficLightState::Green
ACarlaWheeledVehicle * Vehicle = 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 26 of file WheeledVehicleAIController.h.

Constructor & Destructor Documentation

◆ AWheeledVehicleAIController()

AWheeledVehicleAIController::AWheeledVehicleAIController ( const FObjectInitializer & ObjectInitializer)

◆ ~AWheeledVehicleAIController()

AWheeledVehicleAIController::~AWheeledVehicleAIController ( )

Definition at line 97 of file WheeledVehicleAIController.cpp.

Member Function Documentation

◆ ConfigureAutopilot()

◆ GetPossessedVehicle() [1/2]

ACarlaWheeledVehicle * AWheeledVehicleAIController::GetPossessedVehicle ( )
inline

Definition at line 70 of file WheeledVehicleAIController.h.

References GetPossessedVehicle(), and Vehicle.

Referenced by GetPossessedVehicle().

◆ GetPossessedVehicle() [2/2]

const ACarlaWheeledVehicle * AWheeledVehicleAIController::GetPossessedVehicle ( ) const
inline

Definition at line 75 of file WheeledVehicleAIController.h.

References Vehicle.

◆ GetRandomEngine()

URandomEngine * AWheeledVehicleAIController::GetRandomEngine ( )
inline

◆ GetRoadMap()

URoadMap * AWheeledVehicleAIController::GetRoadMap ( )
inline

Definition at line 106 of file WheeledVehicleAIController.h.

References GetRoadMap(), and RoadMap.

Referenced by GetRoadMap().

◆ GetSpeedLimit()

float AWheeledVehicleAIController::GetSpeedLimit ( ) const
inline

Get current speed limit in km/h.

Definition at line 169 of file WheeledVehicleAIController.h.

References GetSpeedLimit(), and SpeedLimit.

Referenced by GetSpeedLimit().

◆ GetTrafficLight()

ATrafficLightBase * AWheeledVehicleAIController::GetTrafficLight ( ) const
inline

Get traffic light currently affecting this vehicle.

Definition at line 197 of file WheeledVehicleAIController.h.

References GetTrafficLight(), and TrafficLight.

Referenced by GetTrafficLight().

◆ GetTrafficLightState()

ETrafficLightState AWheeledVehicleAIController::GetTrafficLightState ( ) const
inline

Get traffic light state currently affecting this vehicle.

Definition at line 183 of file WheeledVehicleAIController.h.

References GetTrafficLightState(), and TrafficLightState.

Referenced by GetTrafficLightState().

◆ IsAutopilotEnabled()

bool AWheeledVehicleAIController::IsAutopilotEnabled ( ) const
inline

Definition at line 135 of file WheeledVehicleAIController.h.

References bAutopilotEnabled, and IsAutopilotEnabled().

Referenced by IsAutopilotEnabled(), and SetAutopilot().

◆ IsPossessingAVehicle()

bool AWheeledVehicleAIController::IsPossessingAVehicle ( ) const
inline

Definition at line 64 of file WheeledVehicleAIController.h.

References IsPossessingAVehicle(), and Vehicle.

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

◆ OnPossess()

void AWheeledVehicleAIController::OnPossess ( APawn * aPawn)
override

◆ OnUnPossess()

void AWheeledVehicleAIController::OnUnPossess ( )
override

Definition at line 128 of file WheeledVehicleAIController.cpp.

References Vehicle.

◆ SetAutopilot()

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

Definition at line 141 of file WheeledVehicleAIController.h.

References ConfigureAutopilot(), IsAutopilotEnabled(), and SetAutopilot().

Referenced by SetAutopilot().

◆ SetFixedRoute()

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

Set a fixed route to follow if autopilot is enabled.

Definition at line 182 of file WheeledVehicleAIController.cpp.

References ClearQueue(), and TargetLocations.

Referenced by ARoutePlanner::AssignRandomRoute().

◆ SetRoadMap()

void AWheeledVehicleAIController::SetRoadMap ( URoadMap * InRoadMap)
inline

Definition at line 100 of file WheeledVehicleAIController.h.

References RoadMap.

◆ SetSpeedLimit()

void AWheeledVehicleAIController::SetSpeedLimit ( float InSpeedLimit)
inline

Set vehicle's speed limit in km/h.

Definition at line 176 of file WheeledVehicleAIController.h.

References SetSpeedLimit(), and SpeedLimit.

Referenced by SetSpeedLimit().

◆ SetStickyControl()

void AWheeledVehicleAIController::SetStickyControl ( bool bEnabled)
inline

Definition at line 87 of file WheeledVehicleAIController.h.

References bControlIsSticky, and SetStickyControl().

Referenced by SetStickyControl().

◆ SetTrafficLight()

void AWheeledVehicleAIController::SetTrafficLight ( ATrafficLightBase * InTrafficLight)
inline

Set traffic light currently affecting this vehicle.

Definition at line 204 of file WheeledVehicleAIController.h.

References SetTrafficLight(), and TrafficLight.

Referenced by SetTrafficLight().

◆ SetTrafficLightState()

void AWheeledVehicleAIController::SetTrafficLightState ( ETrafficLightState InTrafficLightState)
inline

Set traffic light state currently affecting this vehicle.

Definition at line 190 of file WheeledVehicleAIController.h.

References SetTrafficLightState(), and TrafficLightState.

Referenced by SetTrafficLightState().

◆ Tick()

void AWheeledVehicleAIController::Tick ( float DeltaTime)
override

◆ ToggleAutopilot()

void AWheeledVehicleAIController::ToggleAutopilot ( )
inline

Definition at line 150 of file WheeledVehicleAIController.h.

References bAutopilotEnabled, ConfigureAutopilot(), and ToggleAutopilot().

Referenced by ToggleAutopilot().

Member Data Documentation

◆ bAutopilotEnabled

bool AWheeledVehicleAIController::bAutopilotEnabled = false
private

◆ bControlIsSticky

bool AWheeledVehicleAIController::bControlIsSticky = true
private

Definition at line 230 of file WheeledVehicleAIController.h.

Referenced by SetStickyControl(), and Tick().

◆ MaximumSteerAngle

float AWheeledVehicleAIController::MaximumSteerAngle = -1.0f
private

Definition at line 239 of file WheeledVehicleAIController.h.

Referenced by OnPossess().

◆ RandomEngine

URandomEngine* AWheeledVehicleAIController::RandomEngine = nullptr
private

Definition at line 224 of file WheeledVehicleAIController.h.

Referenced by AWheeledVehicleAIController(), and GetRandomEngine().

◆ RoadMap

URoadMap* AWheeledVehicleAIController::RoadMap = nullptr
private

Definition at line 221 of file WheeledVehicleAIController.h.

Referenced by GetRoadMap(), OnPossess(), and SetRoadMap().

◆ SpeedLimit

float AWheeledVehicleAIController::SpeedLimit = 30.0f
private

Definition at line 233 of file WheeledVehicleAIController.h.

Referenced by GetSpeedLimit(), and SetSpeedLimit().

◆ TargetLocations

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

Definition at line 244 of file WheeledVehicleAIController.h.

Referenced by ConfigureAutopilot(), and SetFixedRoute().

◆ TrafficLight

ATrafficLightBase* AWheeledVehicleAIController::TrafficLight
private

Definition at line 242 of file WheeledVehicleAIController.h.

Referenced by GetTrafficLight(), and SetTrafficLight().

◆ TrafficLightState

ETrafficLightState AWheeledVehicleAIController::TrafficLightState = ETrafficLightState::Green
private

◆ Vehicle

ACarlaWheeledVehicle* AWheeledVehicleAIController::Vehicle = nullptr
private

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