|
CARLA
|
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. | |
Base class for the CARLA Game Mode.
Definition at line 40 of file CarlaGameModeBase.h.
| ACarlaGameModeBase::ACarlaGameModeBase | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 46 of file CarlaGameModeBase.cpp.
References CarlaSettingsDelegate, Episode, ObjectRegister, Recorder, and TaggerDelegate.
| 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().
|
overrideprotected |
Definition at line 308 of file CarlaGameModeBase.cpp.
References AWeather::ApplyWeather(), UCarlaEpisode::bIsPrimaryServer, CarlaReplayer::CheckPlayAfterMapLoaded(), ALargeMapManager::ConsiderSpectatorAsEgo(), carla::rpc::WeatherParameters::Default, EnableOverlapEvents(), Episode, GameInstance, UCarlaGameInstance::GetCurrentMapLayer(), AWeather::GetCurrentWeather(), UWeatherJsonUtils::GetMapDefaultWeather(), ACarlaRecorder::GetReplayer(), UCarlaEpisode::GetSettings(), GetTrafficLightManager(), UCarlaEpisode::InitializeAtBeginPlay(), IsMapInBlueprintWeatherTable(), LMManager, LoadMapLayer(), UCarlaGameInstance::NotifyBeginEpisode(), OnEpisodeInitialisedDelegate, OnLevelAddedToWorld(), PendingLevelsToLoad, ReadyToRegisterObjects, Recorder, RegisterEnvironmentObjects(), ALargeMapManager::RegisterInitialObjects(), UTaggerDelegate::SetSemanticSegmentationEnabled(), FEpisodeSettings::SpectatorAsEgo, ATagger::TagActorsInLevel(), TaggerDelegate, and UCarlaEpisode::Weather.
| void ACarlaGameModeBase::CheckForEmptyMeshes | ( | ) |
Definition at line 713 of file CarlaGameModeBase.cpp.
|
private |
Definition at line 973 of file CarlaGameModeBase.cpp.
Referenced by LoadMapLayer(), and UnLoadMapLayer().
| UTexture2D * ACarlaGameModeBase::CreateUETexture | ( | const carla::rpc::TextureColor & | Texture | ) |
Definition at line 459 of file CarlaGameModeBase.cpp.
References carla::sensor::data::Color::a, carla::rpc::Texture< T >::At(), carla::sensor::data::Color::b, carla::sensor::data::Color::g, carla::rpc::Texture< T >::GetHeight(), carla::rpc::Texture< T >::GetWidth(), carla::sensor::data::Color::r, x, and y.
Referenced by FCarlaServer::FPimpl::BindActions().
| UTexture2D * ACarlaGameModeBase::CreateUETexture | ( | const carla::rpc::TextureFloatColor & | Texture | ) |
Definition at line 482 of file CarlaGameModeBase.cpp.
References carla::sensor::data::Color::a, carla::rpc::Texture< T >::At(), carla::sensor::data::Color::b, carla::sensor::data::Color::g, carla::rpc::Texture< T >::GetHeight(), carla::rpc::Texture< T >::GetWidth(), carla::sensor::data::Color::r, x, and y.
| void ACarlaGameModeBase::DebugShowSignals | ( | bool | enable | ) |
Definition at line 753 of file CarlaGameModeBase.cpp.
References carla::geom::Math::GenerateRange(), carla::geom::Rotation::GetUpVector(), and Map.
| void ACarlaGameModeBase::EnableEnvironmentObjects | ( | const TSet< uint64 > & | EnvObjectIds, |
| bool | Enable | ||
| ) |
Definition at line 901 of file CarlaGameModeBase.cpp.
References DisabledEnvironmentObjects, UObjectRegister::EnableEnvironmentObjects(), EnvironmentObjectsSerial, UObjectRegister::FindEnvironmentObjects(), and ObjectRegister.
Referenced by FCarlaServer::FPimpl::BindActions(), and FFrameData::PlayWorldState().
| void ACarlaGameModeBase::EnableOverlapEvents | ( | ) |
Definition at line 728 of file CarlaGameModeBase.cpp.
References ATagger::GetTagOfTaggedComponent().
Referenced by BeginPlay().
|
overrideprotected |
Definition at line 595 of file CarlaGameModeBase.cpp.
References CarlaSettingsDelegate, UCarlaEpisode::EndPlay(), Episode, GameInstance, UCarlaGameInstance::NotifyEndEpisode(), FCarlaStaticDelegates::OnEpisodeSettingsChange, OnEpisodeSettingsChangeHandle, and UCarlaSettingsDelegate::Reset().
| AActor * ACarlaGameModeBase::FindActorByName | ( | const FString & | ActorName | ) |
Definition at line 444 of file CarlaGameModeBase.cpp.
Referenced by FCarlaServer::FPimpl::BindActions().
|
private |
Definition at line 649 of file CarlaGameModeBase.cpp.
References Map, and SpawnPointsTransforms.
Referenced by StoreSpawnPoints().
| TArray< FBoundingBox > ACarlaGameModeBase::GetAllBBsOfLevel | ( | uint8 | TagQueried = 0xFF | ) | const |
Definition at line 853 of file CarlaGameModeBase.cpp.
References UBoundingBoxCalculator::GetBoundingBoxOfActors().
Referenced by FCarlaServer::FPimpl::BindActions().
|
inline |
Definition at line 48 of file CarlaGameModeBase.h.
|
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().
|
inline |
Definition at line 78 of file CarlaGameModeBase.h.
Referenced by FCarlaServer::FPimpl::BindActions().
|
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().
|
inline |
Definition at line 92 of file CarlaGameModeBase.h.
Referenced by FFrameData::AddWorldState().
| const FString ACarlaGameModeBase::GetFullMapPath | ( | ) | const |
Definition at line 75 of file CarlaGameModeBase.cpp.
References GetRelativeMapPath().
Referenced by FCarlaServer::FPimpl::BindActions(), and UOpenDrive::GetXODR().
|
inline |
Definition at line 129 of file CarlaGameModeBase.h.
Referenced by FCarlaServer::FPimpl::BindActions(), URayTracer::CastRay(), UCarlaStatics::GetLargeMapManager(), and URayTracer::ProjectPoint().
|
inline |
rpc::MapLayer bits of the layers loaded now.
Definition at line 105 of file CarlaGameModeBase.h.
Referenced by FFrameData::AddWorldState(), and FFrameData::PlayMapLayers().
|
inline |
Definition at line 54 of file CarlaGameModeBase.h.
Referenced by AOpenDriveGenerator::GenerateCrosswalkMesh(), AOpenDriveGenerator::GenerateFurnitureAnchors(), AOpenDriveGenerator::GenerateGroundPlane(), AOpenDriveGenerator::GenerateLaneMarkings(), AOpenDriveGenerator::GenerateRoadMesh(), AOpenDriveGenerator::GenerateSpawnPoints(), ATrafficLightManager::GetMap(), AOpenDriveGenerator::IsOpenDriveValid(), FTrafficSignData::RestoreActorData(), and FTrafficLightData::RestoreActorData().
| TArray< FString > ACarlaGameModeBase::GetNamesOfAllActors | ( | ) |
Definition at line 427 of file CarlaGameModeBase.cpp.
Referenced by FCarlaServer::FPimpl::BindActions().
| const FString ACarlaGameModeBase::GetRelativeMapPath | ( | ) | const |
Definition at line 66 of file CarlaGameModeBase.cpp.
Referenced by GetFullMapPath().
|
inline |
Definition at line 70 of file CarlaGameModeBase.h.
Referenced by UCarlaEpisode::GetRecommendedSpawnPoints().
| ATrafficLightManager * ACarlaGameModeBase::GetTrafficLightManager | ( | ) |
Definition at line 676 of file CarlaGameModeBase.cpp.
References ATrafficLightManager::AdoptModelConfigurationFrom(), GetULevelFromName(), and TrafficLightManager.
Referenced by BeginPlay(), FCarlaServer::FPimpl::BindActions(), and FCarlaEngine::NotifyBeginEpisode().
| ULevel * ACarlaGameModeBase::GetULevelFromName | ( | FString | LevelName | ) |
Definition at line 1015 of file CarlaGameModeBase.cpp.
Referenced by GetTrafficLightManager(), ATrafficLightManager::RegisterLightComponentFromOpenDRIVE(), ATrafficLightManager::SpawnSignals(), and ATrafficLightManager::SpawnTrafficLights().
|
overrideprotected |
Definition at line 92 of file CarlaGameModeBase.cpp.
References UCarlaSettingsDelegate::ApplyQualityLevelPostRestart(), UCarlaEpisode::bIsPrimaryServer, CarlaSettingsDelegate, Episode, ASkyBase::FallbackSkyTag, GameInstance, ALargeMapManager::GenerateLargeMap(), UCarlaGameInstance::GetCarlaEngine(), ALargeMapManager::GetNumTiles(), InitGame(), ALargeMapManager::LargeMapName, LMManager, LoadGeoReference(), UCarlaEpisode::MapName, UCarlaGameInstance::NotifyInitGame(), FCarlaStaticDelegates::OnEpisodeSettingsChange, OnEpisodeSettingsChanged(), OnEpisodeSettingsChangeHandle, Recorder, UTaggerDelegate::RegisterSpawnHandler(), UCarlaSettingsDelegate::RegisterSpawnHandler(), ACarlaRecorder::SetEpisode(), UCarlaEpisode::SetRecorder(), SpawnActorFactories(), TaggerDelegate, UCarlaEpisode::Weather, and WeatherClass.
Referenced by InitGame().
|
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().
| void ACarlaGameModeBase::LoadMapLayer | ( | int32 | MapLayers | ) |
Definition at line 921 of file CarlaGameModeBase.cpp.
References ConvertMapLayerMaskToMapNames(), LatentInfoUUID, LoadedMapLayers, and PendingLevelsToLoad.
Referenced by BeginPlay(), FCarlaServer::FPimpl::BindActions(), and FFrameData::PlayMapLayers().
|
private |
Definition at line 1072 of file CarlaGameModeBase.cpp.
References CarlaSettingsDelegate, FEpisodeSettings::MaxCullingDistance, and UCarlaSettingsDelegate::SetAllActorsDrawDistance().
Referenced by InitGame().
|
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().
| void ACarlaGameModeBase::OnLoadStreamLevel | ( | ) |
Definition at line 1050 of file CarlaGameModeBase.cpp.
References PendingLevelsToLoad, ReadyToRegisterObjects, RegisterEnvironmentObjects(), and ATagger::TagActorsInLevel().
| void ACarlaGameModeBase::OnUnloadStreamLevel | ( | ) |
Definition at line 1062 of file CarlaGameModeBase.cpp.
References PendingLevelsToUnLoad, ReadyToRegisterObjects, and RegisterEnvironmentObjects().
|
private |
Definition at line 663 of file CarlaGameModeBase.cpp.
References Episode, UOpenDrive::GetXODR(), carla::opendrive::OpenDriveParser::Load(), Map, and UCarlaEpisode::MapGeoProjection.
Referenced by LoadGeoReference().
| void ACarlaGameModeBase::RegisterEnvironmentObjects | ( | ) |
Definition at line 867 of file CarlaGameModeBase.cpp.
References DisabledEnvironmentObjects, EnvironmentObjectsRegistrations, EnvironmentObjectsSerial, UObjectRegister::FindEnvironmentObjects(), UObjectRegister::FindEnvironmentObjectsOf(), ObjectRegister, and UObjectRegister::RegisterObjects().
Referenced by BeginPlay(), OnLoadStreamLevel(), and OnUnloadStreamLevel().
|
overrideprotected |
Definition at line 259 of file CarlaGameModeBase.cpp.
References UCarlaSettingsDelegate::ApplyQualityLevelPreRestart(), and CarlaSettingsDelegate.
|
private |
Definition at line 611 of file CarlaGameModeBase.cpp.
References ActorFactories, ActorFactoryInstances, Episode, and UCarlaEpisode::RegisterActorFactory().
Referenced by InitGame().
|
protected |
Definition at line 634 of file CarlaGameModeBase.cpp.
References GenerateSpawnPoints(), and SpawnPointsTransforms.
Referenced by LoadGeoReference(), and AAutowareGameModeBase::LoadGeoReference().
|
overrideprotected |
Definition at line 555 of file CarlaGameModeBase.cpp.
References Recorder, and Tick().
Referenced by Tick().
| void ACarlaGameModeBase::UnLoadMapLayer | ( | int32 | MapLayers | ) |
Definition at line 947 of file CarlaGameModeBase.cpp.
References ConvertMapLayerMaskToMapNames(), LatentInfoUUID, LoadedMapLayers, and PendingLevelsToUnLoad.
Referenced by FCarlaServer::FPimpl::BindActions(), and FFrameData::PlayMapLayers().
|
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().
|
private |
Definition at line 229 of file CarlaGameModeBase.h.
Referenced by SpawnActorFactories().
|
private |
Definition at line 208 of file CarlaGameModeBase.h.
Referenced by ACarlaGameModeBase(), EndPlay(), InitGame(), OnEpisodeSettingsChanged(), and RestartPlayer().
|
private |
Definition at line 242 of file CarlaGameModeBase.h.
Referenced by EnableEnvironmentObjects(), and RegisterEnvironmentObjects().
|
private |
Definition at line 246 of file CarlaGameModeBase.h.
Referenced by RegisterEnvironmentObjects().
|
private |
Definition at line 244 of file CarlaGameModeBase.h.
Referenced by EnableEnvironmentObjects(), and RegisterEnvironmentObjects().
|
protected |
Definition at line 173 of file CarlaGameModeBase.h.
Referenced by ACarlaGameModeBase(), BeginPlay(), EndPlay(), InitGame(), AAutowareGameModeBase::LoadGeoReference(), ParseOpenDrive(), and SpawnActorFactories().
|
private |
Definition at line 202 of file CarlaGameModeBase.h.
Referenced by BeginPlay(), EndPlay(), and InitGame().
| 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().
|
private |
Definition at line 255 of file CarlaGameModeBase.h.
Referenced by LoadMapLayer(), and UnLoadMapLayer().
|
private |
Definition at line 234 of file CarlaGameModeBase.h.
Referenced by BeginPlay(), and InitGame().
|
private |
Definition at line 248 of file CarlaGameModeBase.h.
Referenced by LoadMapLayer(), and UnLoadMapLayer().
|
private |
Definition at line 238 of file CarlaGameModeBase.h.
Referenced by DebugShowSignals(), GenerateSpawnPoints(), LoadGeoReference(), and ParseOpenDrive().
|
private |
Definition at line 214 of file CarlaGameModeBase.h.
Referenced by ACarlaGameModeBase(), EnableEnvironmentObjects(), and RegisterEnvironmentObjects().
| FOnEpisodeInitialisedDelegate ACarlaGameModeBase::OnEpisodeInitialisedDelegate |
Definition at line 151 of file CarlaGameModeBase.h.
Referenced by BeginPlay().
|
private |
Definition at line 236 of file CarlaGameModeBase.h.
Referenced by EndPlay(), and InitGame().
|
private |
Definition at line 240 of file CarlaGameModeBase.h.
Referenced by BeginPlay(), LoadMapLayer(), and OnLoadStreamLevel().
|
private |
Definition at line 249 of file CarlaGameModeBase.h.
Referenced by OnUnloadStreamLevel(), and UnLoadMapLayer().
|
private |
Definition at line 251 of file CarlaGameModeBase.h.
Referenced by BeginPlay(), OnLoadStreamLevel(), and OnUnloadStreamLevel().
|
private |
Definition at line 211 of file CarlaGameModeBase.h.
Referenced by ACarlaGameModeBase(), BeginPlay(), InitGame(), and Tick().
|
private |
Definition at line 226 of file CarlaGameModeBase.h.
Referenced by GenerateSpawnPoints(), and StoreSpawnPoints().
|
private |
Definition at line 205 of file CarlaGameModeBase.h.
Referenced by ACarlaGameModeBase(), BeginPlay(), and InitGame().
|
private |
Definition at line 232 of file CarlaGameModeBase.h.
Referenced by GetTrafficLightManager(), and OnLevelAddedToWorld().
|
private |
The class of Weather to spawn.
Definition at line 218 of file CarlaGameModeBase.h.
Referenced by InitGame().