RapyutaSimulationPlugins
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
ARRBaseActor Class Reference

Base actor class for all Rapyuta Sim actors: More...

#include <RRBaseActor.h>

Inheritance diagram for ARRBaseActor:
Inheritance graph
[legend]
Collaboration diagram for ARRBaseActor:
Collaboration graph
[legend]

Public Member Functions

 ARRBaseActor ()
 Construct a new ARRBaseActor object. More...
 
 ARRBaseActor (const FObjectInitializer &ObjectInitializer)
 Construct a new ARRBaseActor object. More...
 
void SetupDefaultBase ()
 Initialize default components being configurable in child BP classes. More...
 
void SetEntityModelName (const FString &InEntityModelName)
 
bool IsDataSynthEntity () const
 
template<typename TActorSpawnInfo >
bool InitializeWithSpawnInfo (const TActorSpawnInfo &InActorInfo)
 ACTOR INTIALIZING GENERAL INFO (Unique name, mesh list, material list, etc.) More...
 
virtual bool Initialize ()
 Set #GameMode #GameState #GameSingleton #PlayerController. More...
 
virtual bool HasInitialized (bool bIsLogged=false) const
 
virtual void Reset ()
 Rest. Calls #ActorInfo::ClearMeshInfo. More...
 
void SetTickEnabled (bool bInIsTickEnabled)
 Use URRUObjectUtils::SetupActorTick. More...
 
virtual void GetLifetimeReplicatedProps (TArray< FLifetimeProperty > &OutLifetimeProps) const override
 Returns the properties used for network replication, this needs to be overridden by all actor classes with native. More...
 

Public Attributes

TSharedPtr< FRRActorSpawnInfoActorInfo = nullptr
 
ARRGameStateRRGameState = nullptr
 Pointer for convinience. Since this pointer can be nullptr, you need null check before using. More...
 
URRGameSingletonRRGameSingleton = nullptr
 Pointer for convinience. Since this pointer can be nullptr, you need null check before using. More...
 
ARRGameModeRRGameMode = nullptr
 Pointer for convinience. Since this pointer can be nullptr, you need null check before using. More...
 
ARRPlayerControllerRRPlayerController = nullptr
 Pointer for convinience. Since this pointer can be nullptr, you need null check before using. More...
 
int8 SceneInstanceId = URRActorCommon::DEFAULT_SCENE_INSTANCE_ID
 
URRActorCommonActorCommon = nullptr
 
FString EntityUniqueName
 Actually Object's Name is also unique as noted by UE, but we just do not want to rely on it. More...
 
FString EntityModelName
 
FTimerHandle GenericTimerHandle
 

Static Public Attributes

static TMap< UClass *, TUniquePtr< std::once_flag > > OnceFlagList
 [std::once_flag] also applies even in case of consecutive PIE runs, More...
 
static std::once_flag OnceFlag
 Used for class having single-branch child classes (linear inheritance tree) More...
 
static int8 SSceneInstanceId
 

Protected Member Functions

virtual void PreInitializeComponents () override
 Set #GameMode #GameState #GameSingleton #PlayerController. More...
 
virtual void PrintSimConfig () const
 Print class members' values configured in RapyutaSimSettings.ini. More...
 
virtual void DoGlobalConfig ()
 Globally config custom setups (eg. Exec() cmds) applied for all instances of this class. More...
 

Detailed Description

Base actor class for all Rapyuta Sim actors:

[ActorCommon] of the Scene instance it belongs to.

UCLASS()

Constructor & Destructor Documentation

◆ ARRBaseActor() [1/2]

ARRBaseActor::ARRBaseActor ( )

Construct a new ARRBaseActor object.

UE has a very special way of having [AActor] instantiated, in which

default object is always created as the editor is loaded up.

Hence, it's recommended not to put particular Actor's content instantiation or initialization inside ctor,

especially if those contents (eg child mesh components) rely on sim's global resources, which are initialized later during

sim start-up!

Please put them in [Initialize()] instead!

◆ ARRBaseActor() [2/2]

ARRBaseActor::ARRBaseActor ( const FObjectInitializer &  ObjectInitializer)

Construct a new ARRBaseActor object.

Parameters
ObjectInitializer

Member Function Documentation

◆ DoGlobalConfig()

virtual void ARRBaseActor::DoGlobalConfig ( )
inlineprotectedvirtual

Globally config custom setups (eg. Exec() cmds) applied for all instances of this class.

◆ GetLifetimeReplicatedProps()

virtual void ARRBaseActor::GetLifetimeReplicatedProps ( TArray< FLifetimeProperty > &  OutLifetimeProps) const
overridevirtual

Returns the properties used for network replication, this needs to be overridden by all actor classes with native.

replicated properties

Parameters
OutLifetimePropsOutput lifetime properties

Reimplemented in ARRBaseRobot, ARobotVehicle, and ATurtlebotBurgerVehicle.

◆ HasInitialized()

virtual bool ARRBaseActor::HasInitialized ( bool  bIsLogged = false) const
virtual

Reimplemented in ARRMeshActor.

◆ Initialize()

virtual bool ARRBaseActor::Initialize ( )
virtual

Set #GameMode #GameState #GameSingleton #PlayerController.

(NOTE) This method, if being called, could only go with a RRGameMode-inheriting game mode setup!

Currently, ARRROS2GameMode & ARRGameMode are separate ones.

& Maps of ARRROS2GameMode do NOT YET have actors invoking this method.

It is up to the Child class, [Initialize()] could be run inside [BeginPlay()] or some place else in advance!

ALSO, DUE TO BEING VIRTUAL, CANNOT BE MERGED WITH [InitializeWithSpawnInfo()]

Returns
true
false

Reimplemented in ARRSceneDirector, ARRCamera, and ARRMeshActor.

◆ InitializeWithSpawnInfo()

template<typename TActorSpawnInfo >
bool ARRBaseActor::InitializeWithSpawnInfo ( const TActorSpawnInfo &  InActorInfo)
inline

ACTOR INTIALIZING GENERAL INFO (Unique name, mesh list, material list, etc.)

NOTE: This allows child actor to create custom ActorSpawnInfo of its own

Template Parameters
TActorSpawnInfo
Parameters
InActorInfo
Returns
true
false

◆ IsDataSynthEntity()

bool ARRBaseActor::IsDataSynthEntity ( ) const
inline

◆ PreInitializeComponents()

virtual void ARRBaseActor::PreInitializeComponents ( )
overrideprotectedvirtual

Set #GameMode #GameState #GameSingleton #PlayerController.

Reimplemented in ARRBaseRobot, ATurtlebotBurgerVehicle, and ARobotVehicle.

◆ PrintSimConfig()

virtual void ARRBaseActor::PrintSimConfig ( ) const
inlineprotectedvirtual

Print class members' values configured in RapyutaSimSettings.ini.

Reimplemented in ARRCamera.

◆ Reset()

virtual void ARRBaseActor::Reset ( )
virtual

Rest. Calls #ActorInfo::ClearMeshInfo.

Reimplemented in ARRMeshActor.

◆ SetEntityModelName()

void ARRBaseActor::SetEntityModelName ( const FString &  InEntityModelName)
inline

◆ SetTickEnabled()

void ARRBaseActor::SetTickEnabled ( bool  bInIsTickEnabled)

Use URRUObjectUtils::SetupActorTick.

Parameters
bInIsTickEnabled

◆ SetupDefaultBase()

void ARRBaseActor::SetupDefaultBase ( )

Initialize default components being configurable in child BP classes.

Could only be called in constructor.

Member Data Documentation

◆ ActorCommon

URRActorCommon* ARRBaseActor::ActorCommon = nullptr

◆ ActorInfo

TSharedPtr<FRRActorSpawnInfo> ARRBaseActor::ActorInfo = nullptr

◆ EntityModelName

FString ARRBaseActor::EntityModelName

◆ EntityUniqueName

FString ARRBaseActor::EntityUniqueName

Actually Object's Name is also unique as noted by UE, but we just do not want to rely on it.

Instead, we use [EntityUniqueName] to make the robot id control more indpendent of ue internal name handling.

Reasons:

  • An Actor's Name could get updated as its Label is updated
  • In pending-kill state, GetName() goes to [None]

UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = "true"), Replicated)

◆ GenericTimerHandle

FTimerHandle ARRBaseActor::GenericTimerHandle

◆ OnceFlag

std::once_flag ARRBaseActor::OnceFlag
static

Used for class having single-branch child classes (linear inheritance tree)

◆ OnceFlagList

TMap<UClass*, TUniquePtr<std::once_flag> > ARRBaseActor::OnceFlagList
static

[std::once_flag] also applies even in case of consecutive PIE runs,

thus if running in PIE and the called function is required to run again each time (though still once per PIE) then,

another (context-specific) method (without using [static res]) should be considered!

Used for class having multiple-branch child classes (multiple-branch inheritance tree)

◆ RRGameMode

ARRGameMode* ARRBaseActor::RRGameMode = nullptr

Pointer for convinience. Since this pointer can be nullptr, you need null check before using.

UPROPERTY()

◆ RRGameSingleton

URRGameSingleton* ARRBaseActor::RRGameSingleton = nullptr

Pointer for convinience. Since this pointer can be nullptr, you need null check before using.

UPROPERTY()

◆ RRGameState

ARRGameState* ARRBaseActor::RRGameState = nullptr

Pointer for convinience. Since this pointer can be nullptr, you need null check before using.

UPROPERTY()

◆ RRPlayerController

ARRPlayerController* ARRBaseActor::RRPlayerController = nullptr

Pointer for convinience. Since this pointer can be nullptr, you need null check before using.

UPROPERTY()

◆ SceneInstanceId

int8 ARRBaseActor::SceneInstanceId = URRActorCommon::DEFAULT_SCENE_INSTANCE_ID

◆ SSceneInstanceId

int8 ARRBaseActor::SSceneInstanceId
static

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