rclUE
|
Class implementing ROS2 node. More...
#include <ROS2NodeComponent.h>
Public Member Functions | |
UROS2NodeComponent () | |
A constructor. | |
virtual void | TickComponent (float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override |
Called every frame. More... | |
void | Init () |
Initilize rosnode with rclc_node_init_default. More... | |
void | AddPublisher (UROS2Publisher *InPublisher) |
Set this node to UROS2Publisher::OwnerNode of InPublisher and add to Publishers. More... | |
UROS2Publisher * | CreateLoopPublisherWithClass (const FString &InTopicName, const TSubclassOf< UROS2Publisher > &InPublisherClass, const float InPubFrequency) |
Create a new UROS2Publisher of custom publisher class and add to Node. More... | |
UROS2Publisher * | CreateLoopPublisher (const FString &InTopicName, const TSubclassOf< UROS2Publisher > &InPublisherClass, const TSubclassOf< UROS2GenericMsg > &InMsgClass, const float InPubFrequency, const FTopicCallback &InUpdateDelegate, const UROS2QoS InQoS=UROS2QoS::Default) |
Create a new UROS2Publisher and add to Node. More... | |
UROS2Publisher * | CreatePublisherWithClass (const TSubclassOf< UROS2Publisher > &InPublisherClass, const FString &InTopicName=TEXT("")) |
Create a new UROS2Publisher of custom publisher class and add to Node. More... | |
UROS2Publisher * | CreatePublisher (const FString &InTopicName, const TSubclassOf< UROS2Publisher > &InPublisherClass, const TSubclassOf< UROS2GenericMsg > &InMsgClass, const UROS2QoS InQoS=UROS2QoS::Default) |
Create a new UROS2Publisher and add to Node. More... | |
void | AddSubscription (UROS2Subscriber *InSubscriber) |
Methods to register subscribers. More... | |
UROS2Subscriber * | CreateSubscriber (const FString &InTopicName, const TSubclassOf< UROS2GenericMsg > &InMsgClass, const FSubscriptionCallback &InCallback, const UROS2QoS InQoS=UROS2QoS::Default) |
Create a new UROS2Subscriber and add to Node. More... | |
void | AddServiceClient (UROS2ServiceClient *InServiceClient) |
Set this node to UROS2ServiceClient::OwnerNode and add to ServiceClients. More... | |
UROS2ServiceClient * | CreateServiceClient (const FString &InServiceName, const TSubclassOf< UROS2GenericSrv > &InSrvClass, const FServiceCallback &InResponseDelegate, const UROS2QoS InQoS=UROS2QoS::Services) |
Create a new UROS2ServiceClient and add to Node. More... | |
void | AddServiceServer (UROS2ServiceServer *InServiceServer) |
Create ServiceServer with rcl_service_init and add to ServiceServers. More... | |
UROS2ServiceServer * | CreateServiceServer (const FString &InServiceName, const TSubclassOf< UROS2GenericSrv > &InSrvClass, const FServiceCallback &InCallback, const UROS2QoS InQoS=UROS2QoS::Services) |
Create a new UROS2ServiceServer and add to Node. More... | |
void | AddActionClient (UROS2ActionClient *InActionClient) |
Set this node to UROS2ActionClient::OwnerNode and add to ActionClients. More... | |
UROS2ActionClient * | CreateActionClient (const FString &InActionName, const TSubclassOf< UROS2GenericAction > &InActionClass, const FActionCallback &InGoalResponseDelegate, const FActionCallback &InResultResponseDelegate, const FActionCallback &InFeedbackDelegate, const FSimpleCallback &InCancelResponseDelegate, const UROS2QoS InGoalQoS=UROS2QoS::Services, const UROS2QoS InResultQoS=UROS2QoS::Services, const UROS2QoS InFeedbackQoS=UROS2QoS::Default, const UROS2QoS InCancelQoS=UROS2QoS::Services) |
Create a new UROS2ActionClient and add to Node. More... | |
void | AddActionServer (UROS2ActionServer *InActionServer) |
Set this node to UROS2ActionClient::OwnerNode and add to ActionServers. More... | |
UROS2ActionServer * | CreateActionServer (const FString &InActionName, const TSubclassOf< UROS2GenericAction > &InActionClass, const FActionCallback &InGoalDelegate, const FSimpleCallback &InResultDelegate, const FSimpleCallback &InCancelDelegate, const UROS2QoS InGoalQoS=UROS2QoS::Services, const UROS2QoS InResultQoS=UROS2QoS::Services, const UROS2QoS InFeedbackQoS=UROS2QoS::Default, const UROS2QoS InCancelQoS=UROS2QoS::Services) |
Create a Action Server and add to Node. More... | |
Static Public Member Functions | |
static UROS2NodeComponent * | CreateNewNode (UObject *InOwner, const FString &InNodeName, const FString &InNodeNamespace, const FString &InCompName=TEXT("ROS2NodeComponent"), const bool Init=true) |
Create a New Node object. More... | |
Public Attributes | |
TEnumAsByte< UROS2State > | State = UROS2State::Created |
Node state. More... | |
FString | Name = TEXT("node") |
FString | Namespace = TEXT("") |
int | NGuardConditions = 0 |
wait_set quantities - currently unused More... | |
int | NTimers = 0 |
int | NEvents = 0 |
Protected Member Functions | |
virtual void | EndPlay (const EEndPlayReason::Type EndPlayReason) override |
Overridable function called whenever this actor is being removed from a level. More... | |
void | SpinSome () |
method used to wait on communication and call delegates when appropriate modeled after executor + actions. More... | |
Protected Attributes | |
UROS2Support * | Support |
TArray< UROS2Subscriber * > | Subscriptions |
TArray< UROS2ServiceServer * > | ServiceServers |
TArray< UROS2Publisher * > | Publishers |
TArray< UROS2ServiceClient * > | ServiceClients |
TArray< UROS2ActionClient * > | ActionClients |
TArray< UROS2ActionServer * > | ActionServers |
float | LogLastHit = 0.f |
internal property used to log throttle. More... | |
Private Member Functions | |
void | HandleSubscriptions () |
based on _rclc_default_scheduling of the rclc executor. More... | |
void | HandleServiceServers () |
based on _rclc_default_scheduling of the rclc executor. More... | |
void | HandleServiceClients () |
based on _rclc_default_scheduling of the rclc executor. More... | |
void | HandleActionClients () |
based on _rclc_default_scheduling of the rclc executor. More... | |
void | HandleActionServers () |
based on _rclc_default_scheduling of the rclc executor. More... | |
void | InvalidateWaitSet () |
invalidate #wait_set so that in next spin_some() call the More... | |
Class implementing ROS2 node.
This class also handles tasks performed by the executor in rclc.
Components of the node and not additional distinct entities publishers, subscribers, services, service clients, action servers
and action clients should register to the node with the appropriate methods (Add*).
UCLASS(ClassGroup = (Custom), Blueprintable, meta = (BlueprintSpawnableComponent))
void UROS2NodeComponent::AddActionClient | ( | UROS2ActionClient * | InActionClient | ) |
Set this node to UROS2ActionClient::OwnerNode and add to ActionClients.
InActionClient |
void UROS2NodeComponent::AddActionServer | ( | UROS2ActionServer * | InActionServer | ) |
Set this node to UROS2ActionClient::OwnerNode and add to ActionServers.
InActionServer |
void UROS2NodeComponent::AddPublisher | ( | UROS2Publisher * | InPublisher | ) |
Set this node to UROS2Publisher::OwnerNode of InPublisher and add to Publishers.
InPublisher |
void UROS2NodeComponent::AddServiceClient | ( | UROS2ServiceClient * | InServiceClient | ) |
Set this node to UROS2ServiceClient::OwnerNode and add to ServiceClients.
InClient |
void UROS2NodeComponent::AddServiceServer | ( | UROS2ServiceServer * | InServiceServer | ) |
Create ServiceServer with rcl_service_init and add to ServiceServers.
ServiceName | |
SrvClass | |
Callback |
void UROS2NodeComponent::AddSubscription | ( | UROS2Subscriber * | InSubscriber | ) |
Methods to register subscribers.
TopicName | |
MsgClass | |
Callback |
UROS2ActionClient* UROS2NodeComponent::CreateActionClient | ( | const FString & | InActionName, |
const TSubclassOf< UROS2GenericAction > & | InActionClass, | ||
const FActionCallback & | InGoalResponseDelegate, | ||
const FActionCallback & | InResultResponseDelegate, | ||
const FActionCallback & | InFeedbackDelegate, | ||
const FSimpleCallback & | InCancelResponseDelegate, | ||
const UROS2QoS | InGoalQoS = UROS2QoS::Services , |
||
const UROS2QoS | InResultQoS = UROS2QoS::Services , |
||
const UROS2QoS | InFeedbackQoS = UROS2QoS::Default , |
||
const UROS2QoS | InCancelQoS = UROS2QoS::Services |
||
) |
Create a new UROS2ActionClient and add to Node.
InActionName | |
InActionClass | |
InFeedbackDelegate | |
InResultResponseDelegate | |
InGoalResponseDelegate | |
InCancelResponseDelegate | |
InFeedbackQoS | |
InResultQoS | |
InGoalQoS | |
InCancelQoS |
UROS2ActionServer* UROS2NodeComponent::CreateActionServer | ( | const FString & | InActionName, |
const TSubclassOf< UROS2GenericAction > & | InActionClass, | ||
const FActionCallback & | InGoalDelegate, | ||
const FSimpleCallback & | InResultDelegate, | ||
const FSimpleCallback & | InCancelDelegate, | ||
const UROS2QoS | InGoalQoS = UROS2QoS::Services , |
||
const UROS2QoS | InResultQoS = UROS2QoS::Services , |
||
const UROS2QoS | InFeedbackQoS = UROS2QoS::Default , |
||
const UROS2QoS | InCancelQoS = UROS2QoS::Services |
||
) |
Create a Action Server and add to Node.
InActionName | |
InActionClass | |
InGoalDelegate | |
InCancelDelegate | |
InResultDelegate | |
InFeedbackQoS | |
InResultQoS | |
InGoalQoS | |
InCancelQoS |
UROS2Publisher* UROS2NodeComponent::CreateLoopPublisher | ( | const FString & | InTopicName, |
const TSubclassOf< UROS2Publisher > & | InPublisherClass, | ||
const TSubclassOf< UROS2GenericMsg > & | InMsgClass, | ||
const float | InPubFrequency, | ||
const FTopicCallback & | InUpdateDelegate, | ||
const UROS2QoS | InQoS = UROS2QoS::Default |
||
) |
Create a new UROS2Publisher and add to Node.
InTopicName | Topic name |
InPublisherClass | Custom output publisher type class |
InMsgClass | Custom message type class |
InPubFrequency | Publishing frequency |
InUpdateDelegate | Delegate which is called with given frequency. |
InQoS | QoS. Default is UROS2QoS::Default |
UROS2Publisher* UROS2NodeComponent::CreateLoopPublisherWithClass | ( | const FString & | InTopicName, |
const TSubclassOf< UROS2Publisher > & | InPublisherClass, | ||
const float | InPubFrequency | ||
) |
Create a new UROS2Publisher of custom publisher class and add to Node.
Custom Publisher class is expected to override #UROS2Publisher::Update which in loop with frequency.
InTopicName | Topic name |
InPublisherClass | Custom output publisher type class |
InPubFrequency | Publishing frequency |
|
static |
Create a New Node object.
Used outside of constructor.
InNodeName | |
InNodeNamespace | |
InCompName |
UROS2Publisher* UROS2NodeComponent::CreatePublisher | ( | const FString & | InTopicName, |
const TSubclassOf< UROS2Publisher > & | InPublisherClass, | ||
const TSubclassOf< UROS2GenericMsg > & | InMsgClass, | ||
const UROS2QoS | InQoS = UROS2QoS::Default |
||
) |
Create a new UROS2Publisher and add to Node.
InTopicName | Topic name |
InPublisherClass | Custom output publisher type class |
InMsgClass | Custom message type class |
InQoS | QoS. Default is UROS2QoS::Default |
UROS2Publisher* UROS2NodeComponent::CreatePublisherWithClass | ( | const TSubclassOf< UROS2Publisher > & | InPublisherClass, |
const FString & | InTopicName = TEXT("") |
||
) |
Create a new UROS2Publisher of custom publisher class and add to Node.
InPublisherClass | |
InTopicName |
UROS2ServiceClient* UROS2NodeComponent::CreateServiceClient | ( | const FString & | InServiceName, |
const TSubclassOf< UROS2GenericSrv > & | InSrvClass, | ||
const FServiceCallback & | InResponseDelegate, | ||
const UROS2QoS | InQoS = UROS2QoS::Services |
||
) |
Create a new UROS2ServiceClient and add to Node.
InServiceName | |
InSrvClass | |
InRequestDelegate | |
InResponseDelegate | |
InQoS | QoS. Default is UROS2QoS::Default |
UROS2ServiceServer* UROS2NodeComponent::CreateServiceServer | ( | const FString & | InServiceName, |
const TSubclassOf< UROS2GenericSrv > & | InSrvClass, | ||
const FServiceCallback & | InCallback, | ||
const UROS2QoS | InQoS = UROS2QoS::Services |
||
) |
Create a new UROS2ServiceServer and add to Node.
InTopicName | Topic name |
InSrvClass | Custom message type class |
InCallback | Callback function |
UROS2Subscriber* UROS2NodeComponent::CreateSubscriber | ( | const FString & | InTopicName, |
const TSubclassOf< UROS2GenericMsg > & | InMsgClass, | ||
const FSubscriptionCallback & | InCallback, | ||
const UROS2QoS | InQoS = UROS2QoS::Default |
||
) |
Create a new UROS2Subscriber and add to Node.
InTopicName | |
InMsgClass | |
InCallback |
|
overrideprotectedvirtual |
Overridable function called whenever this actor is being removed from a level.
EndPlayReason |
|
private |
based on _rclc_default_scheduling of the rclc executor.
Called inside SpinSome. rcl_take_response_with_info to get response and execute Callback.
|
private |
based on _rclc_default_scheduling of the rclc executor.
Called inside SpinSome. rcl_take_response_with_info to get response and execute Callback.
|
private |
based on _rclc_default_scheduling of the rclc executor.
Called inside SpinSome. rcl_take_response_with_info to get response and execute Callback.
|
private |
based on _rclc_default_scheduling of the rclc executor.
Called inside SpinSome. rcl_take_request_with_info to get request, execute Callback and rcl_send_response to send response
|
private |
based on _rclc_default_scheduling of the rclc executor.
Called inside SpinSome. rcl_take to get topic and execute Callback.
void UROS2NodeComponent::Init | ( | ) |
Initilize rosnode with rclc_node_init_default.
This can't be pre-placed in #UROS2NodeComponent::BeginPlay() as the order of rcl(c) instructions could be different/relevant
in each of Child classes
|
private |
invalidate #wait_set so that in next spin_some() call the
#wait_set is updated accordingly in SpinSome
rclc/executor.c](https://github.com/ros2/rclc/blob/243ee63ca369f0fb90397ba9ae0ca1283ab16ad3/rclc/src/rclc/executor.c#L207)
|
protected |
method used to wait on communication and call delegates when appropriate modeled after executor + actions.
rclc/executor.c](https://github.com/ros2/rclc/blob/243ee63ca369f0fb90397ba9ae0ca1283ab16ad3/rclc/src/rclc/executor.c#L1802)
|
overridevirtual |
Called every frame.
DeltaTime | |
TickType | |
ThisTickFunction |
|
protected |
|
protected |
|
protected |
internal property used to log throttle.
FString UROS2NodeComponent::Name = TEXT("node") |
FString UROS2NodeComponent::Namespace = TEXT("") |
int UROS2NodeComponent::NEvents = 0 |
int UROS2NodeComponent::NGuardConditions = 0 |
wait_set quantities - currently unused
int UROS2NodeComponent::NTimers = 0 |
|
protected |
|
protected |
|
protected |
TEnumAsByte<UROS2State> UROS2NodeComponent::State = UROS2State::Created |
Node state.
|
protected |
|
protected |