rclUE
ROS2Topic.h
Go to the documentation of this file.
1 
17 #pragma once
18 
19 
20 
21 #include <Components/ActorComponent.h>
22 
23 #include <CoreMinimal.h>
24 
25 
26 
27 // rclUE
28 
29 #include "Msgs/ROS2GenericMsg.h"
30 
31 #include "ROS2NodeComponent.h"
32 
33 
34 
35 #include "ROS2Topic.generated.h"
36 
37 
38 
39 DECLARE_LOG_CATEGORY_EXTERN(LogROS2Topic, Log, All);
40 
41 
42 
55 #define IS_TOPIC_INITED(InNode, InName, OutRes) \
56 
57  IS_ROS2NODE_INITED(InNode, InName, OutRes); \
58 
59  if (State != UROS2State::Initialized) \
60 
61  { \
62 
63  UE_LOG_WITH_INFO( \
64 
65  LogROS2Topic, Warning, TEXT("[%s] Publisher/Subscriber is not initialized yet. Please initialize Action."), *InName); \
66 
67  OutRes = false; \
68 
69  }
70 
71 
72 
86 class RCLUE_API UROS2Topic : public UObject
87 
88 {
89 
90 
91 
92 public:
93 
104  virtual bool InitializeWithROS2(UROS2NodeComponent* InROS2Node);
105 
106 
107 
125  virtual bool Init();
126 
127 
128 
142  virtual bool InitializeMessage();
143 
144 
145 
159  virtual void Destroy();
160 
161 
162 
164 
165 
170  FString TopicName;
171 
172 
173 
175 
176 
181  TSubclassOf<UROS2GenericMsg> MsgClass;
182 
183 
184 
186 
187 
192  UROS2NodeComponent* OwnerNode = nullptr;
193 
194 
195 
197 
198 
203  TEnumAsByte<UROS2State> State = UROS2State::Created;
204 
205 
206 
208 
210 
211 
216  UROS2QoS QoS = UROS2QoS::Default;
217 
218 
219 
221 
222 
228 
229 
230 
231 protected:
232 
246  virtual void InitializeTopicComponent();
247 
248 };
249 
IS_ROS2NODE_INITED
#define IS_ROS2NODE_INITED(InNode, InName, OutRes)
Check UROS2NodeComponent is initialized or not.
Definition: ROS2NodeComponent.h:731
UROS2QoS
UROS2QoS
used to set QoS policies
Definition: rclcUtilities.h:177
UROS2Topic::MsgClass
TSubclassOf< UROS2GenericMsg > MsgClass
this information is redundant with Topic, but it's needed to initialize it
Definition: ROS2Topic.h:181
UROS2Topic::TopicMessage
UROS2GenericMsg * TopicMessage
Message Instance.
Definition: ROS2Topic.h:227
UROS2NodeComponent
Class implementing ROS2 node.
Definition: ROS2NodeComponent.h:782
UROS2Topic
ROS2 topic class. Parent class of UROS2Publisher and UROS2Subscriber.
Definition: ROS2Topic.h:86
ROS2GenericMsg.h
This should be refactored with other generic ROS2 types (Msgs, Sensors, Actions).
Initialized
@ Initialized
UMETA(DisplayName = "Created"),.
Definition: rclcUtilities.h:158
UROS2GenericMsg
This should be refactored with other generic ROS2 types (Msgs, Sensors, Actions).
Definition: ROS2GenericMsg.h:46
ROS2NodeComponent.h
Class implementing ROS2 node.