RapyutaSimulationPlugins
Public Member Functions | Public Attributes | Private Member Functions | List of all members
ASimulationState Class Reference

Provide ROS 2 interface implementations to interact with UE4. More...

#include <SimulationState.h>

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

Public Member Functions

 ASimulationState ()
 Construct a new ASimulationState object. More...
 
void RegisterSpawnableBPEntities (const TArray< FString > &InBPSpawnableClassNames)
 Register entity types from Blueprint class names, that are configured in ARRROS2GameMode. More...
 
virtual void InitEntities ()
 Fetch all entities in the current map under control of this Actor. More...
 
bool ServerCheckSetEntityStateRequest (const FROSSetEntityStateReq &InRequest)
 Check set-entity-state-request for duplication on server. More...
 
void ServerSetEntityState (const FROSSetEntityStateReq &InRequest)
 Set Entity state on server. More...
 
bool ServerCheckAttachRequest (const FROSAttachReq &InRequest)
 Check entity-attach request for duplication on server. More...
 
void ServerAttach (const FROSAttachReq &InRequest)
 Attach/detach an entity to/from another on Server. More...
 
bool ServerCheckSpawnRequest (const FROSSpawnEntityReq &InRequest)
 Check entity-spawn-request for duplication on Server. More...
 
AActor * ServerSpawnEntity (const FROSSpawnEntityReq &InRequest, const int32 NetworkPlayerId)
 Spawn entity on Server. More...
 
bool ServerCheckDeleteRequest (const FROSDeleteEntityReq &InRequest)
 Check delete-entity-request for duplication on Server. More...
 
void ServerDeleteEntity (const FROSDeleteEntityReq &InRequest)
 Delete entity on Server. More...
 
void ServerAddEntity (AActor *InEntity)
 Add Entity to Entities and EntitiesWithTag. More...
 
void AddTaggedEntity (AActor *InEntity, const FName &InTag)
 Add an entity with tag. More...
 
void AddSpawnableEntityTypes (TMap< FString, TSubclassOf< AActor >> InSpawnableEntityTypes)
 Add Entity Types to #SpawnableEntities which can be spawn by SpawnEntity ROS 2 service. More...
 
void OnRep_EntityList ()
 Callback when EntityList is replicated. More...
 
void GetSpawnableEntityInfoList ()
 Fetch SpawnableEntityInfoList. More...
 
void OnRep_SpawnableEntityInfoList ()
 Callback when SpawnableEntityInfoList is replicated. More...
 

Public Attributes

FROSGetEntityStateReq PrevGetEntityStateRequest
 Cached the previous [GetEntityState] request for duplicated incoming request filtering. More...
 
FROSSetEntityStateReq PrevSetEntityStateRequest
 Cached the previous [SetEntityState] request for duplicated incoming request filtering. More...
 
FROSAttachReq PrevAttachEntityRequest
 Cached the previous [Attach] request for duplicated incoming request filtering. More...
 
FROSSpawnEntityReq PrevSpawnEntityRequest
 Cached the previous [SpawnEntity] request for duplicated incoming request filtering. More...
 
FROSDeleteEntityReq PrevDeleteEntityRequest
 Cached the previous [DeleteEntity] request for duplicated incoming request filtering. More...
 
TMap< FString, AActor * > Entities
 All existing entities which can be manipulated by this class via ROS 2 services. More...
 
TMap< FName, FRREntitiesEntitiesWithTag
 All existing entities with tags which can be manipulated by this class via ROS 2 services. More...
 
TArray< AActor * > EntityList
 Replicatable copy of Entities. More...
 
TMap< FString, TSubclassOf< AActor > > SpawnableEntityTypes
 Spawnable entity types for SpawnEntity ROS 2 service. More...
 
TArray< FRREntityInfoSpawnableEntityInfoList
 Replicatable Copy of SpawnableEntityTypes. More...
 
FTimerHandle FetchEntityListTimerHandle
 Timer handle to fetch SpawnableEntityInfoList. More...
 
TMap< FString, std::string > EncodedStrings
 Matches UE strings to original char buffers, for ros messages. More...
 

Private Member Functions

bool VerifyIsServerCall (const FString &InFunctionName)
 Verify a function is called from server. More...
 
AActor * ServerSpawnEntity (const FROSSpawnEntityReq &InROSSpawnRequest, const TSubclassOf< AActor > &InEntityClass, const FTransform &InEntityTransform, const int32 &InNetworkPlayerId)
 Spawn entity with tag & init nav surrogate. More...
 

Detailed Description

Provide ROS 2 interface implementations to interact with UE4.

Supported interactions: Service [GetEntityState, SetEntityState, Attach, SpawnEntity, DeleteEntity]

SimulationState can manipulate only actors in Entities and EntitiesWithTag. All actors in the world are added to Entities and

EntitiesWithTag with InitEntities method and actors can be added to those list by #AddEntity method individually as well.

SimulationState can spawn only actors in #SpawnableEntities which actors can be added to by AddSpawnableEntityTypes.

UCLASS()

Constructor & Destructor Documentation

◆ ASimulationState()

ASimulationState::ASimulationState ( )

Construct a new ASimulationState object.

Member Function Documentation

◆ AddSpawnableEntityTypes()

void ASimulationState::AddSpawnableEntityTypes ( TMap< FString, TSubclassOf< AActor >>  InSpawnableEntityTypes)

Add Entity Types to #SpawnableEntities which can be spawn by SpawnEntity ROS 2 service.

BP callable thus the param could not be const&

Parameters
InSpawnableEntityTypes

UFUNCTION(BlueprintCallable)

◆ AddTaggedEntity()

void ASimulationState::AddTaggedEntity ( AActor *  InEntity,
const FName &  InTag 
)

Add an entity with tag.

UFUNCTION(BlueprintCallable)

◆ GetSpawnableEntityInfoList()

void ASimulationState::GetSpawnableEntityInfoList ( )

◆ InitEntities()

virtual void ASimulationState::InitEntities ( )
virtual

Fetch all entities in the current map under control of this Actor.

UFUNCTION(BlueprintCallable)

◆ OnRep_EntityList()

void ASimulationState::OnRep_EntityList ( )

Callback when EntityList is replicated.

UFUNCTION(BlueprintCallable)

◆ OnRep_SpawnableEntityInfoList()

void ASimulationState::OnRep_SpawnableEntityInfoList ( )

◆ RegisterSpawnableBPEntities()

void ASimulationState::RegisterSpawnableBPEntities ( const TArray< FString > &  InBPSpawnableClassNames)

Register entity types from Blueprint class names, that are configured in ARRROS2GameMode.

UFUNCTION(BlueprintCallable)

◆ ServerAddEntity()

void ASimulationState::ServerAddEntity ( AActor *  InEntity)

Add Entity to Entities and EntitiesWithTag.

Entity become able to be manipulated by Simulationstate's ROS 2 servs.

Parameters
InEntity

UFUNCTION(BlueprintCallable)

◆ ServerAttach()

void ASimulationState::ServerAttach ( const FROSAttachReq &  InRequest)

Attach/detach an entity to/from another on Server.

Parameters
InRequest

UFUNCTION(BlueprintCallable)

◆ ServerCheckAttachRequest()

bool ASimulationState::ServerCheckAttachRequest ( const FROSAttachReq &  InRequest)

Check entity-attach request for duplication on server.

Parameters
InRequest
Todo:
is this necessary?

UFUNCTION(BlueprintCallable)

◆ ServerCheckDeleteRequest()

bool ASimulationState::ServerCheckDeleteRequest ( const FROSDeleteEntityReq &  InRequest)

Check delete-entity-request for duplication on Server.

Todo:
is this necessary?
Parameters
InRequest

UFUNCTION(BlueprintCallable)

◆ ServerCheckSetEntityStateRequest()

bool ASimulationState::ServerCheckSetEntityStateRequest ( const FROSSetEntityStateReq &  InRequest)

Check set-entity-state-request for duplication on server.

Todo:
is this necessary?

UFUNCTION(BlueprintCallable)

◆ ServerCheckSpawnRequest()

bool ASimulationState::ServerCheckSpawnRequest ( const FROSSpawnEntityReq &  InRequest)

Check entity-spawn-request for duplication on Server.

Todo:
is this necessary?
Parameters
InRequest

UFUNCTION(BlueprintCallable)

◆ ServerDeleteEntity()

void ASimulationState::ServerDeleteEntity ( const FROSDeleteEntityReq &  InRequest)

Delete entity on Server.

Todo:
is this necessary?
Parameters
InRequest

UFUNCTION(BlueprintCallable)

◆ ServerSetEntityState()

void ASimulationState::ServerSetEntityState ( const FROSSetEntityStateReq &  InRequest)

Set Entity state on server.

Parameters
InRequest

UFUNCTION(BlueprintCallable)

◆ ServerSpawnEntity() [1/2]

AActor* ASimulationState::ServerSpawnEntity ( const FROSSpawnEntityReq &  InRequest,
const int32  NetworkPlayerId 
)

Spawn entity on Server.

Parameters
InRequest

UFUNCTION(BlueprintCallable)

◆ ServerSpawnEntity() [2/2]

AActor* ASimulationState::ServerSpawnEntity ( const FROSSpawnEntityReq &  InROSSpawnRequest,
const TSubclassOf< AActor > &  InEntityClass,
const FTransform &  InEntityTransform,
const int32 &  InNetworkPlayerId 
)
private

Spawn entity with tag & init nav surrogate.

Parameters
InROSSpawnRequest(FROSSpawnEntityReq)
InEntityClass
InEntityTransform
InNetworkPlayerId
Returns
AActor*

◆ VerifyIsServerCall()

bool ASimulationState::VerifyIsServerCall ( const FString &  InFunctionName)
private

Verify a function is called from server.

Member Data Documentation

◆ EncodedStrings

TMap<FString, std::string> ASimulationState::EncodedStrings

Matches UE strings to original char buffers, for ros messages.

This can be needed for unicode encoded strings in ros message when ROS->UE->ROS conversion does not work well

◆ Entities

TMap<FString, AActor*> ASimulationState::Entities

All existing entities which can be manipulated by this class via ROS 2 services.

Todo:
Converting to TArrays to be able to be replicated

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ EntitiesWithTag

TMap<FName, FRREntities> ASimulationState::EntitiesWithTag

All existing entities with tags which can be manipulated by this class via ROS 2 services.

Todo:
Converting to TArrays to be able to be replicated

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ EntityList

TArray<AActor*> ASimulationState::EntityList

◆ FetchEntityListTimerHandle

FTimerHandle ASimulationState::FetchEntityListTimerHandle

◆ PrevAttachEntityRequest

FROSAttachReq ASimulationState::PrevAttachEntityRequest

Cached the previous [Attach] request for duplicated incoming request filtering.

Todo:
is this necessary?

UPROPERTY(BlueprintReadOnly)

◆ PrevDeleteEntityRequest

FROSDeleteEntityReq ASimulationState::PrevDeleteEntityRequest

Cached the previous [DeleteEntity] request for duplicated incoming request filtering.

Todo:
is this necessary?

UPROPERTY(BlueprintReadOnly)

◆ PrevGetEntityStateRequest

FROSGetEntityStateReq ASimulationState::PrevGetEntityStateRequest

Cached the previous [GetEntityState] request for duplicated incoming request filtering.

Todo:
is this necessary?

UPROPERTY(BlueprintReadOnly)

◆ PrevSetEntityStateRequest

FROSSetEntityStateReq ASimulationState::PrevSetEntityStateRequest

Cached the previous [SetEntityState] request for duplicated incoming request filtering.

Todo:
is this necessary?

UPROPERTY(BlueprintReadOnly)

◆ PrevSpawnEntityRequest

FROSSpawnEntityReq ASimulationState::PrevSpawnEntityRequest

Cached the previous [SpawnEntity] request for duplicated incoming request filtering.

Todo:
is this necessary?

UPROPERTY(BlueprintReadOnly)

◆ SpawnableEntityInfoList

TArray<FRREntityInfo> ASimulationState::SpawnableEntityInfoList

◆ SpawnableEntityTypes

TMap<FString, TSubclassOf<AActor> > ASimulationState::SpawnableEntityTypes

Spawnable entity types for SpawnEntity ROS 2 service.

Todo:
Converting to TArrays to be able to be replicated

UPROPERTY(EditAnywhere, BlueprintReadWrite)


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