rclcpp_lifecycle  master
C++ ROS Lifecycle Library API
Public Types | Public Member Functions | Protected Member Functions | List of all members
rclcpp_lifecycle::LifecycleNode Class Reference

LifecycleNode for creating lifecycle components. More...

#include <lifecycle_node.hpp>

Inheritance diagram for rclcpp_lifecycle::LifecycleNode:
Inheritance graph
[legend]
Collaboration diagram for rclcpp_lifecycle::LifecycleNode:
Collaboration graph
[legend]

Public Types

using OnSetParametersCallbackHandle = rclcpp::node_interfaces::OnSetParametersCallbackHandle
 
using OnParametersSetCallbackType = rclcpp::node_interfaces::NodeParametersInterface::OnParametersSetCallbackType
 
- Public Types inherited from rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface
enum  CallbackReturn : uint8_t { CallbackReturn::SUCCESS = lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_SUCCESS, CallbackReturn::FAILURE = lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_FAILURE, CallbackReturn::ERROR = lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_ERROR }
 

Public Member Functions

 LifecycleNode (const std::string &node_name, const rclcpp::NodeOptions &options=rclcpp::NodeOptions(), bool enable_communication_interface=true)
 Create a new lifecycle node with the specified name. More...
 
 LifecycleNode (const std::string &node_name, const std::string &namespace_, const rclcpp::NodeOptions &options=rclcpp::NodeOptions(), bool enable_communication_interface=true)
 Create a node based on the node name and a rclcpp::Context. More...
 
virtual ~LifecycleNode ()
 
const char * get_name () const
 Get the name of the node. More...
 
const char * get_namespace () const
 Get the namespace of the node. More...
 
rclcpp::Logger get_logger () const
 Get the logger of the node. More...
 
rclcpp::CallbackGroup::SharedPtr create_callback_group (rclcpp::CallbackGroupType group_type, bool automatically_add_to_executor_with_node=true)
 Create and return a callback group. More...
 
const std::vector< rclcpp::CallbackGroup::WeakPtr > & get_callback_groups () const
 Return the list of callback groups in the node. More...
 
template<typename MessageT , typename AllocatorT = std::allocator<void>>
std::shared_ptr< rclcpp_lifecycle::LifecyclePublisher< MessageT, AllocatorT > > create_publisher (const std::string &topic_name, const rclcpp::QoS &qos, const PublisherOptionsWithAllocator< AllocatorT > &options=(create_default_publisher_options< AllocatorT >()))
 Create and return a Publisher. More...
 
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<MessageT, AllocatorT>, typename MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy< CallbackMessageT, AllocatorT >>
std::shared_ptr< SubscriptionT > create_subscription (const std::string &topic_name, const rclcpp::QoS &qos, CallbackT &&callback, const SubscriptionOptionsWithAllocator< AllocatorT > &options=create_default_subscription_options< AllocatorT >(), typename MessageMemoryStrategyT::SharedPtr msg_mem_strat=(MessageMemoryStrategyT::create_default()))
 Create and return a Subscription. More...
 
template<typename DurationRepT = int64_t, typename DurationT = std::milli, typename CallbackT >
rclcpp::WallTimer< CallbackT >::SharedPtr create_wall_timer (std::chrono::duration< DurationRepT, DurationT > period, CallbackT callback, rclcpp::CallbackGroup::SharedPtr group=nullptr)
 Create a timer. More...
 
template<typename ServiceT >
rclcpp::Client< ServiceT >::SharedPtr create_client (const std::string &service_name, const rmw_qos_profile_t &qos_profile=rmw_qos_profile_services_default, rclcpp::CallbackGroup::SharedPtr group=nullptr)
 Create and return a Client. More...
 
template<typename ServiceT , typename CallbackT >
rclcpp::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::CallbackGroup::SharedPtr group=nullptr)
 Create and return a Service. More...
 
template<typename AllocatorT = std::allocator<void>>
std::shared_ptr< rclcpp::GenericPublishercreate_generic_publisher (const std::string &topic_name, const std::string &topic_type, const rclcpp::QoS &qos, const rclcpp::PublisherOptionsWithAllocator< AllocatorT > &options=(rclcpp::PublisherOptionsWithAllocator< AllocatorT >()))
 Create and return a GenericPublisher. More...
 
template<typename AllocatorT = std::allocator<void>>
std::shared_ptr< rclcpp::GenericSubscriptioncreate_generic_subscription (const std::string &topic_name, const std::string &topic_type, const rclcpp::QoS &qos, std::function< void(std::shared_ptr< rclcpp::SerializedMessage >)> callback, const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &options=(rclcpp::SubscriptionOptionsWithAllocator< AllocatorT >()))
 Create and return a GenericSubscription. More...
 
const rclcpp::ParameterValuedeclare_parameter (const std::string &name, const rclcpp::ParameterValue &default_value, const rcl_interfaces::msg::ParameterDescriptor &parameter_descriptor=rcl_interfaces::msg::ParameterDescriptor(), bool ignore_override=false)
 Declare and initialize a parameter, return the effective value. More...
 
const rclcpp::ParameterValuedeclare_parameter (const std::string &name, rclcpp::ParameterType type, const rcl_interfaces::msg::ParameterDescriptor &parameter_descriptor=rcl_interfaces::msg::ParameterDescriptor{}, bool ignore_override=false)
 Declare and initialize a parameter, return the effective value. More...
 
const rclcpp::ParameterValuedeclare_parameter (const std::string &name)
 Declare a parameter. More...
 
template<typename ParameterT >
auto declare_parameter (const std::string &name, const ParameterT &default_value, const rcl_interfaces::msg::ParameterDescriptor &parameter_descriptor=rcl_interfaces::msg::ParameterDescriptor(), bool ignore_override=false)
 Declare and initialize a parameter with a type. More...
 
template<typename ParameterT >
auto declare_parameter (const std::string &name, const rcl_interfaces::msg::ParameterDescriptor &parameter_descriptor=rcl_interfaces::msg::ParameterDescriptor(), bool ignore_override=false)
 Declare and initialize a parameter with a type. More...
 
template<typename ParameterT >
std::vector< ParameterT > declare_parameters (const std::string &namespace_, const std::map< std::string, ParameterT > &parameters)
 Declare and initialize several parameters with the same namespace and type. More...
 
template<typename ParameterT >
std::vector< ParameterT > declare_parameters (const std::string &namespace_, const std::map< std::string, std::pair< ParameterT, rcl_interfaces::msg::ParameterDescriptor > > &parameters)
 Declare and initialize several parameters with the same namespace and type. More...
 
void undeclare_parameter (const std::string &name)
 Undeclare a previously declared parameter. More...
 
bool has_parameter (const std::string &name) const
 Return true if a given parameter is declared. More...
 
rcl_interfaces::msg::SetParametersResult set_parameter (const rclcpp::Parameter &parameter)
 Set a single parameter. More...
 
std::vector< rcl_interfaces::msg::SetParametersResult > set_parameters (const std::vector< rclcpp::Parameter > &parameters)
 Set one or more parameters, one at a time. More...
 
rcl_interfaces::msg::SetParametersResult set_parameters_atomically (const std::vector< rclcpp::Parameter > &parameters)
 Set one or more parameters, all at once. More...
 
rclcpp::Parameter get_parameter (const std::string &name) const
 Return the parameter by the given name. More...
 
bool get_parameter (const std::string &name, rclcpp::Parameter &parameter) const
 Get the value of a parameter by the given name, and return true if it was set. More...
 
template<typename ParameterT >
bool get_parameter (const std::string &name, ParameterT &parameter) const
 Get the value of a parameter by the given name, and return true if it was set. More...
 
template<typename ParameterT >
bool get_parameter_or (const std::string &name, ParameterT &value, const ParameterT &alternative_value) const
 Get the parameter value, or the "alternative_value" if not set, and assign it to "parameter". More...
 
std::vector< rclcpp::Parameterget_parameters (const std::vector< std::string > &names) const
 Return the parameters by the given parameter names. More...
 
template<typename MapValueT >
bool get_parameters (const std::string &prefix, std::map< std::string, MapValueT > &values) const
 Get the parameter values for all parameters that have a given prefix. More...
 
rcl_interfaces::msg::ParameterDescriptor describe_parameter (const std::string &name) const
 Return the parameter descriptor for the given parameter name. More...
 
std::vector< rcl_interfaces::msg::ParameterDescriptor > describe_parameters (const std::vector< std::string > &names) const
 Return a vector of parameter descriptors, one for each of the given names. More...
 
std::vector< uint8_t > get_parameter_types (const std::vector< std::string > &names) const
 Return a vector of parameter types, one for each of the given names. More...
 
rcl_interfaces::msg::ListParametersResult list_parameters (const std::vector< std::string > &prefixes, uint64_t depth) const
 Return a list of parameters with any of the given prefixes, up to the given depth. More...
 
RCUTILS_WARN_UNUSED rclcpp_lifecycle::LifecycleNode::OnSetParametersCallbackHandle::SharedPtr add_on_set_parameters_callback (rclcpp_lifecycle::LifecycleNode::OnParametersSetCallbackType callback)
 Add a callback for when parameters are being set. More...
 
void remove_on_set_parameters_callback (const rclcpp_lifecycle::LifecycleNode::OnSetParametersCallbackHandle *const handler)
 Remove a callback registered with add_on_set_parameters_callback. More...
 
std::vector< std::stringget_node_names () const
 Return a vector of existing node names (string). More...
 
std::map< std::string, std::vector< std::string > > get_topic_names_and_types (bool no_demangle=false) const
 Return a map of existing topic names to list of topic types. More...
 
std::map< std::string, std::vector< std::string > > get_service_names_and_types () const
 Return a map of existing service names to list of topic types. More...
 
std::map< std::string, std::vector< std::string > > get_service_names_and_types_by_node (const std::string &node_name, const std::string &namespace_) const
 Return a map of existing service names to list of service types for a specific node. More...
 
size_t count_publishers (const std::string &topic_name) const
 Return the number of publishers that are advertised on a given topic. More...
 
size_t count_subscribers (const std::string &topic_name) const
 Return the number of subscribers who have created a subscription for a given topic. More...
 
std::vector< rclcpp::TopicEndpointInfoget_publishers_info_by_topic (const std::string &topic_name, bool no_mangle=false) const
 Return the topic endpoint information about publishers on a given topic. More...
 
std::vector< rclcpp::TopicEndpointInfoget_subscriptions_info_by_topic (const std::string &topic_name, bool no_mangle=false) const
 Return the topic endpoint information about subscriptions on a given topic. More...
 
rclcpp::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::SharedPtr event, std::chrono::nanoseconds timeout)
 Wait for a graph event to occur by waiting on an Event to become set. More...
 
rclcpp::Clock::SharedPtr get_clock ()
 Get a clock as a non-const shared pointer which is managed by the node. More...
 
rclcpp::Clock::ConstSharedPtr get_clock () const
 Get a clock as a const shared pointer which is managed by the node. More...
 
rclcpp::Time now () const
 Returns current time from the time source specified by clock_type. More...
 
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr get_node_base_interface ()
 Return the Node's internal NodeBaseInterface implementation. More...
 
rclcpp::node_interfaces::NodeClockInterface::SharedPtr get_node_clock_interface ()
 Return the Node's internal NodeClockInterface implementation. More...
 
rclcpp::node_interfaces::NodeGraphInterface::SharedPtr get_node_graph_interface ()
 Return the Node's internal NodeGraphInterface implementation. More...
 
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr get_node_logging_interface ()
 Return the Node's internal NodeLoggingInterface 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...
 
rclcpp::node_interfaces::NodeTimeSourceInterface::SharedPtr get_node_time_source_interface ()
 Return the Node's internal NodeParametersInterface implementation. More...
 
rclcpp::node_interfaces::NodeWaitablesInterface::SharedPtr get_node_waitables_interface ()
 Return the Node's internal NodeWaitablesInterface implementation. More...
 
const rclcpp::NodeOptionsget_node_options () const
 Return the NodeOptions used when creating this node. More...
 
const Stateget_current_state ()
 Return the current State. More...
 
std::vector< Stateget_available_states ()
 Return a list with the available states. More...
 
std::vector< Transitionget_available_transitions ()
 Return a list with the current available transitions. More...
 
std::vector< Transitionget_transition_graph ()
 Return a list with all the transitions. More...
 
const Statetrigger_transition (const Transition &transition)
 Trigger the specified transition. More...
 
const Statetrigger_transition (const Transition &transition, LifecycleNodeInterface::CallbackReturn &cb_return_code)
 Trigger the specified transition and get the callback return code. More...
 
const Statetrigger_transition (uint8_t transition_id)
 Trigger the specified transition based on an id. More...
 
const Statetrigger_transition (uint8_t transition_id, LifecycleNodeInterface::CallbackReturn &cb_return_code)
 Trigger the specified transition based on an id and get the callback return code. More...
 
const Stateconfigure ()
 Trigger the configure transition. More...
 
const Stateconfigure (LifecycleNodeInterface::CallbackReturn &cb_return_code)
 Trigger the configure transition and get the callback return code. More...
 
const Statecleanup ()
 Trigger the cleanup transition. More...
 
const Statecleanup (LifecycleNodeInterface::CallbackReturn &cb_return_code)
 Trigger the cleanup transition and get the callback return code. More...
 
const Stateactivate ()
 Trigger the activate transition. More...
 
const Stateactivate (LifecycleNodeInterface::CallbackReturn &cb_return_code)
 Trigger the activate transition and get the callback return code. More...
 
const Statedeactivate ()
 Trigger the deactivate transition. More...
 
const Statedeactivate (LifecycleNodeInterface::CallbackReturn &cb_return_code)
 Trigger the deactivate transition and get the callback return code. More...
 
const Stateshutdown ()
 Trigger the shutdown transition. More...
 
const Stateshutdown (LifecycleNodeInterface::CallbackReturn &cb_return_code)
 Trigger the shutdown transition and get the callback return code. More...
 
bool register_on_configure (std::function< LifecycleNodeInterface::CallbackReturn(const State &)> fcn)
 Register the configure callback. More...
 
bool register_on_cleanup (std::function< LifecycleNodeInterface::CallbackReturn(const State &)> fcn)
 Register the cleanup callback. More...
 
bool register_on_shutdown (std::function< LifecycleNodeInterface::CallbackReturn(const State &)> fcn)
 Register the shutdown callback. More...
 
bool register_on_activate (std::function< LifecycleNodeInterface::CallbackReturn(const State &)> fcn)
 Register the activate callback. More...
 
bool register_on_deactivate (std::function< LifecycleNodeInterface::CallbackReturn(const State &)> fcn)
 Register the deactivate callback. More...
 
bool register_on_error (std::function< LifecycleNodeInterface::CallbackReturn(const State &)> fcn)
 Register the error callback. More...
 
template<typename MessageT , typename CallbackT , typename AllocatorT , typename CallbackMessageT , typename SubscriptionT , typename MessageMemoryStrategyT >
std::shared_ptr< SubscriptionT > create_subscription (const std::string &topic_name, const rclcpp::QoS &qos, CallbackT &&callback, const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &options, typename MessageMemoryStrategyT::SharedPtr msg_mem_strat)
 
- Public Member Functions inherited from rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface
virtual CallbackReturn on_configure (const State &previous_state)
 Callback function for configure transition. More...
 
virtual CallbackReturn on_cleanup (const State &previous_state)
 Callback function for cleanup transition. More...
 
virtual CallbackReturn on_shutdown (const State &previous_state)
 Callback function for shutdown transition. More...
 
virtual CallbackReturn on_activate (const State &previous_state)
 Callback function for activate transition. More...
 
virtual CallbackReturn on_deactivate (const State &previous_state)
 Callback function for deactivate transition. More...
 
virtual CallbackReturn on_error (const State &previous_state)
 Callback function for errorneous transition. More...
 
virtual ~LifecycleNodeInterface ()
 
- Public Member Functions inherited from std::enable_shared_from_this< LifecycleNode >
enable_shared_from_this (T... args)
 
operator= (T... args)
 
shared_from_this (T... args)
 
~enable_shared_from_this (T... args)
 

Protected Member Functions

void add_publisher_handle (std::shared_ptr< rclcpp_lifecycle::LifecyclePublisherInterface > pub)
 
void add_timer_handle (std::shared_ptr< rclcpp::TimerBase > timer)
 
- Protected Member Functions inherited from rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface
 LifecycleNodeInterface ()
 

Detailed Description

LifecycleNode for creating lifecycle components.

has lifecycle nodeinterface for configuring this node.

Member Typedef Documentation

◆ OnSetParametersCallbackHandle

◆ OnParametersSetCallbackType

Constructor & Destructor Documentation

◆ LifecycleNode() [1/2]

rclcpp_lifecycle::LifecycleNode::LifecycleNode ( const std::string node_name,
const rclcpp::NodeOptions options = rclcpp::NodeOptions(),
bool  enable_communication_interface = true 
)
explicit

Create a new lifecycle node with the specified name.

Parameters
[in]node_nameName of the node.
[in]optionsAdditional options to control creation of the node.
[in]enable_communication_interfaceDeciding whether the communication interface of the underlying rcl_lifecycle_node shall be enabled.

◆ LifecycleNode() [2/2]

rclcpp_lifecycle::LifecycleNode::LifecycleNode ( const std::string node_name,
const std::string namespace_,
const rclcpp::NodeOptions options = rclcpp::NodeOptions(),
bool  enable_communication_interface = true 
)

Create a node based on the node name and a rclcpp::Context.

Parameters
[in]node_nameName of the node.
[in]namespace_Namespace of the node.
[in]optionsAdditional options to control creation of the node.
[in]enable_communication_interfaceDeciding whether the communication interface of the underlying rcl_lifecycle_node shall be enabled.

◆ ~LifecycleNode()

virtual rclcpp_lifecycle::LifecycleNode::~LifecycleNode ( )
virtual

Member Function Documentation

◆ get_name()

const char* rclcpp_lifecycle::LifecycleNode::get_name ( ) const

Get the name of the node.

Returns
The name of the node.

◆ get_namespace()

const char* rclcpp_lifecycle::LifecycleNode::get_namespace ( ) const

Get the namespace of the node.

Returns
The namespace of the node.

◆ get_logger()

rclcpp::Logger rclcpp_lifecycle::LifecycleNode::get_logger ( ) const

Get the logger of the node.

Returns
The logger of the node.

◆ create_callback_group()

rclcpp::CallbackGroup::SharedPtr rclcpp_lifecycle::LifecycleNode::create_callback_group ( rclcpp::CallbackGroupType  group_type,
bool  automatically_add_to_executor_with_node = true 
)

Create and return a callback group.

Parameters
[in]group_typecallback group type to create by this method.
[in]automatically_add_to_executor_with_nodeA boolean that determines whether a callback group is automatically added to an executor with the node with which it is associated.
Returns
a callback group

◆ get_callback_groups()

const std::vector<rclcpp::CallbackGroup::WeakPtr>& rclcpp_lifecycle::LifecycleNode::get_callback_groups ( ) const

Return the list of callback groups in the node.

Returns
list of callback groups in the node.

◆ create_publisher()

template<typename MessageT , typename AllocatorT >
std::shared_ptr< rclcpp_lifecycle::LifecyclePublisher< MessageT, AllocatorT > > rclcpp_lifecycle::LifecycleNode::create_publisher ( const std::string topic_name,
const rclcpp::QoS qos,
const PublisherOptionsWithAllocator< AllocatorT > &  options = (      create_default_publisher_options<AllocatorT>()    ) 
)

Create and return a Publisher.

Parameters
[in]topic_nameThe topic for this publisher to publish on.
[in]qosThe Quality of Service settings for this publisher.
[in]optionsThe publisher options for this publisher.
Returns
Shared pointer to the created lifecycle publisher.

◆ create_subscription() [1/2]

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<MessageT, AllocatorT>, typename MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy< CallbackMessageT, AllocatorT >>
std::shared_ptr<SubscriptionT> rclcpp_lifecycle::LifecycleNode::create_subscription ( const std::string topic_name,
const rclcpp::QoS qos,
CallbackT &&  callback,
const SubscriptionOptionsWithAllocator< AllocatorT > &  options = create_default_subscription_options< AllocatorT >(),
typename MessageMemoryStrategyT::SharedPtr  msg_mem_strat = (MessageMemoryStrategyT::create_default()) 
)

Create and return a Subscription.

Parameters
[in]topic_nameThe topic to subscribe on.
[in]callbackThe user-defined callback function.
[in]qosThe quality of service for this subscription.
[in]optionsThe subscription options for this subscription.
[in]msg_mem_stratThe message memory strategy to use for allocating messages.
Returns
Shared pointer to the created subscription.

◆ create_wall_timer()

template<typename DurationRepT , typename DurationT , typename CallbackT >
rclcpp::WallTimer< CallbackT >::SharedPtr rclcpp_lifecycle::LifecycleNode::create_wall_timer ( std::chrono::duration< DurationRepT, DurationT >  period,
CallbackT  callback,
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)

Create a timer.

Parameters
[in]periodTime interval between triggers of the callback.
[in]callbackUser-defined callback function.
[in]groupCallback group to execute this timer's callback in.

◆ create_client()

template<typename ServiceT >
rclcpp::Client< ServiceT >::SharedPtr rclcpp_lifecycle::LifecycleNode::create_client ( const std::string service_name,
const rmw_qos_profile_t qos_profile = rmw_qos_profile_services_default,
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)

Create and return a Client.

See also
rclcpp::Node::create_client

◆ create_service()

template<typename ServiceT , typename CallbackT >
rclcpp::Service< ServiceT >::SharedPtr rclcpp_lifecycle::LifecycleNode::create_service ( 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.

See also
rclcpp::Node::create_service

◆ create_generic_publisher()

template<typename AllocatorT >
std::shared_ptr< rclcpp::GenericPublisher > rclcpp_lifecycle::LifecycleNode::create_generic_publisher ( const std::string topic_name,
const std::string topic_type,
const rclcpp::QoS qos,
const rclcpp::PublisherOptionsWithAllocator< AllocatorT > &  options = (      rclcpp::PublisherOptionsWithAllocator<AllocatorT>()    ) 
)

Create and return a GenericPublisher.

See also
rclcpp::Node::create_generic_publisher

◆ create_generic_subscription()

template<typename AllocatorT >
std::shared_ptr< rclcpp::GenericSubscription > rclcpp_lifecycle::LifecycleNode::create_generic_subscription ( const std::string topic_name,
const std::string topic_type,
const rclcpp::QoS qos,
std::function< void(std::shared_ptr< rclcpp::SerializedMessage >)>  callback,
const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &  options = (      rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>()    ) 
)

Create and return a GenericSubscription.

See also
rclcpp::Node::create_generic_subscription

◆ declare_parameter() [1/5]

const rclcpp::ParameterValue& rclcpp_lifecycle::LifecycleNode::declare_parameter ( const std::string name,
const rclcpp::ParameterValue default_value,
const rcl_interfaces::msg::ParameterDescriptor &  parameter_descriptor = rcl_interfaces::msg::ParameterDescriptor(),
bool  ignore_override = false 
)

Declare and initialize a parameter, return the effective value.

See also
rclcpp::Node::declare_parameter

◆ declare_parameter() [2/5]

const rclcpp::ParameterValue& rclcpp_lifecycle::LifecycleNode::declare_parameter ( const std::string name,
rclcpp::ParameterType  type,
const rcl_interfaces::msg::ParameterDescriptor &  parameter_descriptor = rcl_interfaces::msg::ParameterDescriptor{},
bool  ignore_override = false 
)

Declare and initialize a parameter, return the effective value.

See also
rclcpp::Node::declare_parameter

◆ declare_parameter() [3/5]

const rclcpp::ParameterValue& rclcpp_lifecycle::LifecycleNode::declare_parameter ( const std::string name)

Declare a parameter.

◆ declare_parameter() [4/5]

template<typename ParameterT >
auto rclcpp_lifecycle::LifecycleNode::declare_parameter ( const std::string name,
const ParameterT &  default_value,
const rcl_interfaces::msg::ParameterDescriptor &  parameter_descriptor = rcl_interfaces::msg::ParameterDescriptor(),
bool  ignore_override = false 
)

Declare and initialize a parameter with a type.

See also
rclcpp::Node::declare_parameter

◆ declare_parameter() [5/5]

template<typename ParameterT >
auto rclcpp_lifecycle::LifecycleNode::declare_parameter ( const std::string name,
const rcl_interfaces::msg::ParameterDescriptor &  parameter_descriptor = rcl_interfaces::msg::ParameterDescriptor(),
bool  ignore_override = false 
)

Declare and initialize a parameter with a type.

See the non-templated declare_parameter() on this class for details.

◆ declare_parameters() [1/2]

template<typename ParameterT >
std::vector< ParameterT > rclcpp_lifecycle::LifecycleNode::declare_parameters ( const std::string namespace_,
const std::map< std::string, ParameterT > &  parameters 
)

Declare and initialize several parameters with the same namespace and type.

See also
rclcpp::Node::declare_parameters

◆ declare_parameters() [2/2]

template<typename ParameterT >
std::vector< ParameterT > rclcpp_lifecycle::LifecycleNode::declare_parameters ( const std::string namespace_,
const std::map< std::string, std::pair< ParameterT, rcl_interfaces::msg::ParameterDescriptor > > &  parameters 
)

Declare and initialize several parameters with the same namespace and type.

See also
rclcpp::Node::declare_parameters

◆ undeclare_parameter()

void rclcpp_lifecycle::LifecycleNode::undeclare_parameter ( const std::string name)

Undeclare a previously declared parameter.

See also
rclcpp::Node::undeclare_parameter

◆ has_parameter()

bool rclcpp_lifecycle::LifecycleNode::has_parameter ( const std::string name) const

Return true if a given parameter is declared.

See also
rclcpp::Node::has_parameter

◆ set_parameter()

rcl_interfaces::msg::SetParametersResult rclcpp_lifecycle::LifecycleNode::set_parameter ( const rclcpp::Parameter parameter)

Set a single parameter.

See also
rclcpp::Node::set_parameter

◆ set_parameters()

std::vector<rcl_interfaces::msg::SetParametersResult> rclcpp_lifecycle::LifecycleNode::set_parameters ( const std::vector< rclcpp::Parameter > &  parameters)

Set one or more parameters, one at a time.

See also
rclcpp::Node::set_parameters

◆ set_parameters_atomically()

rcl_interfaces::msg::SetParametersResult rclcpp_lifecycle::LifecycleNode::set_parameters_atomically ( const std::vector< rclcpp::Parameter > &  parameters)

Set one or more parameters, all at once.

See also
rclcpp::Node::set_parameters_atomically

◆ get_parameter() [1/3]

rclcpp::Parameter rclcpp_lifecycle::LifecycleNode::get_parameter ( const std::string name) const

Return the parameter by the given name.

See also
rclcpp::Node::get_parameter

◆ get_parameter() [2/3]

bool rclcpp_lifecycle::LifecycleNode::get_parameter ( const std::string name,
rclcpp::Parameter parameter 
) const

Get the value of a parameter by the given name, and return true if it was set.

See also
rclcpp::Node::get_parameter

◆ get_parameter() [3/3]

template<typename ParameterT >
bool rclcpp_lifecycle::LifecycleNode::get_parameter ( const std::string name,
ParameterT &  parameter 
) const

Get the value of a parameter by the given name, and return true if it was set.

See also
rclcpp::Node::get_parameter

◆ get_parameter_or()

template<typename ParameterT >
bool rclcpp_lifecycle::LifecycleNode::get_parameter_or ( const std::string name,
ParameterT &  value,
const ParameterT &  alternative_value 
) const

Get the parameter value, or the "alternative_value" if not set, and assign it to "parameter".

See also
rclcpp::Node::get_parameter_or

◆ get_parameters() [1/2]

std::vector<rclcpp::Parameter> rclcpp_lifecycle::LifecycleNode::get_parameters ( const std::vector< std::string > &  names) const

Return the parameters by the given parameter names.

See also
rclcpp::Node::get_parameters

◆ get_parameters() [2/2]

template<typename MapValueT >
bool rclcpp_lifecycle::LifecycleNode::get_parameters ( const std::string prefix,
std::map< std::string, MapValueT > &  values 
) const

Get the parameter values for all parameters that have a given prefix.

See also
rclcpp::Node::get_parameters

◆ describe_parameter()

rcl_interfaces::msg::ParameterDescriptor rclcpp_lifecycle::LifecycleNode::describe_parameter ( const std::string name) const

Return the parameter descriptor for the given parameter name.

See also
rclcpp::Node::describe_parameter

◆ describe_parameters()

std::vector<rcl_interfaces::msg::ParameterDescriptor> rclcpp_lifecycle::LifecycleNode::describe_parameters ( const std::vector< std::string > &  names) const

Return a vector of parameter descriptors, one for each of the given names.

See also
rclcpp::Node::describe_parameters

◆ get_parameter_types()

std::vector<uint8_t> rclcpp_lifecycle::LifecycleNode::get_parameter_types ( const std::vector< std::string > &  names) const

Return a vector of parameter types, one for each of the given names.

See also
rclcpp::Node::get_parameter_types

◆ list_parameters()

rcl_interfaces::msg::ListParametersResult rclcpp_lifecycle::LifecycleNode::list_parameters ( const std::vector< std::string > &  prefixes,
uint64_t  depth 
) const

Return a list of parameters with any of the given prefixes, up to the given depth.

See also
rclcpp::Node::list_parameters

◆ add_on_set_parameters_callback()

RCUTILS_WARN_UNUSED rclcpp_lifecycle::LifecycleNode::OnSetParametersCallbackHandle::SharedPtr rclcpp_lifecycle::LifecycleNode::add_on_set_parameters_callback ( rclcpp_lifecycle::LifecycleNode::OnParametersSetCallbackType  callback)

Add a callback for when parameters are being set.

See also
rclcpp::Node::add_on_set_parameters_callback

◆ remove_on_set_parameters_callback()

void rclcpp_lifecycle::LifecycleNode::remove_on_set_parameters_callback ( const rclcpp_lifecycle::LifecycleNode::OnSetParametersCallbackHandle *const  handler)

Remove a callback registered with add_on_set_parameters_callback.

See also
rclcpp::Node::remove_on_set_parameters_callback

◆ get_node_names()

std::vector<std::string> rclcpp_lifecycle::LifecycleNode::get_node_names ( ) const

Return a vector of existing node names (string).

See also
rclcpp::Node::get_node_names

◆ get_topic_names_and_types()

std::map<std::string, std::vector<std::string> > rclcpp_lifecycle::LifecycleNode::get_topic_names_and_types ( bool  no_demangle = false) const

Return a map of existing topic names to list of topic types.

See also
rclcpp::Node::get_topic_names_and_types

◆ get_service_names_and_types()

std::map<std::string, std::vector<std::string> > rclcpp_lifecycle::LifecycleNode::get_service_names_and_types ( ) const

Return a map of existing service names to list of topic types.

See also
rclcpp::Node::get_service_names_and_types

◆ get_service_names_and_types_by_node()

std::map<std::string, std::vector<std::string> > rclcpp_lifecycle::LifecycleNode::get_service_names_and_types_by_node ( const std::string node_name,
const std::string namespace_ 
) const

Return a map of existing service names to list of service types for a specific node.

This function only considers services - not clients.

Parameters
[in]node_namename of the node
[in]namespace_namespace of the node

◆ count_publishers()

size_t rclcpp_lifecycle::LifecycleNode::count_publishers ( const std::string topic_name) const

Return the number of publishers that are advertised on a given topic.

See also
rclcpp::Node::count_publishers

◆ count_subscribers()

size_t rclcpp_lifecycle::LifecycleNode::count_subscribers ( const std::string topic_name) const

Return the number of subscribers who have created a subscription for a given topic.

See also
rclcpp::Node::count_subscribers

◆ get_publishers_info_by_topic()

std::vector<rclcpp::TopicEndpointInfo> rclcpp_lifecycle::LifecycleNode::get_publishers_info_by_topic ( const std::string topic_name,
bool  no_mangle = false 
) const

Return the topic endpoint information about publishers on a given topic.

See also
rclcpp::Node::get_publishers_info_by_topic

◆ get_subscriptions_info_by_topic()

std::vector<rclcpp::TopicEndpointInfo> rclcpp_lifecycle::LifecycleNode::get_subscriptions_info_by_topic ( const std::string topic_name,
bool  no_mangle = false 
) const

Return the topic endpoint information about subscriptions on a given topic.

See also
rclcpp::Node::get_subscriptions_info_by_topic

◆ get_graph_event()

rclcpp::Event::SharedPtr rclcpp_lifecycle::LifecycleNode::get_graph_event ( )

Return a graph event, which will be set anytime a graph change occurs.

◆ wait_for_graph_change()

void rclcpp_lifecycle::LifecycleNode::wait_for_graph_change ( rclcpp::Event::SharedPtr  event,
std::chrono::nanoseconds  timeout 
)

Wait for a graph event to occur by waiting on an Event to become set.

◆ get_clock() [1/2]

rclcpp::Clock::SharedPtr rclcpp_lifecycle::LifecycleNode::get_clock ( )

Get a clock as a non-const shared pointer which is managed by the node.

See also
rclcpp::node_interfaces::NodeClock::get_clock

◆ get_clock() [2/2]

rclcpp::Clock::ConstSharedPtr rclcpp_lifecycle::LifecycleNode::get_clock ( ) const

Get a clock as a const shared pointer which is managed by the node.

See also
rclcpp::node_interfaces::NodeClock::get_clock

◆ now()

rclcpp::Time rclcpp_lifecycle::LifecycleNode::now ( ) const

Returns current time from the time source specified by clock_type.

See also
rclcpp::Clock::now

◆ get_node_base_interface()

rclcpp::node_interfaces::NodeBaseInterface::SharedPtr rclcpp_lifecycle::LifecycleNode::get_node_base_interface ( )

Return the Node's internal NodeBaseInterface implementation.

See also
rclcpp::Node::get_node_base_interface

◆ get_node_clock_interface()

rclcpp::node_interfaces::NodeClockInterface::SharedPtr rclcpp_lifecycle::LifecycleNode::get_node_clock_interface ( )

Return the Node's internal NodeClockInterface implementation.

See also
rclcpp::Node::get_node_clock_interface

◆ get_node_graph_interface()

rclcpp::node_interfaces::NodeGraphInterface::SharedPtr rclcpp_lifecycle::LifecycleNode::get_node_graph_interface ( )

Return the Node's internal NodeGraphInterface implementation.

See also
rclcpp::Node::get_node_graph_interface

◆ get_node_logging_interface()

rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr rclcpp_lifecycle::LifecycleNode::get_node_logging_interface ( )

Return the Node's internal NodeLoggingInterface implementation.

See also
rclcpp::Node::get_node_logging_interface

◆ get_node_timers_interface()

rclcpp::node_interfaces::NodeTimersInterface::SharedPtr rclcpp_lifecycle::LifecycleNode::get_node_timers_interface ( )

Return the Node's internal NodeTimersInterface implementation.

See also
rclcpp::Node::get_node_timers_interface

◆ get_node_topics_interface()

rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr rclcpp_lifecycle::LifecycleNode::get_node_topics_interface ( )

Return the Node's internal NodeTopicsInterface implementation.

See also
rclcpp::Node::get_node_topics_interface

◆ get_node_services_interface()

rclcpp::node_interfaces::NodeServicesInterface::SharedPtr rclcpp_lifecycle::LifecycleNode::get_node_services_interface ( )

Return the Node's internal NodeServicesInterface implementation.

See also
rclcpp::Node::get_node_services_interface

◆ get_node_parameters_interface()

rclcpp::node_interfaces::NodeParametersInterface::SharedPtr rclcpp_lifecycle::LifecycleNode::get_node_parameters_interface ( )

Return the Node's internal NodeParametersInterface implementation.

See also
rclcpp::Node::get_node_parameters_interface

◆ get_node_time_source_interface()

rclcpp::node_interfaces::NodeTimeSourceInterface::SharedPtr rclcpp_lifecycle::LifecycleNode::get_node_time_source_interface ( )

Return the Node's internal NodeParametersInterface implementation.

See also
rclcpp::Node::get_node_time_source_interface

◆ get_node_waitables_interface()

rclcpp::node_interfaces::NodeWaitablesInterface::SharedPtr rclcpp_lifecycle::LifecycleNode::get_node_waitables_interface ( )

Return the Node's internal NodeWaitablesInterface implementation.

See also
rclcpp::Node::get_node_waitables_interface

◆ get_node_options()

const rclcpp::NodeOptions& rclcpp_lifecycle::LifecycleNode::get_node_options ( ) const

Return the NodeOptions used when creating this node.

See also
rclcpp::Node::get_node_options

◆ get_current_state()

const State& rclcpp_lifecycle::LifecycleNode::get_current_state ( )

Return the current State.

Returns
the current state

◆ get_available_states()

std::vector<State> rclcpp_lifecycle::LifecycleNode::get_available_states ( )

Return a list with the available states.

Returns
list with the available states.

◆ get_available_transitions()

std::vector<Transition> rclcpp_lifecycle::LifecycleNode::get_available_transitions ( )

Return a list with the current available transitions.

Returns
list with the current available transitions.

◆ get_transition_graph()

std::vector<Transition> rclcpp_lifecycle::LifecycleNode::get_transition_graph ( )

Return a list with all the transitions.

Returns
list with all the transitions in the transition graph.

◆ trigger_transition() [1/4]

const State& rclcpp_lifecycle::LifecycleNode::trigger_transition ( const Transition transition)

Trigger the specified transition.

◆ trigger_transition() [2/4]

const State& rclcpp_lifecycle::LifecycleNode::trigger_transition ( const Transition transition,
LifecycleNodeInterface::CallbackReturn &  cb_return_code 
)

Trigger the specified transition and get the callback return code.

◆ trigger_transition() [3/4]

const State& rclcpp_lifecycle::LifecycleNode::trigger_transition ( uint8_t  transition_id)

Trigger the specified transition based on an id.

◆ trigger_transition() [4/4]

const State& rclcpp_lifecycle::LifecycleNode::trigger_transition ( uint8_t  transition_id,
LifecycleNodeInterface::CallbackReturn &  cb_return_code 
)

Trigger the specified transition based on an id and get the callback return code.

◆ configure() [1/2]

const State& rclcpp_lifecycle::LifecycleNode::configure ( )

Trigger the configure transition.

◆ configure() [2/2]

const State& rclcpp_lifecycle::LifecycleNode::configure ( LifecycleNodeInterface::CallbackReturn &  cb_return_code)

Trigger the configure transition and get the callback return code.

◆ cleanup() [1/2]

const State& rclcpp_lifecycle::LifecycleNode::cleanup ( )

Trigger the cleanup transition.

◆ cleanup() [2/2]

const State& rclcpp_lifecycle::LifecycleNode::cleanup ( LifecycleNodeInterface::CallbackReturn &  cb_return_code)

Trigger the cleanup transition and get the callback return code.

◆ activate() [1/2]

const State& rclcpp_lifecycle::LifecycleNode::activate ( )

Trigger the activate transition.

◆ activate() [2/2]

const State& rclcpp_lifecycle::LifecycleNode::activate ( LifecycleNodeInterface::CallbackReturn &  cb_return_code)

Trigger the activate transition and get the callback return code.

◆ deactivate() [1/2]

const State& rclcpp_lifecycle::LifecycleNode::deactivate ( )

Trigger the deactivate transition.

◆ deactivate() [2/2]

const State& rclcpp_lifecycle::LifecycleNode::deactivate ( LifecycleNodeInterface::CallbackReturn &  cb_return_code)

Trigger the deactivate transition and get the callback return code.

◆ shutdown() [1/2]

const State& rclcpp_lifecycle::LifecycleNode::shutdown ( )

Trigger the shutdown transition.

◆ shutdown() [2/2]

const State& rclcpp_lifecycle::LifecycleNode::shutdown ( LifecycleNodeInterface::CallbackReturn &  cb_return_code)

Trigger the shutdown transition and get the callback return code.

◆ register_on_configure()

bool rclcpp_lifecycle::LifecycleNode::register_on_configure ( std::function< LifecycleNodeInterface::CallbackReturn(const State &)>  fcn)

Register the configure callback.

This callback will be called when the transition to this state is triggered

Parameters
[in]fcncallback function to call
Returns
always true

◆ register_on_cleanup()

bool rclcpp_lifecycle::LifecycleNode::register_on_cleanup ( std::function< LifecycleNodeInterface::CallbackReturn(const State &)>  fcn)

Register the cleanup callback.

This callback will be called when the transition to this state is triggered

Parameters
[in]fcncallback function to call
Returns
always true

◆ register_on_shutdown()

bool rclcpp_lifecycle::LifecycleNode::register_on_shutdown ( std::function< LifecycleNodeInterface::CallbackReturn(const State &)>  fcn)

Register the shutdown callback.

This callback will be called when the transition to this state is triggered

Parameters
[in]fcncallback function to call
Returns
always true

◆ register_on_activate()

bool rclcpp_lifecycle::LifecycleNode::register_on_activate ( std::function< LifecycleNodeInterface::CallbackReturn(const State &)>  fcn)

Register the activate callback.

This callback will be called when the transition to this state is triggered

Parameters
[in]fcncallback function to call
Returns
always true

◆ register_on_deactivate()

bool rclcpp_lifecycle::LifecycleNode::register_on_deactivate ( std::function< LifecycleNodeInterface::CallbackReturn(const State &)>  fcn)

Register the deactivate callback.

This callback will be called when the transition to this state is triggered

Parameters
[in]fcncallback function to call
Returns
always true

◆ register_on_error()

bool rclcpp_lifecycle::LifecycleNode::register_on_error ( std::function< LifecycleNodeInterface::CallbackReturn(const State &)>  fcn)

Register the error callback.

This callback will be called when the transition to this state is triggered

Parameters
[in]fcncallback function to call
Returns
always true

◆ add_publisher_handle()

void rclcpp_lifecycle::LifecycleNode::add_publisher_handle ( std::shared_ptr< rclcpp_lifecycle::LifecyclePublisherInterface pub)
protected

◆ add_timer_handle()

void rclcpp_lifecycle::LifecycleNode::add_timer_handle ( std::shared_ptr< rclcpp::TimerBase timer)
protected

◆ create_subscription() [2/2]

template<typename MessageT , typename CallbackT , typename AllocatorT , typename CallbackMessageT , typename SubscriptionT , typename MessageMemoryStrategyT >
std::shared_ptr<SubscriptionT> rclcpp_lifecycle::LifecycleNode::create_subscription ( const std::string topic_name,
const rclcpp::QoS qos,
CallbackT &&  callback,
const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &  options,
typename MessageMemoryStrategyT::SharedPtr  msg_mem_strat 
)

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