rclUE
ROS2Node.h
Go to the documentation of this file.
1 
23 #pragma once
24 
25 
26 
27 // UE
28 
29 #include "Components/ActorComponent.h"
30 
31 #include "Containers/Map.h"
32 
33 #include "CoreMinimal.h"
34 
35 #include "GameFramework/Actor.h"
36 
37 
38 
39 // rclUE
40 
41 #include "ROS2NodeComponent.h"
42 
43 #include "ROS2Service.h"
44 
45 #include "ROS2Subscriber.h"
46 
47 
48 
49 #include "ROS2Node.generated.h"
50 
51 
52 
53 class UROS2Publisher;
54 
55 class UROS2ServiceClient;
56 
57 class UROS2ActionServer;
58 
59 class UROS2ActionClient;
60 
61 
62 
78 struct RCLUE_API FSubscription
79 
80 {
81 
82 
83 
84 public:
85 
86 
91  FString TopicName;
92 
93 
94 
95 
100  TSubclassOf<UROS2GenericMsg> TopicType;
101 
102 
103 
104 
109  UROS2GenericMsg* TopicMsg = nullptr;
110 
111 
112 
113  rcl_subscription_t rcl_subscription;
114 
115 
116 
117  FSubscriptionCallback Callback;
118 
119 
120 
121 
126  bool Ready = false;
127 
128 };
129 
130 
131 
145 struct RCLUE_API FService
146 
147 {
148 
149 
150 
151 public:
152 
153 
158  FString ServiceName;
159 
160 
161 
162 
167  TSubclassOf<UROS2GenericSrv> ServiceType;
168 
169 
170 
171 
176  UROS2GenericSrv* Service = nullptr;
177 
178 
179 
180  rcl_service_t rcl_service;
181 
182 
183 
184  FServiceCallback Callback;
185 
186 
187 
188 
193  bool Ready = false;
194 
195 };
196 
197 
198 
212 class RCLUE_API AROS2Node : public AActor
213 
214 {
215 
216 
217 
218 public:
219 
221 
222  AROS2Node();
223 
224 
225 
226 public:
227 
228  UROS2NodeComponent* ActorComponent = nullptr;
229 
230 
231 
251  rcl_node_t* GetNode();
252 
253 
254 
274  void AddSubscription(const FString& TopicName, TSubclassOf<UROS2GenericMsg> MsgClass, const FSubscriptionCallback& Callback);
275 
276 
277 
293  void AddPublisher(UROS2Publisher* InPublisher);
294 
295 
296 
312  void AddServiceClient(UROS2ServiceClient* InClient);
313 
314 
315 
335  void AddServiceServer(const FString& ServiceName,
336 
337  const TSubclassOf<UROS2GenericSrv> SrvClass,
338 
339  const FServiceCallback& Callback);
340 
341 
342 
358  void AddActionClient(UROS2ActionClient* InActionClient);
359 
360 
361 
377  void AddActionServer(UROS2ActionServer* InActionServer);
378 
379 
380 
381 
386  FString Name = TEXT("node");
387 
388 
389 
390 
395  FString Namespace = TEXT("");
396 
397 
398 
399 private:
400 
401 };
402 
FService
Helper structs which is components of the node and should register to.
Definition: ROS2Node.h:145
AROS2Node
Wrapper Actor implementation of UROS2NodeComponent.
Definition: ROS2Node.h:212
FSubscription::TopicType
TSubclassOf< UROS2GenericMsg > TopicType
Definition: ROS2Node.h:100
UROS2Publisher
ROS2 Publisher class.
Definition: ROS2Publisher.h:54
UROS2ActionServer
Class implementing ROS2 action servers. Wrapper class of rclc action server. Callbacks are set throug...
Definition: ROS2ActionServer.h:56
FSubscription
Helper structs which is components of the node and should register to.
Definition: ROS2Node.h:78
UROS2GenericSrv
This should be refactored with other generic ROS2 types (Msgs, Sensors, Actions).
Definition: ROS2GenericSrv.h:50
UROS2NodeComponent
Class implementing ROS2 node.
Definition: ROS2NodeComponent.h:782
FService::ServiceType
TSubclassOf< UROS2GenericSrv > ServiceType
Definition: ROS2Node.h:167
UROS2ServiceClient
Class implementing ROS2 service clients.
Definition: ROS2ServiceClient.h:62
ROS2Service.h
Class implementing ROS2 service.
ROS2Subscriber.h
Class implementing ROS2 subscribers.
UROS2ActionClient
Class implementing ROS2 action clients. Wrapper class of rclc action client. Callbacks are set throug...
Definition: ROS2ActionClient.h:54
UROS2GenericMsg
This should be refactored with other generic ROS2 types (Msgs, Sensors, Actions).
Definition: ROS2GenericMsg.h:46
ROS2NodeComponent.h
Class implementing ROS2 node.