CARLA
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
ARoutePlanner Class Reference

Assign a random route to every ACarlaWheeledVehicle entering the trigger volume. More...

#include <RoutePlanner.h>

+ Inheritance diagram for ARoutePlanner:
+ Collaboration diagram for ARoutePlanner:

Public Member Functions

void AddRoute (float probability, const TArray< FVector > &routePoints)
 
 ARoutePlanner (const FObjectInitializer &ObjectInitializer)
 
void AssignRandomRoute (AWheeledVehicleAIController &Controller) const
 
virtual void BeginDestroy () override
 
void CleanRoute ()
 
void DrawRoutes ()
 
void Init ()
 
void SetBoxExtent (const FVector &Extent)
 

Public Attributes

bool bIsIntersection = false
 
TArray< float > Probabilities
 
TArray< USplineComponent * > Routes
 
UBoxComponent * TriggerVolume
 

Protected Member Functions

virtual void BeginPlay () override
 
virtual void EndPlay (EEndPlayReason::Type EndPlayReason) override
 
void OnTriggerBeginOverlap (UPrimitiveComponent *OverlappedComp, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)
 

Detailed Description

Assign a random route to every ACarlaWheeledVehicle entering the trigger volume.

Routes must be added in editor after placing this actor into the world. Spline tangents are ignored, only locations are taken into account for making the route.

Definition at line 23 of file RoutePlanner.h.

Constructor & Destructor Documentation

◆ ARoutePlanner()

ARoutePlanner::ARoutePlanner ( const FObjectInitializer &  ObjectInitializer)

Definition at line 48 of file RoutePlanner.cpp.

References TriggerVolume.

Member Function Documentation

◆ AddRoute()

void ARoutePlanner::AddRoute ( float  probability,
const TArray< FVector > &  routePoints 
)

Definition at line 96 of file RoutePlanner.cpp.

References Probabilities, and Routes.

Referenced by AOpenDriveActor::BuildRoutes().

+ Here is the caller graph for this function:

◆ AssignRandomRoute()

void ARoutePlanner::AssignRandomRoute ( AWheeledVehicleAIController Controller) const

Definition at line 123 of file RoutePlanner.cpp.

References AWheeledVehicleAIController::GetRandomEngine(), PickARoute(), Probabilities, Routes, and AWheeledVehicleAIController::SetFixedRoute().

Referenced by OnTriggerBeginOverlap().

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

◆ BeginDestroy()

void ARoutePlanner::BeginDestroy ( )
overridevirtual

Definition at line 66 of file RoutePlanner.cpp.

References CleanRoute(), Probabilities, and Routes.

+ Here is the call graph for this function:

◆ BeginPlay()

void ARoutePlanner::BeginPlay ( )
overrideprotectedvirtual

Definition at line 174 of file RoutePlanner.cpp.

References Init().

+ Here is the call graph for this function:

◆ CleanRoute()

void ARoutePlanner::CleanRoute ( )

Definition at line 117 of file RoutePlanner.cpp.

References Probabilities, and Routes.

Referenced by BeginDestroy().

+ Here is the caller graph for this function:

◆ DrawRoutes()

void ARoutePlanner::DrawRoutes ( )

Definition at line 206 of file RoutePlanner.cpp.

References bIsIntersection, and Routes.

◆ EndPlay()

void ARoutePlanner::EndPlay ( EEndPlayReason::Type  EndPlayReason)
overrideprotectedvirtual

Definition at line 180 of file RoutePlanner.cpp.

References OnTriggerBeginOverlap(), and TriggerVolume.

+ Here is the call graph for this function:

◆ Init()

void ARoutePlanner::Init ( )

Definition at line 150 of file RoutePlanner.cpp.

References IsSplineValid(), OnTriggerBeginOverlap(), Routes, and TriggerVolume.

Referenced by BeginPlay().

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

◆ OnTriggerBeginOverlap()

void ARoutePlanner::OnTriggerBeginOverlap ( UPrimitiveComponent OverlappedComp,
AActor OtherActor,
UPrimitiveComponent OtherComp,
int32  OtherBodyIndex,
bool  bFromSweep,
const FHitResult &  SweepResult 
)
protected

Definition at line 191 of file RoutePlanner.cpp.

References AssignRandomRoute(), and GetVehicleController().

Referenced by EndPlay(), and Init().

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

◆ SetBoxExtent()

void ARoutePlanner::SetBoxExtent ( const FVector &  Extent)
inline

Definition at line 35 of file RoutePlanner.h.

References TriggerVolume.

Referenced by AOpenDriveActor::BuildRoutes().

+ Here is the caller graph for this function:

Member Data Documentation

◆ bIsIntersection

bool ARoutePlanner::bIsIntersection = false

Definition at line 80 of file RoutePlanner.h.

Referenced by AOpenDriveActor::BuildRoutes(), and DrawRoutes().

◆ Probabilities

TArray<float> ARoutePlanner::Probabilities

Definition at line 77 of file RoutePlanner.h.

Referenced by AddRoute(), AssignRandomRoute(), BeginDestroy(), and CleanRoute().

◆ Routes

TArray<USplineComponent *> ARoutePlanner::Routes

Definition at line 74 of file RoutePlanner.h.

Referenced by AddRoute(), AssignRandomRoute(), BeginDestroy(), CleanRoute(), DrawRoutes(), and Init().

◆ TriggerVolume

UBoxComponent* ARoutePlanner::TriggerVolume

Definition at line 71 of file RoutePlanner.h.

Referenced by ARoutePlanner(), EndPlay(), and Init().


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