Wheeled vehicle controller with optional AI. More...
#include <WheeledVehicleAIController.h>
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. 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... | |
ATrafficLightBase * | GetTrafficLight () 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 |
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) |
Wheeled vehicle controller with optional AI.
Definition at line 24 of file WheeledVehicleAIController.h.
AWheeledVehicleAIController::AWheeledVehicleAIController | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 85 of file WheeledVehicleAIController.cpp.
References URandomEngine::GenerateRandomSeed(), RandomEngine, and URandomEngine::Seed().
AWheeledVehicleAIController::~AWheeledVehicleAIController | ( | ) |
Definition at line 96 of file WheeledVehicleAIController.cpp.
|
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().
|
inline |
Definition at line 68 of file WheeledVehicleAIController.h.
References Vehicle.
|
inline |
Definition at line 73 of file WheeledVehicleAIController.h.
References Vehicle.
|
inline |
Definition at line 118 of file WheeledVehicleAIController.h.
Referenced by ARoutePlanner::AssignRandomRoute().
|
inline |
Definition at line 104 of file WheeledVehicleAIController.h.
|
inline |
Get current speed limit in km/h.
Definition at line 167 of file WheeledVehicleAIController.h.
|
inline |
Get traffic light currently affecting this vehicle.
Definition at line 195 of file WheeledVehicleAIController.h.
References TrafficLight.
|
inline |
Get traffic light state currently affecting this vehicle.
Definition at line 181 of file WheeledVehicleAIController.h.
|
inline |
Definition at line 133 of file WheeledVehicleAIController.h.
|
inline |
Definition at line 62 of file WheeledVehicleAIController.h.
References Vehicle.
Referenced by OnPossess(), and Tick().
|
override |
Definition at line 102 of file WheeledVehicleAIController.cpp.
References bAutopilotEnabled, ConfigureAutopilot(), ACarlaWheeledVehicle::GetMaximumSteerAngle(), IsPossessingAVehicle(), MaximumSteerAngle, RoadMap, and Vehicle.
|
override |
Definition at line 124 of file WheeledVehicleAIController.cpp.
References Vehicle.
|
inline |
Definition at line 139 of file WheeledVehicleAIController.h.
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().
|
inline |
Definition at line 98 of file WheeledVehicleAIController.h.
|
inline |
Set vehicle's speed limit in km/h.
Definition at line 174 of file WheeledVehicleAIController.h.
|
inline |
Definition at line 85 of file WheeledVehicleAIController.h.
|
inline |
Set traffic light currently affecting this vehicle.
Definition at line 202 of file WheeledVehicleAIController.h.
References TrafficLight.
|
inline |
Set traffic light state currently affecting this vehicle.
Definition at line 188 of file WheeledVehicleAIController.h.
|
override |
Definition at line 131 of file WheeledVehicleAIController.cpp.
References ACarlaWheeledVehicle::ApplyVehicleControl(), bAutopilotEnabled, bControlIsSticky, ACarlaWheeledVehicle::FlushVehicleControl(), IsPossessingAVehicle(), and Vehicle.
|
inline |
Definition at line 148 of file WheeledVehicleAIController.h.
|
private |
Definition at line 225 of file WheeledVehicleAIController.h.
Referenced by ConfigureAutopilot(), OnPossess(), and Tick().
|
private |
Definition at line 228 of file WheeledVehicleAIController.h.
Referenced by Tick().
|
private |
Definition at line 237 of file WheeledVehicleAIController.h.
Referenced by OnPossess().
|
private |
Definition at line 222 of file WheeledVehicleAIController.h.
Referenced by AWheeledVehicleAIController().
|
private |
Definition at line 219 of file WheeledVehicleAIController.h.
Referenced by OnPossess().
|
private |
Definition at line 231 of file WheeledVehicleAIController.h.
|
private |
Definition at line 242 of file WheeledVehicleAIController.h.
Referenced by ConfigureAutopilot(), and SetFixedRoute().
|
private |
Definition at line 240 of file WheeledVehicleAIController.h.
|
private |
Definition at line 234 of file WheeledVehicleAIController.h.
Referenced by ConfigureAutopilot().
|
private |
Definition at line 216 of file WheeledVehicleAIController.h.
Referenced by ConfigureAutopilot(), OnPossess(), OnUnPossess(), and Tick().