RapyutaSimulationPlugins
RRROS2GameMode.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 
16 
17 // UE
18 
19 #include "Engine/EngineTypes.h"
20 
21 #include "GameFramework/GameMode.h"
22 
24 
25 
26 
27 // RapyutaSimulationPlugins
28 
30 
31 #include "Tools/SimulationState.h"
32 
33 
34 
35 #include "RRROS2GameMode.generated.h"
36 
37 
38 
39 class AROS2Node;
40 
42 
43 
44 
45 DECLARE_MULTICAST_DELEGATE(FRROnROS2Initialized);
46 
47 
48 
64 class RAPYUTASIMULATIONPLUGINS_API ARRROS2GameMode : public AGameMode
65 
66 {
67 
68 
69 
70 public:
71 
73 
74 
75 
77 
78 
83  UROS2NodeComponent* MainROS2Node = nullptr;
84 
85 
86 
88 
89 
94  FString MainROS2NodeName = TEXT("UEROS2Node");
95 
96 
97 
99 
100 
105  URRROS2ClockPublisher* ClockPublisher = nullptr;
106 
107 
108 
110 
111 
116  ASimulationState* MainSimState = nullptr;
117 
118 
119 
121 
123 
124 
129  URRROS2SimulationStateClient* MainROS2SimStateClient = nullptr;
130 
131 
132 
134 
135 
140  TSubclassOf<URRROS2SimulationStateClient> ROS2SimStateClientClass = URRROS2SimulationStateClient::StaticClass();
141 
142 
143 
145 
146  FRROnROS2Initialized OnROS2Initialized;
147 
165  virtual void SetFixedTimeStep(const float InStepSize);
166 
167 
168 
184  virtual float GetFixedTimeStep() const;
185 
186 
187 
203  virtual void SetTargetRTF(const float InTargetRTF);
204 
205 
206 
222  virtual float GetTargetRTF() const;
223 
224 
225 
232  virtual void PrintSimConfig() const;
233 
234 
235 
242  FString GetSpawnableNativeEntityClassPath(const FString& InEntityModelName) const
243 
244  {
245 
246  return NativeSpawnableClassPaths.FindRef(InEntityModelName);
247 
248  }
249 
250 
251 
252 protected:
253 
272  virtual void InitGame(const FString& InMapName, const FString& InOptions, FString& OutErrorMessage) override;
273 
274 
275 
284  virtual void InitSim();
285 
286 
287 
294  virtual void StartPlay() override;
295 
296 
297 
299 
301 
302 
307  TArray<FString> BPSpawnableClassNames;
308 
309 
310 
312 
314 
315 
320  TMap<FString /*Entity model name*/, FString /*Class path*/> NativeSpawnableClassPaths;
321 
322 
323 
324 private:
325 
334  void InitROS2();
335 
336 };
337 
ASimulationState
Provide ROS 2 interface implementations to interact with UE4.
Definition: SimulationState.h:173
URRROS2ClockPublisher
Clock publisher class. Get elapsed time by UGameplayStatics.
Definition: RRROS2ClockPublisher.h:48
ARRROS2GameMode
ROS 2 GameMode which have Clock publisher and ROS 2 services to interact with ROS 2.
Definition: RRROS2GameMode.h:64
ARRROS2GameMode::GetSpawnableNativeEntityClassPath
FString GetSpawnableNativeEntityClassPath(const FString &InEntityModelName) const
Get corresponding class path of a native entity model from NativeSpawnableClassPaths.
Definition: RRROS2GameMode.h:242
RRLimitRTFFixedSizeCustomTimeStep.h
CustomTimeStep class which uses fixed time step and and limit RTF(Real Time Factor)
SimulationState.h
SimulationState class provides ROS 2 interface implementation to interact with UE4.
RRROS2SimulationStateClient.h
RRROS2SimulationStateClient class provides ROS 2 service interfaces to interact with UE4.
ARRROS2GameMode::BPSpawnableClassNames
TArray< FString > BPSpawnableClassNames
Blueprint class names (also used as their entity model names) to be registered as spawnable entity ty...
Definition: RRROS2GameMode.h:307
DECLARE_MULTICAST_DELEGATE
DECLARE_MULTICAST_DELEGATE(FRROnROS2Initialized)
ARRROS2GameMode::NativeSpawnableClassPaths
TMap< FString, FString > NativeSpawnableClassPaths
Asset paths of classes to be registered as spawnable entity types.
Definition: RRROS2GameMode.h:320
URRROS2SimulationStateClient
Provide ROS 2 interfaces to interact with UE4. This provide only ROS 2 interfaces and implementation ...
Definition: RRROS2SimulationStateClient.h:78
ARRROS2GameMode::OnROS2Initialized
FRROnROS2Initialized OnROS2Initialized
Delegate signalling ROS 2 having been initialized with MainROS2Node, MainROS2SimStateClient,...
Definition: RRROS2GameMode.h:146