Skip to content

Commit

Permalink
add missing CreateDefaultPublisher api (#143) (#144)
Browse files Browse the repository at this point in the history
Co-authored-by: yuokamoto <yuokamoto1988@gmail.com>
  • Loading branch information
github-actions[bot] and yuokamoto committed May 3, 2024
1 parent 3e69d57 commit f7b00dc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Source/rclUE/Public/ROS2Publisher.h
Expand Up @@ -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();
};

Expand Down

0 comments on commit f7b00dc

Please sign in to comment.