From f7b00dca32e47cb24bc862e82630ab409e58979a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 4 May 2024 01:22:11 +0900 Subject: [PATCH] add missing CreateDefaultPublisher api (#143) (#144) Co-authored-by: yuokamoto --- Source/rclUE/Public/ROS2Publisher.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/rclUE/Public/ROS2Publisher.h b/Source/rclUE/Public/ROS2Publisher.h index 291db6b7..bb5230ba 100644 --- a/Source/rclUE/Public/ROS2Publisher.h +++ b/Source/rclUE/Public/ROS2Publisher.h @@ -246,17 +246,19 @@ class RCLUE_API UROS2PublisherComponent : public UActorComponent UPROPERTY(EditAnywhere, BlueprintReadWrite) FTopicCallback UpdateDelegate; - virtual void BeginPlay() override + UFUNCTION(BlueprintCallable) + virtual void DefaultCreatePublisher() { if (Publisher == nullptr) { Publisher = UROS2Publisher::CreateLoopPublisher( this, TopicName, PublisherClass, MsgClass, PublicationFrequencyHz, UpdateDelegate, QoS); } - else - { - UE_LOG_WITH_INFO(LogTemp, Warning, TEXT("Publisher is not created in BeginPlay.")); - } + } + + virtual void BeginPlay() override + { + DefaultCreatePublisher(); Super::BeginPlay(); };