Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bp create api #141

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Source/rclUE/Public/ROS2ActionClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ class RCLUE_API UROS2ActionClientComponent : public UActorComponent
FActionCallback FeedbackDelegate;
FSimpleCallback CancelResponseDelegate;

virtual void BeginPlay() override
UFUNCTION(BlueprintCallable)
virtual void DefaultCreateActionClient()
{
if (ActionClient == nullptr)
{
Expand All @@ -202,6 +203,11 @@ class RCLUE_API UROS2ActionClientComponent : public UActorComponent
FeedbackQoS,
CancelQoS);
}
}

virtual void BeginPlay() override
{
DefaultCreateActionClient();
Super::BeginPlay();
};
};
8 changes: 7 additions & 1 deletion Source/rclUE/Public/ROS2ActionServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ class RCLUE_API UROS2ActionServerComponent : public UActorComponent
FSimpleCallback ResultDelegate;
FSimpleCallback CancelDelegate;

virtual void BeginPlay() override
UFUNCTION(BlueprintCallable)
virtual void DefaultCreateActionServer()
{
if (ActionServer == nullptr)
{
Expand All @@ -171,6 +172,11 @@ class RCLUE_API UROS2ActionServerComponent : public UActorComponent
FeedbackQoS,
CancelQoS);
}
}

virtual void BeginPlay() override
{
DefaultCreateActionServer();
Super::BeginPlay();
};
};
11 changes: 6 additions & 5 deletions Source/rclUE/Public/ROS2Publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,17 @@ class RCLUE_API UROS2CustomPublisherComponent : public UActorComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float PublicationFrequencyHz = 1.f;

virtual void BeginPlay() override
UFUNCTION(BlueprintCallable)
virtual void DefaultCreatePublisher()
{
if (Publisher == nullptr)
{
Publisher = UROS2Publisher::CreateLoopPublisherWithClass(this, TopicName, PublisherClass, PublicationFrequencyHz);
}
else
{
UE_LOG_WITH_INFO(LogTemp, Warning, TEXT("Publisher class is not created in BeginPlay."));
}
}
virtual void BeginPlay() override
{
DefaultCreatePublisher();
Super::BeginPlay();
};
};
7 changes: 6 additions & 1 deletion Source/rclUE/Public/ROS2ServiceClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,17 @@ class RCLUE_API UROS2ServiceClientComponent : public UActorComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FServiceCallback ResponseDelegate;

virtual void BeginPlay() override
UFUNCTION(BlueprintCallable)
virtual void DefaultCreateServiceClient()
{
if (ServiceClient == nullptr)
{
ServiceClient = UROS2ServiceClient::CreateServiceClient(this, ServiceName, SrvClass, ResponseDelegate, QoS);
}
}
virtual void BeginPlay() override
{
DefaultCreateServiceClient();
Super::BeginPlay();
};
};
7 changes: 6 additions & 1 deletion Source/rclUE/Public/ROS2ServiceServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,17 @@ class RCLUE_API UROS2ServiceServerComponent : public UActorComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FServiceCallback SrvCallback;

virtual void BeginPlay() override
UFUNCTION(BlueprintCallable)
virtual void DefaultCreateServiceServer()
{
if (ServiceServer == nullptr)
{
ServiceServer = UROS2ServiceServer::CreateServiceServer(this, ServiceName, SrvClass, SrvCallback, QoS);
}
}
virtual void BeginPlay() override
{
DefaultCreateServiceServer();
Super::BeginPlay();
};
};
8 changes: 7 additions & 1 deletion Source/rclUE/Public/ROS2Subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,18 @@ class RCLUE_API UROS2SubscriberComponent : public UActorComponent
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FSubscriptionCallback Callback;

virtual void BeginPlay() override
UFUNCTION(BlueprintCallable)
virtual void DefaultCreateSubscriber()
{
if (Subscriber == nullptr)
{
Subscriber = UROS2Subscriber::CreateSubscriber(this, TopicName, MsgClass, Callback, QoS);
}
}

virtual void BeginPlay() override
{
DefaultCreateSubscriber();
Super::BeginPlay();
};
};
Loading