rclUE
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
UROS2Publisher Class Reference

ROS2 Publisher class. More...

#include <ROS2Publisher.h>

Inheritance diagram for UROS2Publisher:
Inheritance graph
[legend]
Collaboration diagram for UROS2Publisher:
Collaboration graph
[legend]

Public Member Functions

void UpdateAndPublish ()
 Update Msg with delegate and publish msg. More...
 
void Publish ()
 Publish msg. More...
 
template<typename TUEMessage , typename TUEStruct >
void Publish (const TUEStruct &InMessageData)
 Publish a message. More...
 
virtual void Destroy ()
 Destroy publisher with rcl_publisher_fini. More...
 
void StopPublishTimer ()
 Stope publishing timer. More...
 
void StartPublishTimer ()
 Start publishing topic with PublicationFrequencyHz. More...
 
virtual void UpdateMessage (UROS2GenericMsg *InMessage)
 Update msg. Should be implemented in child class. More...
 
void SetDefaultDelegates ()
 Bind UpdateMessage with UpdateDelegate. More...
 
void SetDelegates (const FTopicCallback &InUpdateDelegate)
 Set the Delegates object. More...
 
- Public Member Functions inherited from UROS2Topic
virtual bool InitializeWithROS2 (UROS2NodeComponent *InROS2Node)
 Initialize Topic with ROS2Node. More...
 
virtual bool Init ()
 Initialize topic, InitializeMessage and InitializeTopicComponent. More...
 
virtual bool InitializeMessage ()
 Create TopicMessage instance and initialize it. More...
 

Static Public Member Functions

static UROS2PublisherCreateLoopPublisherWithClass (UObject *InOwner, const FString &InTopicName, const TSubclassOf< UROS2Publisher > &InPublisherClass, const float InPubFrequency)
 Create a new UROS2Publisher of custom publisher class and andd to Node. More...
 
static UROS2PublisherCreateLoopPublisher (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. More...
 
static UROS2PublisherCreatePublisherWithClass (UObject *InOwner, const TSubclassOf< UROS2Publisher > &InPublisherClass, const FString &InTopicName=TEXT(""))
 Create a new UROS2Publisher and add to Node. More...
 
static UROS2PublisherCreatePublisher (UObject *InOwner, const FString &InTopicName, const TSubclassOf< UROS2Publisher > &InPublisherClass, const TSubclassOf< UROS2GenericMsg > &InMsgClass, float InPubFrequency, const UROS2QoS InQoS=UROS2QoS::Default)
 Create a new UROS2Publisher of custom type. More...
 

Public Attributes

float PublicationFrequencyHz = 1.f
 Publish frequency. if this value > 0, this will update and publish msg periodically. More...
 
FTopicCallback UpdateDelegate
 Delegate which is Bound with UpdateMessage by SetDefaultDelegates. More...
 
- Public Attributes inherited from UROS2Topic
FString TopicName
 this information is redundant with Topic, but it's needed to initialize it More...
 
TSubclassOf< UROS2GenericMsgMsgClass
 this information is redundant with Topic, but it's needed to initialize it More...
 
UROS2NodeComponentOwnerNode = nullptr
 ROS2Node which own this topic. More...
 
TEnumAsByte< UROS2StateState = UROS2State::Created
 State. More...
 
UROS2QoS QoS = UROS2QoS::Default
 Quality of service. More...
 
UROS2GenericMsgTopicMessage
 Message Instance. More...
 

Protected Member Functions

virtual void InitializeTopicComponent ()
 Initialize Publisher and start timer. More...
 

Protected Attributes

FTimerHandle TimerHandle
 Timer handler for periodic publisher. More...
 
const void * PublishedMsg = nullptr
 Last published msg.
 
rcl_publisher_t RclPublisher
 ROS2 publisher.
 
URRTimerManagerTimerManager = nullptr
 Timer Manager. More...
 

Detailed Description

ROS2 Publisher class.

UCLASS(ClassGroup = (Custom), Blueprintable, BlueprintType, meta = (BlueprintSpawnableComponent))

Member Function Documentation

◆ CreateLoopPublisher()

static UROS2Publisher* 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 
)
static

Create a Loop Publisher object.

Parameters
InOwner
InTopicNameTopic name
InPublisherClassCustom output publisher type class
InMsgClassCustom message type class
InPubFrequencyPublishing frequency
InUpdateDelegate
InQoS
Returns
UROS2Publisher*

UFUNCTION(BlueprintCallable)

◆ CreateLoopPublisherWithClass()

static UROS2Publisher* UROS2Publisher::CreateLoopPublisherWithClass ( UObject *  InOwner,
const FString &  InTopicName,
const TSubclassOf< UROS2Publisher > &  InPublisherClass,
const float  InPubFrequency 
)
static

Create a new UROS2Publisher of custom publisher class and andd to Node.

Custom Publisher class is expected to override #UROS2Publisher::Update which in loop with frequency.

Parameters
InOwner
InTopicNameTopic name
InPublisherClassCustom output publisher type class
InPubFrequencyPublishing frequency

UFUNCTION(BlueprintCallable)

◆ CreatePublisher()

static UROS2Publisher* UROS2Publisher::CreatePublisher ( UObject *  InOwner,
const FString &  InTopicName,
const TSubclassOf< UROS2Publisher > &  InPublisherClass,
const TSubclassOf< UROS2GenericMsg > &  InMsgClass,
float  InPubFrequency,
const UROS2QoS  InQoS = UROS2QoS::Default 
)
static

Create a new UROS2Publisher of custom type.

Parameters
InOwner
InTopicNameTopic name
InPublisherClassCustom output publisher type class
InMsgClassCustom message type class
InPubFrequencyPublishing frequency
InQoS
Returns
UROS2Publisher*

UFUNCTION(BlueprintCallable)

◆ CreatePublisherWithClass()

static UROS2Publisher* UROS2Publisher::CreatePublisherWithClass ( UObject *  InOwner,
const TSubclassOf< UROS2Publisher > &  InPublisherClass,
const FString &  InTopicName = TEXT("") 
)
static

Create a new UROS2Publisher and add to Node.

Parameters
InOwner
InPublisherClass
InTopicName
Returns
UROS2Publisher*

UFUNCTION(BlueprintCallable)

◆ Destroy()

virtual void UROS2Publisher::Destroy ( )
virtual

Destroy publisher with rcl_publisher_fini.

Reimplemented from UROS2Topic.

◆ InitializeTopicComponent()

virtual void UROS2Publisher::InitializeTopicComponent ( )
protectedvirtual

Initialize Publisher and start timer.

Reimplemented from UROS2Topic.

◆ Publish() [1/2]

void UROS2Publisher::Publish ( )

◆ Publish() [2/2]

template<typename TUEMessage , typename TUEStruct >
void UROS2Publisher::Publish ( const TUEStruct &  InMessageData)
inline

Publish a message.

Template Parameters
TMessageStruct
Parameters
InMessage

◆ SetDefaultDelegates()

void UROS2Publisher::SetDefaultDelegates ( )

◆ SetDelegates()

void UROS2Publisher::SetDelegates ( const FTopicCallback &  InUpdateDelegate)

Set the Delegates object.

Parameters
InUpdateDelegate

UFUNCTION(BlueprintCallable)

◆ StartPublishTimer()

void UROS2Publisher::StartPublishTimer ( )

◆ StopPublishTimer()

void UROS2Publisher::StopPublishTimer ( )

Stope publishing timer.

UFUNCTION(BlueprintCallable)

◆ UpdateAndPublish()

void UROS2Publisher::UpdateAndPublish ( )

Update Msg with delegate and publish msg.

UFUNCTION(BlueprintCallable)

◆ UpdateMessage()

virtual void UROS2Publisher::UpdateMessage ( UROS2GenericMsg InMessage)
inlinevirtual

Update msg. Should be implemented in child class.

Parameters
InMessageInput Message.

UFUNCTION()

Member Data Documentation

◆ PublicationFrequencyHz

float UROS2Publisher::PublicationFrequencyHz = 1.f

Publish frequency. if this value > 0, this will update and publish msg periodically.

UPROPERTY(EditAnywhere, BlueprintReadWrite)

◆ TimerHandle

FTimerHandle UROS2Publisher::TimerHandle
protected

Timer handler for periodic publisher.

UPROPERTY(VisibleAnywhere, BlueprintReadOnly)

◆ TimerManager

URRTimerManager* UROS2Publisher::TimerManager = nullptr
protected

Timer Manager.

UPROPERTY()

◆ UpdateDelegate

FTopicCallback UROS2Publisher::UpdateDelegate

The documentation for this class was generated from the following file: