rclcpp
beta1
C++ ROS Client Library API
|
Node is the single point of entry for creating publishers and subscribers. More...
#include <node.hpp>
Public Member Functions | |
Node (const std::string &node_name, bool use_intra_process_comms=false) | |
Create a new node with the specified name. More... | |
Node (const std::string &node_name, rclcpp::context::Context::SharedPtr context, bool use_intra_process_comms=false) | |
Create a node based on the node name and a rclcpp::context::Context. More... | |
virtual | ~Node () |
const char * | get_name () const |
Get the name of the node. More... | |
rclcpp::callback_group::CallbackGroup::SharedPtr | create_callback_group (rclcpp::callback_group::CallbackGroupType group_type) |
Create and return a callback group. More... | |
const std::vector< rclcpp::callback_group::CallbackGroup::WeakPtr > & | get_callback_groups () const |
Return the list of callback groups in the node. More... | |
template<typename MessageT , typename Alloc = std::allocator<void>, typename PublisherT = ::rclcpp::publisher::Publisher<MessageT, Alloc>> | |
std::shared_ptr< PublisherT > | create_publisher (const std::string &topic_name, size_t qos_history_depth, std::shared_ptr< Alloc > allocator=nullptr) |
Create and return a Publisher. More... | |
template<typename MessageT , typename Alloc = std::allocator<void>, typename PublisherT = ::rclcpp::publisher::Publisher<MessageT, Alloc>> | |
std::shared_ptr< PublisherT > | create_publisher (const std::string &topic_name, const rmw_qos_profile_t &qos_profile=rmw_qos_profile_default, std::shared_ptr< Alloc > allocator=nullptr) |
Create and return a Publisher. More... | |
template<typename MessageT , typename CallbackT , typename Alloc = std::allocator<void>, typename SubscriptionT = rclcpp::subscription::Subscription<MessageT, Alloc>> | |
std::shared_ptr< SubscriptionT > | create_subscription (const std::string &topic_name, CallbackT &&callback, const rmw_qos_profile_t &qos_profile=rmw_qos_profile_default, rclcpp::callback_group::CallbackGroup::SharedPtr group=nullptr, bool ignore_local_publications=false, typename rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::SharedPtr msg_mem_strat=nullptr, std::shared_ptr< Alloc > allocator=nullptr) |
Create and return a Subscription. More... | |
template<typename MessageT , typename CallbackT , typename Alloc = std::allocator<void>, typename SubscriptionT = rclcpp::subscription::Subscription<MessageT, Alloc>> | |
std::shared_ptr< SubscriptionT > | create_subscription (const std::string &topic_name, size_t qos_history_depth, CallbackT &&callback, rclcpp::callback_group::CallbackGroup::SharedPtr group=nullptr, bool ignore_local_publications=false, typename rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::SharedPtr msg_mem_strat=nullptr, std::shared_ptr< Alloc > allocator=nullptr) |
Create and return a Subscription. More... | |
template<typename DurationT = std::milli, typename CallbackT > | |
rclcpp::timer::WallTimer< CallbackT >::SharedPtr | create_wall_timer (std::chrono::duration< int64_t, DurationT > period, CallbackT callback, rclcpp::callback_group::CallbackGroup::SharedPtr group=nullptr) |
Create a timer. More... | |
template<typename ServiceT > | |
rclcpp::client::Client< ServiceT >::SharedPtr | create_client (const std::string &service_name, const rmw_qos_profile_t &qos_profile=rmw_qos_profile_services_default, rclcpp::callback_group::CallbackGroup::SharedPtr group=nullptr) |
template<typename ServiceT , typename CallbackT > | |
rclcpp::service::Service< ServiceT >::SharedPtr | create_service (const std::string &service_name, CallbackT &&callback, const rmw_qos_profile_t &qos_profile=rmw_qos_profile_services_default, rclcpp::callback_group::CallbackGroup::SharedPtr group=nullptr) |
std::vector< rcl_interfaces::msg::SetParametersResult > | set_parameters (const std::vector< rclcpp::parameter::ParameterVariant > ¶meters) |
rcl_interfaces::msg::SetParametersResult | set_parameters_atomically (const std::vector< rclcpp::parameter::ParameterVariant > ¶meters) |
std::vector< rclcpp::parameter::ParameterVariant > | get_parameters (const std::vector< std::string > &names) const |
rclcpp::parameter::ParameterVariant | get_parameter (const std::string &name) const |
bool | get_parameter (const std::string &name, rclcpp::parameter::ParameterVariant ¶meter) const |
template<typename ParameterT > | |
bool | get_parameter (const std::string &name, ParameterT ¶meter) const |
std::vector< rcl_interfaces::msg::ParameterDescriptor > | describe_parameters (const std::vector< std::string > &names) const |
std::vector< uint8_t > | get_parameter_types (const std::vector< std::string > &names) const |
rcl_interfaces::msg::ListParametersResult | list_parameters (const std::vector< std::string > &prefixes, uint64_t depth) const |
template<typename CallbackT > | |
void | register_param_change_callback (CallbackT &&callback) |
Register the callback for parameter changes. More... | |
std::map< std::string, std::string > | get_topic_names_and_types () const |
size_t | count_publishers (const std::string &topic_name) const |
size_t | count_subscribers (const std::string &topic_name) const |
rclcpp::event::Event::SharedPtr | get_graph_event () |
Return a graph event, which will be set anytime a graph change occurs. More... | |
void | wait_for_graph_change (rclcpp::event::Event::SharedPtr event, std::chrono::nanoseconds timeout) |
Wait for a graph event to occur by waiting on an Event to become set. More... | |
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr | get_node_base_interface () |
Return the Node's internal NodeBaseInterface implementation. More... | |
rclcpp::node_interfaces::NodeGraphInterface::SharedPtr | get_node_graph_interface () |
Return the Node's internal NodeGraphInterface implementation. More... | |
rclcpp::node_interfaces::NodeTimersInterface::SharedPtr | get_node_timers_interface () |
Return the Node's internal NodeTimersInterface implementation. More... | |
rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr | get_node_topics_interface () |
Return the Node's internal NodeTopicsInterface implementation. More... | |
rclcpp::node_interfaces::NodeServicesInterface::SharedPtr | get_node_services_interface () |
Return the Node's internal NodeServicesInterface implementation. More... | |
rclcpp::node_interfaces::NodeParametersInterface::SharedPtr | get_node_parameters_interface () |
Return the Node's internal NodeParametersInterface implementation. More... | |
template<typename ServiceT > | |
client::Client< ServiceT >::SharedPtr | create_client (const std::string &service_name, const rmw_qos_profile_t &qos_profile, rclcpp::callback_group::CallbackGroup::SharedPtr group) |
Public Member Functions inherited from std::enable_shared_from_this< Node > | |
T | enable_shared_from_this (T... args) |
T | operator= (T... args) |
T | shared_from_this (T... args) |
T | ~enable_shared_from_this (T... args) |
Node is the single point of entry for creating publishers and subscribers.
|
explicit |
Create a new node with the specified name.
[in] | node_name | Name of the node. |
[in] | use_intra_process_comms | True to use the optimized intra-process communication pipeline to pass messages between nodes in the same process using shared memory. |
rclcpp::node::Node::Node | ( | const std::string & | node_name, |
rclcpp::context::Context::SharedPtr | context, | ||
bool | use_intra_process_comms = false |
||
) |
Create a node based on the node name and a rclcpp::context::Context.
[in] | node_name | Name of the node. |
[in] | context | The context for the node (usually represents the state of a process). |
[in] | use_intra_process_comms | True to use the optimized intra-process communication pipeline to pass messages between nodes in the same process using shared memory. |
|
virtual |
const char* rclcpp::node::Node::get_name | ( | ) | const |
Get the name of the node.
rclcpp::callback_group::CallbackGroup::SharedPtr rclcpp::node::Node::create_callback_group | ( | rclcpp::callback_group::CallbackGroupType | group_type | ) |
Create and return a callback group.
const std::vector<rclcpp::callback_group::CallbackGroup::WeakPtr>& rclcpp::node::Node::get_callback_groups | ( | ) | const |
Return the list of callback groups in the node.
std::shared_ptr< PublisherT > rclcpp::node::Node::create_publisher | ( | const std::string & | topic_name, |
size_t | qos_history_depth, | ||
std::shared_ptr< Alloc > | allocator = nullptr |
||
) |
Create and return a Publisher.
[in] | topic_name | The topic for this publisher to publish on. |
[in] | qos_history_depth | The depth of the publisher message queue. |
[in] | allocator | Optional custom allocator. |
std::shared_ptr< PublisherT > rclcpp::node::Node::create_publisher | ( | const std::string & | topic_name, |
const rmw_qos_profile_t & | qos_profile = rmw_qos_profile_default , |
||
std::shared_ptr< Alloc > | allocator = nullptr |
||
) |
Create and return a Publisher.
[in] | topic_name | The topic for this publisher to publish on. |
[in] | qos_profile | The quality of service profile to pass on to the rmw implementation. |
[in] | allocator | Optional custom allocator. |
std::shared_ptr< SubscriptionT > rclcpp::node::Node::create_subscription | ( | const std::string & | topic_name, |
CallbackT && | callback, | ||
const rmw_qos_profile_t & | qos_profile = rmw_qos_profile_default , |
||
rclcpp::callback_group::CallbackGroup::SharedPtr | group = nullptr , |
||
bool | ignore_local_publications = false , |
||
typename rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::SharedPtr | msg_mem_strat = nullptr , |
||
std::shared_ptr< Alloc > | allocator = nullptr |
||
) |
Create and return a Subscription.
[in] | topic_name | The topic to subscribe on. |
[in] | callback | The user-defined callback function. |
[in] | qos_profile | The quality of service profile to pass on to the rmw implementation. |
[in] | group | The callback group for this subscription. NULL for no callback group. |
[in] | ignore_local_publications | True to ignore local publications. |
[in] | msg_mem_strat | The message memory strategy to use for allocating messages. |
[in] | allocator | Optional custom allocator. |
std::shared_ptr< SubscriptionT > rclcpp::node::Node::create_subscription | ( | const std::string & | topic_name, |
size_t | qos_history_depth, | ||
CallbackT && | callback, | ||
rclcpp::callback_group::CallbackGroup::SharedPtr | group = nullptr , |
||
bool | ignore_local_publications = false , |
||
typename rclcpp::message_memory_strategy::MessageMemoryStrategy< MessageT, Alloc >::SharedPtr | msg_mem_strat = nullptr , |
||
std::shared_ptr< Alloc > | allocator = nullptr |
||
) |
Create and return a Subscription.
[in] | topic_name | The topic to subscribe on. |
[in] | qos_history_depth | The depth of the subscription's incoming message queue. |
[in] | callback | The user-defined callback function. |
[in] | group | The callback group for this subscription. NULL for no callback group. |
[in] | ignore_local_publications | True to ignore local publications. |
[in] | msg_mem_strat | The message memory strategy to use for allocating messages. |
[in] | allocator | Optional custom allocator. |
rclcpp::timer::WallTimer< CallbackT >::SharedPtr rclcpp::node::Node::create_wall_timer | ( | std::chrono::duration< int64_t, DurationT > | period, |
CallbackT | callback, | ||
rclcpp::callback_group::CallbackGroup::SharedPtr | group = nullptr |
||
) |
Create a timer.
[in] | period | Time interval between triggers of the callback. |
[in] | callback | User-defined callback function. |
[in] | group | Callback group to execute this timer's callback in. |
rclcpp::client::Client<ServiceT>::SharedPtr rclcpp::node::Node::create_client | ( | const std::string & | service_name, |
const rmw_qos_profile_t & | qos_profile = rmw_qos_profile_services_default , |
||
rclcpp::callback_group::CallbackGroup::SharedPtr | group = nullptr |
||
) |
rclcpp::service::Service< ServiceT >::SharedPtr rclcpp::node::Node::create_service | ( | const std::string & | service_name, |
CallbackT && | callback, | ||
const rmw_qos_profile_t & | qos_profile = rmw_qos_profile_services_default , |
||
rclcpp::callback_group::CallbackGroup::SharedPtr | group = nullptr |
||
) |
std::vector<rcl_interfaces::msg::SetParametersResult> rclcpp::node::Node::set_parameters | ( | const std::vector< rclcpp::parameter::ParameterVariant > & | parameters | ) |
rcl_interfaces::msg::SetParametersResult rclcpp::node::Node::set_parameters_atomically | ( | const std::vector< rclcpp::parameter::ParameterVariant > & | parameters | ) |
std::vector<rclcpp::parameter::ParameterVariant> rclcpp::node::Node::get_parameters | ( | const std::vector< std::string > & | names | ) | const |
rclcpp::parameter::ParameterVariant rclcpp::node::Node::get_parameter | ( | const std::string & | name | ) | const |
bool rclcpp::node::Node::get_parameter | ( | const std::string & | name, |
rclcpp::parameter::ParameterVariant & | parameter | ||
) | const |
bool rclcpp::node::Node::get_parameter | ( | const std::string & | name, |
ParameterT & | parameter | ||
) | const |
std::vector<rcl_interfaces::msg::ParameterDescriptor> rclcpp::node::Node::describe_parameters | ( | const std::vector< std::string > & | names | ) | const |
std::vector<uint8_t> rclcpp::node::Node::get_parameter_types | ( | const std::vector< std::string > & | names | ) | const |
rcl_interfaces::msg::ListParametersResult rclcpp::node::Node::list_parameters | ( | const std::vector< std::string > & | prefixes, |
uint64_t | depth | ||
) | const |
void rclcpp::node::Node::register_param_change_callback | ( | CallbackT && | callback | ) |
Register the callback for parameter changes.
[in] | callback | User defined callback function. It is expected to atomically set parameters. |
std::map<std::string, std::string> rclcpp::node::Node::get_topic_names_and_types | ( | ) | const |
size_t rclcpp::node::Node::count_publishers | ( | const std::string & | topic_name | ) | const |
size_t rclcpp::node::Node::count_subscribers | ( | const std::string & | topic_name | ) | const |
rclcpp::event::Event::SharedPtr rclcpp::node::Node::get_graph_event | ( | ) |
Return a graph event, which will be set anytime a graph change occurs.
void rclcpp::node::Node::wait_for_graph_change | ( | rclcpp::event::Event::SharedPtr | event, |
std::chrono::nanoseconds | timeout | ||
) |
Wait for a graph event to occur by waiting on an Event to become set.
The given Event must be acquire through the get_graph_event() method.
InvalidEventError | if the given event is nullptr |
EventNotRegisteredError | if the given event was not acquired with get_graph_event(). |
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr rclcpp::node::Node::get_node_base_interface | ( | ) |
Return the Node's internal NodeBaseInterface implementation.
rclcpp::node_interfaces::NodeGraphInterface::SharedPtr rclcpp::node::Node::get_node_graph_interface | ( | ) |
Return the Node's internal NodeGraphInterface implementation.
rclcpp::node_interfaces::NodeTimersInterface::SharedPtr rclcpp::node::Node::get_node_timers_interface | ( | ) |
Return the Node's internal NodeTimersInterface implementation.
rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr rclcpp::node::Node::get_node_topics_interface | ( | ) |
Return the Node's internal NodeTopicsInterface implementation.
rclcpp::node_interfaces::NodeServicesInterface::SharedPtr rclcpp::node::Node::get_node_services_interface | ( | ) |
Return the Node's internal NodeServicesInterface implementation.
rclcpp::node_interfaces::NodeParametersInterface::SharedPtr rclcpp::node::Node::get_node_parameters_interface | ( | ) |
Return the Node's internal NodeParametersInterface implementation.
client::Client<ServiceT>::SharedPtr rclcpp::node::Node::create_client | ( | const std::string & | service_name, |
const rmw_qos_profile_t & | qos_profile, | ||
rclcpp::callback_group::CallbackGroup::SharedPtr | group | ||
) |