CARLA
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ACarlaGameModeBase Class Reference

Base class for the CARLA Game Mode. More...

#include <CarlaGameModeBase.h>

+ Inheritance diagram for ACarlaGameModeBase:

Public Member Functions

 ACarlaGameModeBase (const FObjectInitializer &ObjectInitializer)
 
void ApplyTextureToActor (AActor *Actor, UTexture2D *Texture, const carla::rpc::MaterialParameter &TextureParam)
 
void CheckForEmptyMeshes ()
 
UTexture2D * CreateUETexture (const carla::rpc::TextureColor &Texture)
 
UTexture2D * CreateUETexture (const carla::rpc::TextureFloatColor &Texture)
 
void DebugShowSignals (bool enable)
 
void EnableEnvironmentObjects (const TSet< uint64 > &EnvObjectIds, bool Enable)
 
void EnableOverlapEvents ()
 
AActor * FindActorByName (const FString &ActorName)
 
TArray< FBoundingBox > GetAllBBsOfLevel (uint8 TagQueried=0xFF) const
 
const UCarlaEpisode & GetCarlaEpisode () const
 
const TSet< uint64 > & GetDisabledEnvironmentObjects () const
 The registered environment objects disabled now, and a count of the changes to that set: Multi-GPU secondaries mirror it.
 
TArray< FEnvironmentObject > GetEnvironmentObjects (uint8 QueriedTag=0xFF) const
 
uint64 GetEnvironmentObjectsRegistrations () const
 How many times the environment objects were registered (on every map layer streamed in or out).
 
uint64 GetEnvironmentObjectsSerial () const
 
const FString GetFullMapPath () const
 
ALargeMapManager * GetLMManager () const
 
int32 GetLoadedMapLayers () const
 rpc::MapLayer bits of the layers loaded now.
 
const std::optional< carla::road::Map > & GetMap () const
 
TArray< FString > GetNamesOfAllActors ()
 
const FString GetRelativeMapPath () const
 
const TArray< FTransform > & GetSpawnPointsTransforms () const
 
ATrafficLightManager * GetTrafficLightManager ()
 
ULevel * GetULevelFromName (FString LevelName)
 
void LoadMapLayer (int32 MapLayers)
 
void OnLoadStreamLevel ()
 
void OnUnloadStreamLevel ()
 
void RegisterEnvironmentObjects ()
 
void UnLoadMapLayer (int32 MapLayers)
 

Public Attributes

float IMUSensorGravity = 9.81f
 Gravitational acceleration used by IMU sensors.
 
FOnEpisodeInitialisedDelegate OnEpisodeInitialisedDelegate
 

Protected Member Functions

void BeginPlay () override
 
void EndPlay (const EEndPlayReason::Type EndPlayReason) override
 
void InitGame (const FString &MapName, const FString &Options, FString &ErrorMessage) override
 
virtual void LoadGeoReference ()
 Loads the episode georeference (parsing the map's OpenDRIVE by default) and stores the recommended spawn points.
 
void RestartPlayer (AController *NewPlayer) override
 
void StoreSpawnPoints ()
 
void Tick (float DeltaSeconds) override
 

Protected Attributes

UCarlaEpisode * Episode = nullptr
 

Private Member Functions

void ConvertMapLayerMaskToMapNames (int32 MapLayer, TArray< FName > &OutLevelNames)
 
void GenerateSpawnPoints ()
 
void OnEpisodeSettingsChanged (const FEpisodeSettings &Settings)
 
void OnLevelAddedToWorld (ULevel *InLevel, UWorld *InWorld)
 Tags actors of World Partition cells as they stream in.
 
void ParseOpenDrive ()
 
void SpawnActorFactories ()
 

Private Attributes

TSet< TSubclassOf< ACarlaActorFactory > > ActorFactories
 List of actor spawners that will be used to define and spawn the actors available in game.
 
TArray< ACarlaActorFactory * > ActorFactoryInstances
 
UCarlaSettingsDelegate * CarlaSettingsDelegate = nullptr
 
TSet< uint64 > DisabledEnvironmentObjects
 
uint64 EnvironmentObjectsRegistrations = 0u
 
uint64 EnvironmentObjectsSerial = 0u
 
UCarlaGameInstance * GameInstance = nullptr
 
int32 LatentInfoUUID = 0
 
ALargeMapManager * LMManager = nullptr
 
int32 LoadedMapLayers = 0
 
std::optional< carla::road::Map > Map
 
UObjectRegister * ObjectRegister = nullptr
 
FDelegateHandle OnEpisodeSettingsChangeHandle
 
int PendingLevelsToLoad = 0
 
int PendingLevelsToUnLoad = 0
 
bool ReadyToRegisterObjects = false
 
ACarlaRecorder * Recorder = nullptr
 
TArray< FTransform > SpawnPointsTransforms
 
UTaggerDelegate * TaggerDelegate = nullptr
 
ATrafficLightManager * TrafficLightManager = nullptr
 
TSubclassOf< AWeather > WeatherClass
 The class of Weather to spawn.
 

Detailed Description

Base class for the CARLA Game Mode.

Definition at line 40 of file CarlaGameModeBase.h.

Constructor & Destructor Documentation

◆ ACarlaGameModeBase()

ACarlaGameModeBase::ACarlaGameModeBase ( const FObjectInitializer &  ObjectInitializer)

Member Function Documentation

◆ ApplyTextureToActor()

void ACarlaGameModeBase::ApplyTextureToActor ( AActor *  Actor,
UTexture2D *  Texture,
const carla::rpc::MaterialParameter &  TextureParam 
)

Definition at line 505 of file CarlaGameModeBase.cpp.

Referenced by FCarlaServer::FPimpl::BindActions().

◆ BeginPlay()

void ACarlaGameModeBase::BeginPlay ( )
overrideprotected

◆ CheckForEmptyMeshes()

void ACarlaGameModeBase::CheckForEmptyMeshes ( )

Definition at line 713 of file CarlaGameModeBase.cpp.

◆ ConvertMapLayerMaskToMapNames()

void ACarlaGameModeBase::ConvertMapLayerMaskToMapNames ( int32  MapLayer,
TArray< FName > &  OutLevelNames 
)
private

Definition at line 973 of file CarlaGameModeBase.cpp.

Referenced by LoadMapLayer(), and UnLoadMapLayer().

◆ CreateUETexture() [1/2]

UTexture2D * ACarlaGameModeBase::CreateUETexture ( const carla::rpc::TextureColor &  Texture)

◆ CreateUETexture() [2/2]

UTexture2D * ACarlaGameModeBase::CreateUETexture ( const carla::rpc::TextureFloatColor &  Texture)

◆ DebugShowSignals()

void ACarlaGameModeBase::DebugShowSignals ( bool  enable)

◆ EnableEnvironmentObjects()

void ACarlaGameModeBase::EnableEnvironmentObjects ( const TSet< uint64 > &  EnvObjectIds,
bool  Enable 
)

◆ EnableOverlapEvents()

void ACarlaGameModeBase::EnableOverlapEvents ( )

Definition at line 728 of file CarlaGameModeBase.cpp.

References ATagger::GetTagOfTaggedComponent().

Referenced by BeginPlay().

◆ EndPlay()

void ACarlaGameModeBase::EndPlay ( const EEndPlayReason::Type  EndPlayReason)
overrideprotected

◆ FindActorByName()

AActor * ACarlaGameModeBase::FindActorByName ( const FString &  ActorName)

Definition at line 444 of file CarlaGameModeBase.cpp.

Referenced by FCarlaServer::FPimpl::BindActions().

◆ GenerateSpawnPoints()

void ACarlaGameModeBase::GenerateSpawnPoints ( )
private

Definition at line 649 of file CarlaGameModeBase.cpp.

References Map, and SpawnPointsTransforms.

Referenced by StoreSpawnPoints().

◆ GetAllBBsOfLevel()

TArray< FBoundingBox > ACarlaGameModeBase::GetAllBBsOfLevel ( uint8  TagQueried = 0xFF) const

◆ GetCarlaEpisode()

const UCarlaEpisode & ACarlaGameModeBase::GetCarlaEpisode ( ) const
inline

Definition at line 48 of file CarlaGameModeBase.h.

◆ GetDisabledEnvironmentObjects()

const TSet< uint64 > & ACarlaGameModeBase::GetDisabledEnvironmentObjects ( ) const
inline

The registered environment objects disabled now, and a count of the changes to that set: Multi-GPU secondaries mirror it.

Definition at line 87 of file CarlaGameModeBase.h.

Referenced by FFrameData::AddWorldState(), and FFrameData::PlayWorldState().

◆ GetEnvironmentObjects()

TArray< FEnvironmentObject > ACarlaGameModeBase::GetEnvironmentObjects ( uint8  QueriedTag = 0xFF) const
inline

Definition at line 78 of file CarlaGameModeBase.h.

Referenced by FCarlaServer::FPimpl::BindActions().

◆ GetEnvironmentObjectsRegistrations()

uint64 ACarlaGameModeBase::GetEnvironmentObjectsRegistrations ( ) const
inline

How many times the environment objects were registered (on every map layer streamed in or out).

Definition at line 99 of file CarlaGameModeBase.h.

Referenced by FFrameData::PlayWorldState().

◆ GetEnvironmentObjectsSerial()

uint64 ACarlaGameModeBase::GetEnvironmentObjectsSerial ( ) const
inline

Definition at line 92 of file CarlaGameModeBase.h.

Referenced by FFrameData::AddWorldState().

◆ GetFullMapPath()

const FString ACarlaGameModeBase::GetFullMapPath ( ) const

Definition at line 75 of file CarlaGameModeBase.cpp.

References GetRelativeMapPath().

Referenced by FCarlaServer::FPimpl::BindActions(), and UOpenDrive::GetXODR().

◆ GetLMManager()

ALargeMapManager * ACarlaGameModeBase::GetLMManager ( ) const
inline

◆ GetLoadedMapLayers()

int32 ACarlaGameModeBase::GetLoadedMapLayers ( ) const
inline

rpc::MapLayer bits of the layers loaded now.

Definition at line 105 of file CarlaGameModeBase.h.

Referenced by FFrameData::AddWorldState(), and FFrameData::PlayMapLayers().

◆ GetMap()

const std::optional< carla::road::Map > & ACarlaGameModeBase::GetMap ( ) const
inline

◆ GetNamesOfAllActors()

TArray< FString > ACarlaGameModeBase::GetNamesOfAllActors ( )

Definition at line 427 of file CarlaGameModeBase.cpp.

Referenced by FCarlaServer::FPimpl::BindActions().

◆ GetRelativeMapPath()

const FString ACarlaGameModeBase::GetRelativeMapPath ( ) const

Definition at line 66 of file CarlaGameModeBase.cpp.

Referenced by GetFullMapPath().

◆ GetSpawnPointsTransforms()

const TArray< FTransform > & ACarlaGameModeBase::GetSpawnPointsTransforms ( ) const
inline

Definition at line 70 of file CarlaGameModeBase.h.

Referenced by UCarlaEpisode::GetRecommendedSpawnPoints().

◆ GetTrafficLightManager()

ATrafficLightManager * ACarlaGameModeBase::GetTrafficLightManager ( )

◆ GetULevelFromName()

ULevel * ACarlaGameModeBase::GetULevelFromName ( FString  LevelName)

◆ InitGame()

void ACarlaGameModeBase::InitGame ( const FString &  MapName,
const FString &  Options,
FString &  ErrorMessage 
)
overrideprotected

◆ LoadGeoReference()

void ACarlaGameModeBase::LoadGeoReference ( )
protectedvirtual

Loads the episode georeference (parsing the map's OpenDRIVE by default) and stores the recommended spawn points.

Virtual so Autoware maps can take the georeference from an MGRS data asset instead (tier4 port).

Reimplemented in AAutowareGameModeBase.

Definition at line 249 of file CarlaGameModeBase.cpp.

References Map, ParseOpenDrive(), and StoreSpawnPoints().

Referenced by InitGame().

◆ LoadMapLayer()

void ACarlaGameModeBase::LoadMapLayer ( int32  MapLayers)

◆ OnEpisodeSettingsChanged()

void ACarlaGameModeBase::OnEpisodeSettingsChanged ( const FEpisodeSettings &  Settings)
private

◆ OnLevelAddedToWorld()

void ACarlaGameModeBase::OnLevelAddedToWorld ( ULevel *  InLevel,
UWorld *  InWorld 
)
private

Tags actors of World Partition cells as they stream in.

The legacy ALargeMapManager used to do this for WorldComposition tiles, but it retires itself on World Partition maps, which left streamed-in cells untagged (semantic segmentation rendered them unlabeled).

Definition at line 567 of file CarlaGameModeBase.cpp.

References ATagger::TagActorsInLevel(), and TrafficLightManager.

Referenced by BeginPlay().

◆ OnLoadStreamLevel()

void ACarlaGameModeBase::OnLoadStreamLevel ( )

◆ OnUnloadStreamLevel()

void ACarlaGameModeBase::OnUnloadStreamLevel ( )

◆ ParseOpenDrive()

void ACarlaGameModeBase::ParseOpenDrive ( )
private

◆ RegisterEnvironmentObjects()

void ACarlaGameModeBase::RegisterEnvironmentObjects ( )

◆ RestartPlayer()

void ACarlaGameModeBase::RestartPlayer ( AController *  NewPlayer)
overrideprotected

◆ SpawnActorFactories()

void ACarlaGameModeBase::SpawnActorFactories ( )
private

◆ StoreSpawnPoints()

void ACarlaGameModeBase::StoreSpawnPoints ( )
protected

◆ Tick()

void ACarlaGameModeBase::Tick ( float  DeltaSeconds)
overrideprotected
Todo:
Recorder should not tick here, FCarlaEngine should do it.

Definition at line 555 of file CarlaGameModeBase.cpp.

References Recorder, and Tick().

Referenced by Tick().

◆ UnLoadMapLayer()

void ACarlaGameModeBase::UnLoadMapLayer ( int32  MapLayers)

Member Data Documentation

◆ ActorFactories

TSet<TSubclassOf<ACarlaActorFactory> > ACarlaGameModeBase::ActorFactories
private

List of actor spawners that will be used to define and spawn the actors available in game.

Definition at line 223 of file CarlaGameModeBase.h.

Referenced by SpawnActorFactories().

◆ ActorFactoryInstances

TArray<ACarlaActorFactory *> ACarlaGameModeBase::ActorFactoryInstances
private

Definition at line 229 of file CarlaGameModeBase.h.

Referenced by SpawnActorFactories().

◆ CarlaSettingsDelegate

UCarlaSettingsDelegate* ACarlaGameModeBase::CarlaSettingsDelegate = nullptr
private

◆ DisabledEnvironmentObjects

TSet<uint64> ACarlaGameModeBase::DisabledEnvironmentObjects
private

Definition at line 242 of file CarlaGameModeBase.h.

Referenced by EnableEnvironmentObjects(), and RegisterEnvironmentObjects().

◆ EnvironmentObjectsRegistrations

uint64 ACarlaGameModeBase::EnvironmentObjectsRegistrations = 0u
private

Definition at line 246 of file CarlaGameModeBase.h.

Referenced by RegisterEnvironmentObjects().

◆ EnvironmentObjectsSerial

uint64 ACarlaGameModeBase::EnvironmentObjectsSerial = 0u
private

Definition at line 244 of file CarlaGameModeBase.h.

Referenced by EnableEnvironmentObjects(), and RegisterEnvironmentObjects().

◆ Episode

UCarlaEpisode* ACarlaGameModeBase::Episode = nullptr
protected

◆ GameInstance

UCarlaGameInstance* ACarlaGameModeBase::GameInstance = nullptr
private

Definition at line 202 of file CarlaGameModeBase.h.

Referenced by BeginPlay(), EndPlay(), and InitGame().

◆ IMUSensorGravity

float ACarlaGameModeBase::IMUSensorGravity = 9.81f

Gravitational acceleration used by IMU sensors.

Default is Earth's, approximately 9.81 m/s^2.

Definition at line 149 of file CarlaGameModeBase.h.

Referenced by FFrameData::AddWorldState(), AInertialMeasurementUnit::ComputeAccelerometer(), and FFrameData::PlayWorldState().

◆ LatentInfoUUID

int32 ACarlaGameModeBase::LatentInfoUUID = 0
private

Definition at line 255 of file CarlaGameModeBase.h.

Referenced by LoadMapLayer(), and UnLoadMapLayer().

◆ LMManager

ALargeMapManager* ACarlaGameModeBase::LMManager = nullptr
private

Definition at line 234 of file CarlaGameModeBase.h.

Referenced by BeginPlay(), and InitGame().

◆ LoadedMapLayers

int32 ACarlaGameModeBase::LoadedMapLayers = 0
private

Definition at line 248 of file CarlaGameModeBase.h.

Referenced by LoadMapLayer(), and UnLoadMapLayer().

◆ Map

std::optional<carla::road::Map> ACarlaGameModeBase::Map
private

◆ ObjectRegister

UObjectRegister* ACarlaGameModeBase::ObjectRegister = nullptr
private

◆ OnEpisodeInitialisedDelegate

FOnEpisodeInitialisedDelegate ACarlaGameModeBase::OnEpisodeInitialisedDelegate

Definition at line 151 of file CarlaGameModeBase.h.

Referenced by BeginPlay().

◆ OnEpisodeSettingsChangeHandle

FDelegateHandle ACarlaGameModeBase::OnEpisodeSettingsChangeHandle
private

Definition at line 236 of file CarlaGameModeBase.h.

Referenced by EndPlay(), and InitGame().

◆ PendingLevelsToLoad

int ACarlaGameModeBase::PendingLevelsToLoad = 0
private

Definition at line 240 of file CarlaGameModeBase.h.

Referenced by BeginPlay(), LoadMapLayer(), and OnLoadStreamLevel().

◆ PendingLevelsToUnLoad

int ACarlaGameModeBase::PendingLevelsToUnLoad = 0
private

Definition at line 249 of file CarlaGameModeBase.h.

Referenced by OnUnloadStreamLevel(), and UnLoadMapLayer().

◆ ReadyToRegisterObjects

bool ACarlaGameModeBase::ReadyToRegisterObjects = false
private

Definition at line 251 of file CarlaGameModeBase.h.

Referenced by BeginPlay(), OnLoadStreamLevel(), and OnUnloadStreamLevel().

◆ Recorder

ACarlaRecorder* ACarlaGameModeBase::Recorder = nullptr
private

Definition at line 211 of file CarlaGameModeBase.h.

Referenced by ACarlaGameModeBase(), BeginPlay(), InitGame(), and Tick().

◆ SpawnPointsTransforms

TArray<FTransform> ACarlaGameModeBase::SpawnPointsTransforms
private

Definition at line 226 of file CarlaGameModeBase.h.

Referenced by GenerateSpawnPoints(), and StoreSpawnPoints().

◆ TaggerDelegate

UTaggerDelegate* ACarlaGameModeBase::TaggerDelegate = nullptr
private

Definition at line 205 of file CarlaGameModeBase.h.

Referenced by ACarlaGameModeBase(), BeginPlay(), and InitGame().

◆ TrafficLightManager

ATrafficLightManager* ACarlaGameModeBase::TrafficLightManager = nullptr
private

Definition at line 232 of file CarlaGameModeBase.h.

Referenced by GetTrafficLightManager(), and OnLevelAddedToWorld().

◆ WeatherClass

TSubclassOf<AWeather> ACarlaGameModeBase::WeatherClass
private

The class of Weather to spawn.

Definition at line 218 of file CarlaGameModeBase.h.

Referenced by InitGame().


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