Go to the documentation of this file.
21 #include <Components/ActorComponent.h>
23 #include <CoreMinimal.h>
37 #include "ROS2Publisher.generated.h"
83 static UROS2Publisher* CreateLoopPublisherWithClass(UObject* InOwner,
85 const FString& InTopicName,
87 const TSubclassOf<UROS2Publisher>& InPublisherClass,
89 const float InPubFrequency);
124 const FString& InTopicName,
126 const TSubclassOf<UROS2Publisher>& InPublisherClass,
128 const TSubclassOf<UROS2GenericMsg>& InMsgClass,
130 float InPubFrequency,
132 const FTopicCallback& InUpdateDelegate,
134 const UROS2QoS InQoS = UROS2QoS::Default);
159 const TSubclassOf<UROS2Publisher>& InPublisherClass,
161 const FString& InTopicName = TEXT(
""));
194 const FString& InTopicName,
196 const TSubclassOf<UROS2Publisher>& InPublisherClass,
198 const TSubclassOf<UROS2GenericMsg>& InMsgClass,
200 float InPubFrequency,
202 const UROS2QoS InQoS = UROS2QoS::Default);
230 const FString& InTopicName,
232 const TSubclassOf<UROS2Publisher>& InPublisherClass,
234 const TSubclassOf<UROS2GenericMsg>& InMsgClass,
236 float InPubFrequency,
238 const rmw_qos_profile_t& InCustomQoS);
255 void UpdateAndPublish();
288 template<
typename TUEMessage,
typename TUEStruct>
304 CastChecked<TUEMessage>(TopicMessage)->SetMsg(InMessageData);
351 void StopPublishTimer();
368 void StartPublishTimer();
379 float PublicationFrequencyHz = 1.f;
432 void SetDefaultDelegates();
451 void SetDelegates(
const FTopicCallback& InUpdateDelegate);
470 const void* PublishedMsg =
nullptr;
542 FString TopicName = TEXT(
"");
553 TSubclassOf<UROS2Publisher> PublisherClass = UROS2Publisher::StaticClass();
564 TSubclassOf<UROS2GenericMsg> MsgClass = UROS2GenericMsg::StaticClass();
575 float PublicationFrequencyHz = 1.f;
610 if (Publisher ==
nullptr)
616 this, TopicName, PublisherClass, MsgClass, PublicationFrequencyHz, UpdateDelegate, QoS);
624 virtual void BeginPlay()
override
628 DefaultCreatePublisher();
651 if (Publisher !=
nullptr)
659 Publisher->
QoS = QoS;
714 FString TopicName = TEXT(
"");
725 TSubclassOf<UROS2Publisher> PublisherClass = UROS2Publisher::StaticClass();
736 float PublicationFrequencyHz = 1.f;
749 if (Publisher ==
nullptr)
759 virtual void BeginPlay()
override
763 DefaultCreatePublisher();
FTopicCallback UpdateDelegate
Delegate which is Bound with UpdateMessage by SetDefaultDelegates.
Definition: ROS2Publisher.h:390
Custom timer manager. This try to execute delegate at a given fixed rate.
Definition: rclcUtilities.h:356
FTopicCallback UpdateDelegate
this is pass to UROS2Publisher::UpdateDelegate in #BeginPlay
Definition: ROS2Publisher.h:597
virtual void UpdateMessage(UROS2GenericMsg *InMessage)
Update msg. Should be implemented in child class.
Definition: ROS2Publisher.h:409
ROS2 Publisher class.
Definition: ROS2Publisher.h:54
virtual void SetParams()
Pass this class's parameter TopicName, PublicationFrequencyHz, QoS to Publisher.
Definition: ROS2Publisher.h:647
#define UE_LOG_WITH_INFO(CategoryName, Verbosity,...)
Definition: logUtilities.h:83
FString TopicName
this information is redundant with Topic, but it's needed to initialize it
Definition: ROS2Topic.h:172
virtual void Destroy()
Destroy topic and TopicMessage.
UROS2QoS
used to set QoS policies
Definition: rclcUtilities.h:177
virtual void DefaultCreatePublisher()
Definition: ROS2Publisher.h:745
UROS2QoS QoS
Quality of service.
Definition: ROS2Topic.h:218
void Publish(const TUEStruct &InMessageData)
Publish a message.
Definition: ROS2Publisher.h:290
static UROS2Publisher * CreateLoopPublisherWithClass(UObject *InOwner, const FString &InTopicName, const TSubclassOf< UROS2Publisher > &InPublisherClass, const float InPubFrequency)
Create a new UROS2Publisher of custom publisher class and andd to Node.
static UROS2Publisher * CreateLoopPublisher(UObject *InOwner, const FString &InTopicName, const TSubclassOf< UROS2Publisher > &InPublisherClass, const TSubclassOf< UROS2GenericMsg > &InMsgClass, float InPubFrequency, const FTopicCallback &InUpdateDelegate, const UROS2QoS InQoS=UROS2QoS::Default)
Create a Loop Publisher object.
virtual void InitializeTopicComponent()
Initialize ROS2 Topic. Should be implemented in UROS2Publisher and UROS2Subscriber.
Class implementing ROS2 topic.
ROS2 topic class. Parent class of UROS2Publisher and UROS2Subscriber.
Definition: ROS2Topic.h:88
This should be refactored with other generic ROS2 types (Msgs, Sensors, Actions).
float PublicationFrequencyHz
Publish frequency. if this value > 0, this will update and publish msg periodically.
Definition: ROS2Publisher.h:379
FTimerHandle TimerHandle
Timer handler for periodic publisher.
Definition: ROS2Publisher.h:464
#define UE_LOG_WITH_INFO_NAMED(CategoryName, Verbosity,...)
Definition: logUtilities.h:139
@ Initialized
UMETA(DisplayName = "Created"),.
Definition: rclcUtilities.h:158
This should be refactored with other generic ROS2 types (Msgs, Sensors, Actions).
Definition: ROS2GenericMsg.h:46
ROS2 Publisher Component. Wrapper of UROS2Publisher for BP.
Definition: ROS2Publisher.h:518
ROS2 Custom Publisher Component. Wrapper of UROS2Publisher for BP.
Definition: ROS2Publisher.h:690
Class implementing ROS2 node.
virtual void DefaultCreatePublisher()
Definition: ROS2Publisher.h:606
rcl_publisher_t RclPublisher
ROS2 publisher.
Definition: ROS2Publisher.h:476