Class RealTimeNode#

Inheritance Relationships#

Base Type#

  • public rclcpp::Node

Class Documentation#

class RealTimeNode : public rclcpp::Node#

Base class for creating corail realtime node.

Public Functions

inline RealTimeNode(const std::string &name, const std::string &ns, const rclcpp::NodeOptions option = rclcpp::NodeOptions())#

Construct a new Realtime Node.

See also

rclcpp::Node

See also

rclcpp::NodeOptions ).

Parameters
  • name[in] Name of the node.

  • ns[in] Namespace of the node.

  • option[in] Additional optionns to control creation of the node. (

Throws

InvalidNamespaceError – if the namespace is invalid.

inline RealTimeNode(const std::string &name, const rclcpp::NodeOptions option = rclcpp::NodeOptions())#

Construct a new Realtime Node.

See also

rclcpp::Node

See also

rclcpp::NodeOptions ).

Parameters
  • name[in] Name of the node.

  • option[in] Additional optionns to control creation of the node. (

Throws

InvalidNamespaceError – if the namespace is invalid.

PeriodicTask::SharedPtr create_rt_timer(const std::string &name, int cpu, int priority, std::chrono::microseconds period, std::function<void(void)> callback)#

Create a realtime Timer.

Parameters
  • name – Name of the task.

  • cpu – The cpu on which the timer will run. If <0 the subscriber can use all the cpu.

  • priority – The (POSIX) priority of the subscriber, if >0 -> SHED_FIFO, if =0 -> SHED_OTHER.

  • period – The duration of each period.

  • callback – The function to execute at each period.

Returns

PeriodicTask::SharedPtr A shared pointer to the created timer.

ReactiveTask::SharedPtr create_reactive_task(const std::string &name, uint64_t cpu, uint64_t priority, std::chrono::microseconds polling_period, std::chrono::microseconds running_period, std::function<bool(void)> polling_callback, std::function<void(void)> execution_callback)#

Create and return a ReactiveTask.

Parameters
  • name[in] Name of the task.

  • cpu[in] The cpu on which the task will run. If <0 the subscriber can use all the cpu.

  • priority[in] The (POSIX) priority of the subscriber, if >0 -> SHED_FIFO, if =0 -> SHED_OTHER.

  • polling_period[in] The time to wait between two polling.

  • running_period[in] The time to wait before polling after the execution of the execution_callbak.

  • polling_callback[in] The function to execute et each periode.

  • execution_callback[in] The function to execute if the polling callback return true.

Returns

Shared pointer to the created rective task.

template<typename MessageT, typename CallbackT, typename AllocatorT = std::allocator<void>, typename CallbackMessageT = typename rclcpp::subscription_traits::has_message_type<CallbackT>::type, typename SubscriptionT = rclcpp::Subscription<CallbackMessageT, AllocatorT>, typename MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<CallbackMessageT, AllocatorT>>
SubscriptionTask<MessageT>::SharedPtr create_rt_subscription(const std::string &name, uint64_t cpu, uint64_t priority, std::chrono::microseconds polling_period, std::chrono::microseconds running_period, const std::string &topic_name, const rclcpp::QoS &qos, CallbackT &&callback, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT> &options = rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>(), typename MessageMemoryStrategyT::SharedPtr msg_mem_strat = (MessageMemoryStrategyT::create_default()))#

Create and return a Subscription.

Parameters
  • name[in] Name of the task.

  • cpu[in] The cpu on which the subscription will run. If <0 the subscriber can use all the cpu.

  • priority[in] The (POSIX) priority of the subscriber, if >0 -> SHED_FIFO, if =0 -> SHED_OTHER.

  • polling_period[in] The time to wait between two polling.

  • running_period[in] The time to wait before polling after the execution of the callbak.

  • topic_name[in] The topic to subscribe on.

  • qos[in] QoS profile for Subcription.

  • callback[in] The user-defined callback function to receive a message

  • options[in] Additional options for the creation of the Subscription.

  • msg_mem_strat[in] The message memory strategy to use for allocating messages.

Returns

Shared pointer to the created subscription.

template<typename ServiceT, typename CallbackT>
ServiceTask<ServiceT>::SharedPtr create_rt_service(const std::string name, uint64_t cpu, uint64_t priority, std::chrono::microseconds polling_period, std::chrono::microseconds running_period, const std::string &service_name, CallbackT &&callback, const rmw_qos_profile_t &qos_profile = rmw_qos_profile_services_default, rclcpp::CallbackGroup::SharedPtr group = nullptr)#

Create and return a Service.

Parameters
  • name[in] Name of the task.

  • cpu[in] The cpu on which the subscription will run. If <0 the subscriber can use all the cpu.

  • priority[in] The (POSIX) priority of the subscriber, if >0 -> SHED_FIFO, if =0 -> SHED_OTHER.

  • polling_period[in] The time to wait between two polling.

  • running_period[in] The time to wait before polling after the execution of the callbak.

  • service_name[in] The topic to service on.

  • callback[in] User-defined callback function.

  • qos_profile[in] rmw_qos_profile_t Quality of service profile for client.

  • group[in] Callback group to call the service.

Returns

Shared pointer to the created service.

bool create_all()#

Call the create transisiton for all the tasks of the node.

Returns

true

Returns

false

bool configure_all()#

Call the configure transisiton for all the tasks of the node.

Returns

true

Returns

false

bool start_all(std::chrono::nanoseconds release)#

Call the start transisiton for all the tasks of the node.

Parameters

release – The realease date of all the tasks.

Returns

true

Returns

false

bool stop_all()#

Call the stop transisiton for all the tasks of the node.

Returns

true

Returns

false

bool cleanup_all()#

Call the cleanup transisiton for all the tasks of the node.

Returns

true

Returns

false

bool terminate_all()#

Call the terminate transisiton for all the tasks of the node.

Returns

true

Returns

false

Corail is free software: you can redistribute it and/or modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.