RapyutaSimulationPlugins
|
Provide ROS 2 interface implementations to interact with UE4. More...
#include <SimulationState.h>
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, FRREntities > | EntitiesWithTag |
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< FRREntityInfo > | SpawnableEntityInfoList |
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... | |
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.
ASimulationState::ASimulationState | ( | ) |
Construct a new ASimulationState object.
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&
InSpawnableEntityTypes |
void ASimulationState::AddTaggedEntity | ( | AActor * | InEntity, |
const FName & | InTag | ||
) |
Add an entity with tag.
void ASimulationState::GetSpawnableEntityInfoList | ( | ) |
|
virtual |
Fetch all entities in the current map under control of this Actor.
void ASimulationState::OnRep_EntityList | ( | ) |
Callback when EntityList is replicated.
void ASimulationState::OnRep_SpawnableEntityInfoList | ( | ) |
Callback when SpawnableEntityInfoList is replicated.
void ASimulationState::RegisterSpawnableBPEntities | ( | const TArray< FString > & | InBPSpawnableClassNames | ) |
Register entity types from Blueprint class names, that are configured in ARRROS2GameMode.
void ASimulationState::ServerAddEntity | ( | AActor * | InEntity | ) |
Add Entity to Entities and EntitiesWithTag.
Entity become able to be manipulated by Simulationstate's ROS 2 servs.
InEntity |
void ASimulationState::ServerAttach | ( | const FROSAttachReq & | InRequest | ) |
Attach/detach an entity to/from another on Server.
InRequest |
bool ASimulationState::ServerCheckAttachRequest | ( | const FROSAttachReq & | InRequest | ) |
bool ASimulationState::ServerCheckDeleteRequest | ( | const FROSDeleteEntityReq & | InRequest | ) |
bool ASimulationState::ServerCheckSetEntityStateRequest | ( | const FROSSetEntityStateReq & | InRequest | ) |
Check set-entity-state-request for duplication on server.
bool ASimulationState::ServerCheckSpawnRequest | ( | const FROSSpawnEntityReq & | InRequest | ) |
void ASimulationState::ServerDeleteEntity | ( | const FROSDeleteEntityReq & | InRequest | ) |
void ASimulationState::ServerSetEntityState | ( | const FROSSetEntityStateReq & | InRequest | ) |
AActor* ASimulationState::ServerSpawnEntity | ( | const FROSSpawnEntityReq & | InRequest, |
const int32 | NetworkPlayerId | ||
) |
|
private |
Spawn entity with tag & init nav surrogate.
InROSSpawnRequest | (FROSSpawnEntityReq) |
InEntityClass | |
InEntityTransform | |
InNetworkPlayerId |
|
private |
Verify a function is called from server.
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
TMap<FString, AActor*> ASimulationState::Entities |
All existing entities which can be manipulated by this class via ROS 2 services.
TMap<FName, FRREntities> ASimulationState::EntitiesWithTag |
All existing entities with tags which can be manipulated by this class via ROS 2 services.
TArray<AActor*> ASimulationState::EntityList |
Replicatable copy of Entities.
UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing = OnRep_EntityList)
FTimerHandle ASimulationState::FetchEntityListTimerHandle |
Timer handle to fetch SpawnableEntityInfoList.
FROSAttachReq ASimulationState::PrevAttachEntityRequest |
Cached the previous [Attach] request for duplicated incoming request filtering.
FROSDeleteEntityReq ASimulationState::PrevDeleteEntityRequest |
Cached the previous [DeleteEntity] request for duplicated incoming request filtering.
FROSGetEntityStateReq ASimulationState::PrevGetEntityStateRequest |
Cached the previous [GetEntityState] request for duplicated incoming request filtering.
FROSSetEntityStateReq ASimulationState::PrevSetEntityStateRequest |
Cached the previous [SetEntityState] request for duplicated incoming request filtering.
FROSSpawnEntityReq ASimulationState::PrevSpawnEntityRequest |
Cached the previous [SpawnEntity] request for duplicated incoming request filtering.
TArray<FRREntityInfo> ASimulationState::SpawnableEntityInfoList |
Replicatable Copy of SpawnableEntityTypes.
UPROPERTY(EditAnywhere, ReplicatedUsing = OnRep_SpawnableEntityInfoList)
TMap<FString, TSubclassOf<AActor> > ASimulationState::SpawnableEntityTypes |
Spawnable entity types for SpawnEntity ROS 2 service.