ROS 2 rclcpp + rcl - rolling  rolling-a919a6e5
ROS 2 C++ Client Library with ROS Client Library
Classes | Typedefs | Enumerations | Functions
rclcpp Namespace Reference

Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types. More...

Classes

struct  AnyExecutable
 
class  Service
 
class  AnyServiceCallback
 
class  AnySubscriptionCallback
 
class  CallbackGroup
 
class  ClientBase
 
class  Client
 
class  JumpHandler
 
class  Clock
 
class  ClockWaiter
 
class  ClockConditionalVariable
 
class  ContextAlreadyInitialized
 Thrown when init is called on an already initialized context. More...
 
class  ShutdownCallbackHandle
 
class  Context
 Context which encapsulates shared state between nodes and other similar entities. More...
 
class  Duration
 
class  Event
 
struct  PublisherEventCallbacks
 Contains callbacks for various types of events a Publisher can receive from the middleware. More...
 
struct  SubscriptionEventCallbacks
 Contains callbacks for non-message events that a Subscription can receive from the middleware. More...
 
class  UnsupportedEventTypeException
 
class  EventHandlerBase
 
class  EventHandler
 
class  Executor
 Coordinate the order and timing of available communication tasks. More...
 
struct  ExecutorOptions
 Options to be passed to the executor constructor. More...
 
class  GenericClient
 
class  GenericPublisher
 Publisher for serialized messages whose type is not known at compile time. More...
 
class  GenericServiceCallback
 
class  GenericService
 
class  GenericSubscription
 Subscription for serialized messages whose type is not known at compile time. More...
 
class  GuardCondition
 A condition that can be waited on in a single wait set and asynchronously triggered. More...
 
class  InitOptions
 Encapsulation of options for initializing rclcpp. More...
 
struct  is_ros_compatible_type
 
class  LoanedMessage
 
class  Logger
 
class  MessageInfo
 Additional meta data about messages taken from subscriptions. More...
 
class  NetworkFlowEndpoint
 
class  Node
 Node is the single point of entry for creating publishers and subscribers. More...
 
class  TopicEndpointInfo
 
class  NodeOptions
 Encapsulation of options for node initialization. More...
 
class  Parameter
 Structure to store an arbitrary parameter with templated get/set methods. More...
 
class  AsyncParametersClient
 
class  SyncParametersClient
 
struct  ParameterCallbackHandle
 
struct  ParameterEventCallbackHandle
 
class  ParameterEventHandler
 A class used to "handle" (monitor and respond to) changes to parameters. More...
 
class  ParameterEventsFilter
 
class  ParameterService
 
class  ParameterTypeException
 Indicate the parameter type does not match the expected type. More...
 
class  ParameterValue
 Store the type and value of a parameter. More...
 
class  Publisher
 A publisher publishes messages of any type to a topic. More...
 
class  PublisherBase
 
struct  PublisherFactory
 Factory with functions used to create a MessageT specific PublisherT. More...
 
struct  PublisherOptionsBase
 Non-templated part of PublisherOptionsWithAllocator<Allocator>. More...
 
struct  PublisherOptionsWithAllocator
 Structure containing optional configuration for Publishers. More...
 
struct  QoSInitialization
 QoS initialization values, cannot be created directly, use KeepAll or KeepLast instead. More...
 
struct  KeepAll
 Use to initialize the QoS with the keep_all history setting. More...
 
struct  KeepLast
 Use to initialize the QoS with the keep_last history setting and the given depth. More...
 
class  QoS
 Encapsulation of Quality of Service settings. More...
 
struct  QoSCheckCompatibleResult
 Result type for checking QoS compatibility. More...
 
class  ClockQoS
 
class  SensorDataQoS
 
class  ParametersQoS
 
class  ServicesQoS
 
class  ParameterEventsQoS
 
class  RosoutQoS
 
class  SystemDefaultsQoS
 
class  BestAvailableQoS
 
class  QosOverridingOptions
 Options that are passed in subscription/publisher constructor to specify QoSConfigurability. More...
 
class  RateBase
 
class  Rate
 
class  WallRate
 
class  SerializationBase
 Interface to (de)serialize a message. More...
 
class  Serialization
 Default implementation to (de)serialize a message by using rmw_(de)serialize. More...
 
class  SerializedMessage
 Object oriented version of rcl_serialized_message_t with destructor to avoid memory leaks. More...
 
class  ServiceBase
 
class  Subscription
 Subscription implementation, templated on the type of message this subscription receives. More...
 
class  SubscriptionBase
 
struct  ContentFilterOptions
 Options to configure content filtered topic in the subscription. More...
 
struct  SubscriptionFactory
 Factory containing a function used to create a Subscription<MessageT>. More...
 
struct  SubscriptionOptionsBase
 Non-template base class for subscription options. More...
 
struct  SubscriptionOptionsWithAllocator
 Structure containing optional configuration for Subscriptions. More...
 
class  SubscriptionWaitSetMask
 Options used to determine what parts of a subscription get added to or removed from a wait set. More...
 
class  Time
 
class  TimeSource
 
struct  TimerInfo
 
class  TimerBase
 
class  GenericTimer
 Generic timer. Periodically executes a user-specified callback. More...
 
class  WallTimer
 
struct  TypeAdapter
 Template structure used to adapt custom, user-defined types to ROS types. More...
 
struct  is_type_adapter
 Helper template to determine if a type is a TypeAdapter, false specialization. More...
 
struct  is_type_adapter< TypeAdapter< Ts... > >
 Helper template to determine if a type is a TypeAdapter, true specialization. More...
 
struct  TypeAdapter< T, void, std::enable_if_t< is_type_adapter< T >::value > >
 Identity specialization for TypeAdapter. More...
 
struct  adapt_type
 Template metafunction that can make the type being adapted explicit. More...
 
struct  ImplicitTypeAdapter
 Implicit type adapter used as a short hand way to create something with just the custom type. More...
 
struct  TypeAdapter< T, void, std::enable_if_t< ImplicitTypeAdapter< T >::is_specialized::value > >
 Specialization of TypeAdapter for ImplicitTypeAdapter. More...
 
class  WaitResult
 Interface for introspecting a wait set after waiting on it. More...
 
class  WaitSetTemplate
 Encapsulates sets of waitable items which can be waited on as a group. More...
 
class  Waitable
 
class  WeakContextsWrapper
 Class to manage vector of weak pointers to all created contexts. More...
 
class  ExecutorImplementation
 
class  ExecutorOptionsImplementation
 
class  SignalHandler
 Responsible for managing the SIGINT/SIGTERM signal handling. More...
 
class  ClocksState
 

Typedefs

using OnShutdownCallbackHandle = ShutdownCallbackHandle
 
using PreShutdownCallbackHandle = ShutdownCallbackHandle
 
using QOSDeadlineRequestedInfo = rmw_requested_deadline_missed_status_t
 
using QOSDeadlineOfferedInfo = rmw_offered_deadline_missed_status_t
 
using QOSLivelinessChangedInfo = rmw_liveliness_changed_status_t
 
using QOSLivelinessLostInfo = rmw_liveliness_lost_status_t
 
using QOSMessageLostInfo = rmw_message_lost_status_t
 
using QOSOfferedIncompatibleQoSInfo = rmw_offered_qos_incompatible_event_status_t
 
using QOSRequestedIncompatibleQoSInfo = rmw_requested_qos_incompatible_event_status_t
 
using IncompatibleTypeInfo = rmw_incompatible_type_status_t
 
using MatchedInfo = rmw_matched_status_t
 
using QOSDeadlineRequestedCallbackType = std::function< void(QOSDeadlineRequestedInfo &)>
 
using QOSDeadlineOfferedCallbackType = std::function< void(QOSDeadlineOfferedInfo &)>
 
using QOSLivelinessChangedCallbackType = std::function< void(QOSLivelinessChangedInfo &)>
 
using QOSLivelinessLostCallbackType = std::function< void(QOSLivelinessLostInfo &)>
 
using QOSMessageLostCallbackType = std::function< void(QOSMessageLostInfo &)>
 
using QOSOfferedIncompatibleQoSCallbackType = std::function< void(QOSOfferedIncompatibleQoSInfo &)>
 
using QOSRequestedIncompatibleQoSCallbackType = std::function< void(QOSRequestedIncompatibleQoSInfo &)>
 
using IncompatibleTypeCallbackType = std::function< void(IncompatibleTypeInfo &)>
 
using PublisherMatchedCallbackType = std::function< void(MatchedInfo &)>
 
using SubscriptionMatchedCallbackType = std::function< void(MatchedInfo &)>
 
using ParameterMap = std::unordered_map< std::string, std::vector< Parameter > >
 A map of fully qualified node names to a list of parameters.
 
using PublisherOptions = PublisherOptionsWithAllocator< std::allocator< void > >
 
using QosCallbackResult = rcl_interfaces::msg::SetParametersResult
 
using QosCallback = std::function< QosCallbackResult(const rclcpp::QoS &)>
 
using SubscriptionOptions = SubscriptionOptionsWithAllocator< std::allocator< void > >
 
using VoidCallbackType = std::function< void()>
 
using TimerCallbackType = std::function< void(TimerBase &)>
 
using TimerInfoCallbackType = std::function< void(const TimerInfo &)>
 
using WaitSet = rclcpp::WaitSetTemplate< rclcpp::wait_set_policies::SequentialSynchronization, rclcpp::wait_set_policies::DynamicStorage >
 Most common user configuration of a WaitSet, which is dynamic but not thread-safe. More...
 
template<std::size_t NumberOfSubscriptions, std::size_t NumberOfGuardCondtions, std::size_t NumberOfTimers, std::size_t NumberOfClients, std::size_t NumberOfServices, std::size_t NumberOfWaitables>
using StaticWaitSet = rclcpp::WaitSetTemplate< rclcpp::wait_set_policies::SequentialSynchronization, rclcpp::wait_set_policies::StaticStorage< NumberOfSubscriptions, NumberOfGuardCondtions, NumberOfTimers, NumberOfClients, NumberOfServices, NumberOfWaitables > >
 WaitSet configuration which does not allow changes after construction. More...
 
using ThreadSafeWaitSet = rclcpp::WaitSetTemplate< rclcpp::wait_set_policies::ThreadSafeSynchronization, rclcpp::wait_set_policies::DynamicStorage >
 Like WaitSet, this configuration is dynamic, but is also thread-safe. More...
 

Enumerations

enum class  CallbackGroupType { MutuallyExclusive , Reentrant }
 
enum class  FutureReturnCode { SUCCESS , INTERRUPTED , TIMEOUT }
 Return codes to be used with spin_until_future_complete. More...
 
enum class  IntraProcessBufferType { SharedPtr , UniquePtr , CallbackDefault }
 
enum class  IntraProcessSetting { Enable , Disable , NodeDefault }
 Used as argument in create_publisher and create_subscriber. More...
 
enum class  EndpointType { Invalid = RMW_ENDPOINT_INVALID , Publisher = RMW_ENDPOINT_PUBLISHER , Subscription = RMW_ENDPOINT_SUBSCRIPTION }
 
enum  ParameterType : uint8_t {
  PARAMETER_NOT_SET = rcl_interfaces::msg::ParameterType::PARAMETER_NOT_SET , PARAMETER_BOOL = rcl_interfaces::msg::ParameterType::PARAMETER_BOOL , PARAMETER_INTEGER = rcl_interfaces::msg::ParameterType::PARAMETER_INTEGER , PARAMETER_DOUBLE = rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE ,
  PARAMETER_STRING = rcl_interfaces::msg::ParameterType::PARAMETER_STRING , PARAMETER_BYTE_ARRAY = rcl_interfaces::msg::ParameterType::PARAMETER_BYTE_ARRAY , PARAMETER_BOOL_ARRAY = rcl_interfaces::msg::ParameterType::PARAMETER_BOOL_ARRAY , PARAMETER_INTEGER_ARRAY = rcl_interfaces::msg::ParameterType::PARAMETER_INTEGER_ARRAY ,
  PARAMETER_DOUBLE_ARRAY = rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE_ARRAY , PARAMETER_STRING_ARRAY = rcl_interfaces::msg::ParameterType::PARAMETER_STRING_ARRAY
}
 
enum class  HistoryPolicy { KeepLast = RMW_QOS_POLICY_HISTORY_KEEP_LAST , KeepAll = RMW_QOS_POLICY_HISTORY_KEEP_ALL , SystemDefault = RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT , Unknown = RMW_QOS_POLICY_HISTORY_UNKNOWN }
 
enum class  ReliabilityPolicy {
  BestEffort = RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT , Reliable = RMW_QOS_POLICY_RELIABILITY_RELIABLE , SystemDefault = RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT , BestAvailable = RMW_QOS_POLICY_RELIABILITY_BEST_AVAILABLE ,
  Unknown = RMW_QOS_POLICY_RELIABILITY_UNKNOWN
}
 
enum class  DurabilityPolicy {
  Volatile = RMW_QOS_POLICY_DURABILITY_VOLATILE , TransientLocal = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL , SystemDefault = RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT , BestAvailable = RMW_QOS_POLICY_DURABILITY_BEST_AVAILABLE ,
  Unknown = RMW_QOS_POLICY_DURABILITY_UNKNOWN
}
 
enum class  LivelinessPolicy {
  Automatic = RMW_QOS_POLICY_LIVELINESS_AUTOMATIC , ManualByTopic = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC , SystemDefault = RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT , BestAvailable = RMW_QOS_POLICY_LIVELINESS_BEST_AVAILABLE ,
  Unknown = RMW_QOS_POLICY_LIVELINESS_UNKNOWN
}
 
enum class  QoSCompatibility { Ok = RMW_QOS_COMPATIBILITY_OK , Warning = RMW_QOS_COMPATIBILITY_WARNING , Error = RMW_QOS_COMPATIBILITY_ERROR }
 
enum class  DeliveredMessageKind : uint8_t { INVALID = 0 , ROS_MESSAGE = 1 , SERIALIZED_MESSAGE = 2 , DYNAMIC_MESSAGE = 3 }
 The kind of message that the subscription delivers in its callback, used by the executor. More...
 
enum class  TopicStatisticsState { Enable , Disable , NodeDefault }
 
enum class  SignalHandlerOptions { All , SigInt , SigTerm , None }
 Option to indicate which signal handlers rclcpp should install. More...
 

Functions

RCLCPP_PUBLIC std::vector< Context::SharedPtr > get_contexts ()
 Return a copy of the list of context shared pointers. More...
 
template<typename NodeT1 , typename NodeT2 >
void copy_all_parameter_values (const NodeT1 &source, const NodeT2 &destination, const bool override_existing_params=false)
 
template<typename ServiceT >
rclcpp::Client< ServiceT >::SharedPtr create_client (std::shared_ptr< node_interfaces::NodeBaseInterface > node_base, std::shared_ptr< node_interfaces::NodeGraphInterface > node_graph, std::shared_ptr< node_interfaces::NodeServicesInterface > node_services, const std::string &service_name, const rclcpp::QoS &qos=rclcpp::ServicesQoS(), rclcpp::CallbackGroup::SharedPtr group=nullptr)
 Create a service client with a given type. More...
 
RCLCPP_PUBLIC rclcpp::GenericClient::SharedPtr create_generic_client (std::shared_ptr< node_interfaces::NodeBaseInterface > node_base, std::shared_ptr< node_interfaces::NodeGraphInterface > node_graph, std::shared_ptr< node_interfaces::NodeServicesInterface > node_services, const std::string &service_name, const std::string &service_type, const rclcpp::QoS &qos=rclcpp::ServicesQoS(), rclcpp::CallbackGroup::SharedPtr group=nullptr)
 Create a generic service client with a name of given type. More...
 
template<typename NodeT >
rclcpp::GenericClient::SharedPtr create_generic_client (NodeT node, const std::string &service_name, const std::string &service_type, const rclcpp::QoS &qos=rclcpp::ServicesQoS(), rclcpp::CallbackGroup::SharedPtr group=nullptr)
 Create a generic service client with a name of given type. More...
 
template<typename AllocatorT = std::allocator<void>>
std::shared_ptr< GenericPublishercreate_generic_publisher (rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr topics_interface, 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 CallbackT >
rclcpp::GenericService::SharedPtr create_generic_service (std::shared_ptr< node_interfaces::NodeBaseInterface > node_base, std::shared_ptr< node_interfaces::NodeServicesInterface > node_services, const std::string &service_name, const std::string &service_type, CallbackT &&callback, const rclcpp::QoS &qos, rclcpp::CallbackGroup::SharedPtr group)
 Create a generic service with a given type. More...
 
template<typename NodeT , typename CallbackT >
rclcpp::GenericService::SharedPtr create_generic_service (NodeT node, const std::string &service_name, const std::string &service_type, CallbackT &&callback, const rclcpp::QoS &qos, rclcpp::CallbackGroup::SharedPtr group)
 Create a generic service with a given type. More...
 
template<typename CallbackT , typename AllocatorT = std::allocator<void>>
std::shared_ptr< GenericSubscriptioncreate_generic_subscription (rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr topics_interface, const std::string &topic_name, const std::string &topic_type, const rclcpp::QoS &qos, CallbackT &&callback, const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &options=(rclcpp::SubscriptionOptionsWithAllocator< AllocatorT >()))
 Create and return a GenericSubscription. More...
 
template<typename MessageT , typename AllocatorT = std::allocator<void>, typename PublisherT = rclcpp::Publisher<MessageT, AllocatorT>, typename NodeT >
std::shared_ptr< PublisherT > create_publisher (NodeT &&node, const std::string &topic_name, const rclcpp::QoS &qos, const rclcpp::PublisherOptionsWithAllocator< AllocatorT > &options=(rclcpp::PublisherOptionsWithAllocator< AllocatorT >()))
 Create and return a publisher of the given MessageT type. More...
 
template<typename MessageT , typename AllocatorT = std::allocator<void>, typename PublisherT = rclcpp::Publisher<MessageT, AllocatorT>>
std::shared_ptr< PublisherT > create_publisher (rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &node_parameters, rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr &node_topics, const std::string &topic_name, const rclcpp::QoS &qos, const rclcpp::PublisherOptionsWithAllocator< AllocatorT > &options=(rclcpp::PublisherOptionsWithAllocator< AllocatorT >()))
 Create and return a publisher of the given MessageT type.
 
template<typename ServiceT , typename CallbackT >
rclcpp::Service< ServiceT >::SharedPtr create_service (std::shared_ptr< node_interfaces::NodeBaseInterface > node_base, std::shared_ptr< node_interfaces::NodeServicesInterface > node_services, const std::string &service_name, CallbackT &&callback, const rclcpp::QoS &qos, rclcpp::CallbackGroup::SharedPtr group)
 Create a service with a given type. More...
 
template<typename ServiceT , typename CallbackT >
rclcpp::Service< ServiceT >::SharedPtr create_service (std::shared_ptr< node_interfaces::NodeBaseInterface > node_base, std::shared_ptr< node_interfaces::NodeServicesInterface > node_services, const std::string &service_name, CallbackT &&callback, const rmw_qos_profile_t &qos_profile, rclcpp::CallbackGroup::SharedPtr group)
 
template<typename MessageT , typename CallbackT , typename AllocatorT = std::allocator<void>, typename SubscriptionT = rclcpp::Subscription<MessageT, AllocatorT>, typename MessageMemoryStrategyT = typename SubscriptionT::MessageMemoryStrategyType, typename NodeT >
std::shared_ptr< SubscriptionT > create_subscription (NodeT &node, 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 of the given MessageT type. More...
 
template<typename MessageT , typename CallbackT , typename AllocatorT = std::allocator<void>, typename SubscriptionT = rclcpp::Subscription<MessageT, AllocatorT>, typename MessageMemoryStrategyT = typename SubscriptionT::MessageMemoryStrategyType>
std::shared_ptr< SubscriptionT > create_subscription (rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &node_parameters, rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr &node_topics, 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 of the given MessageT type. More...
 
template<typename CallbackT >
rclcpp::TimerBase::SharedPtr create_timer (std::shared_ptr< node_interfaces::NodeBaseInterface > node_base, std::shared_ptr< node_interfaces::NodeTimersInterface > node_timers, rclcpp::Clock::SharedPtr clock, rclcpp::Duration period, CallbackT &&callback, rclcpp::CallbackGroup::SharedPtr group=nullptr, bool autostart=true)
 
template<typename NodeT , typename CallbackT >
rclcpp::TimerBase::SharedPtr create_timer (NodeT node, rclcpp::Clock::SharedPtr clock, rclcpp::Duration period, CallbackT &&callback, rclcpp::CallbackGroup::SharedPtr group=nullptr, bool autostart=true)
 Create a timer with a given clock.
 
template<typename DurationRepT , typename DurationT , typename CallbackT >
rclcpp::GenericTimer< CallbackT >::SharedPtr create_timer (rclcpp::Clock::SharedPtr clock, std::chrono::duration< DurationRepT, DurationT > period, CallbackT callback, rclcpp::CallbackGroup::SharedPtr group, node_interfaces::NodeBaseInterface *node_base, node_interfaces::NodeTimersInterface *node_timers, bool autostart=true)
 Convenience method to create a general timer with node resources. More...
 
template<typename DurationRepT , typename DurationT , typename CallbackT >
rclcpp::WallTimer< CallbackT >::SharedPtr create_wall_timer (std::chrono::duration< DurationRepT, DurationT > period, CallbackT callback, rclcpp::CallbackGroup::SharedPtr group, node_interfaces::NodeBaseInterface *node_base, node_interfaces::NodeTimersInterface *node_timers, bool autostart=true)
 Convenience method to create a wall timer with node resources. More...
 
RCLCPP_PUBLIC builtin_interfaces::msg::Time operator+ (const builtin_interfaces::msg::Time &lhs, const rclcpp::Duration &rhs)
 
RCLCPP_PUBLIC builtin_interfaces::msg::Time operator- (const builtin_interfaces::msg::Time &lhs, const rclcpp::Duration &rhs)
 
RCLCPP_PUBLIC void spin_all (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, std::chrono::nanoseconds max_duration)
 Create a default single-threaded executor and execute all available work exhaustively. More...
 
RCLCPP_PUBLIC void spin_all (rclcpp::Node::SharedPtr node_ptr, std::chrono::nanoseconds max_duration)
 
RCLCPP_PUBLIC void spin_some (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
 Create a default single-threaded executor and execute any immediately available work. More...
 
RCLCPP_PUBLIC void spin_some (rclcpp::Node::SharedPtr node_ptr)
 
RCLCPP_PUBLIC void spin (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
 Create a default single-threaded executor and spin the specified node. More...
 
RCLCPP_PUBLIC void spin (rclcpp::Node::SharedPtr node_ptr)
 
template<typename FutureT , typename TimeRepT = int64_t, typename TimeT = std::milli>
rclcpp::FutureReturnCode spin_until_future_complete (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, const FutureT &future, std::chrono::duration< TimeRepT, TimeT > timeout=std::chrono::duration< TimeRepT, TimeT >(-1))
 
template<typename NodeT = rclcpp::Node, typename FutureT , typename TimeRepT = int64_t, typename TimeT = std::milli>
rclcpp::FutureReturnCode spin_until_future_complete (std::shared_ptr< NodeT > node_ptr, const FutureT &future, std::chrono::duration< TimeRepT, TimeT > timeout=std::chrono::duration< TimeRepT, TimeT >(-1))
 
RCLCPP_PUBLIC std::string expand_topic_or_service_name (const std::string &name, const std::string &node_name, const std::string &namespace_, bool is_service=false)
 Expand a topic or service name and throw if it is not valid. More...
 
RCLCPP_PUBLIC std::ostream & operator<< (std::ostream &os, const FutureReturnCode &future_return_code)
 Stream operator for FutureReturnCode.
 
RCLCPP_PUBLIC std::string to_string (const FutureReturnCode &future_return_code)
 String conversion function for FutureReturnCode.
 
template<typename MessageT >
constexpr std::enable_if_t< rosidl_generator_traits::is_message< MessageT >::value, const rosidl_message_type_support_t & > get_message_type_support_handle ()
 
template<typename AdaptedType >
constexpr std::enable_if_t< !rosidl_generator_traits::is_message< AdaptedType >::value &&rclcpp::TypeAdapter< AdaptedType >::is_specialized::value, const rosidl_message_type_support_t & > get_message_type_support_handle ()
 
template<typename AdaptedType >
constexpr std::enable_if_t< !rosidl_generator_traits::is_message< AdaptedType >::value &&!TypeAdapter< AdaptedType >::is_specialized::value, const rosidl_message_type_support_t & > get_message_type_support_handle ()
 
RCLCPP_PUBLIC Logger get_logger (const std::string &name)
 Return a named logger. More...
 
RCLCPP_PUBLIC Logger get_node_logger (const rcl_node_t *node)
 Return a named logger using an rcl_node_t. More...
 
RCLCPP_PUBLIC std::filesystem::path get_log_directory ()
 Get the current logging directory. More...
 
RCLCPP_PUBLIC bool operator== (const NetworkFlowEndpoint &left, const NetworkFlowEndpoint &right)
 Check if two NetworkFlowEndpoint instances are equal.
 
RCLCPP_PUBLIC bool operator!= (const NetworkFlowEndpoint &left, const NetworkFlowEndpoint &right)
 Check if two NetworkFlowEndpoint instances are not equal.
 
RCLCPP_PUBLIC std::ostream & operator<< (std::ostream &os, const NetworkFlowEndpoint &network_flow_endpoint)
 Streaming helper for NetworkFlowEndpoint.
 
RCLCPP_LOCAL std::string extend_name_with_sub_namespace (const std::string &name, const std::string &sub_namespace)
 
RCLCPP_PUBLIC std::string _to_json_dict_entry (const Parameter &param)
 Return a json encoded version of the parameter intended for a dict.
 
RCLCPP_PUBLIC std::ostream & operator<< (std::ostream &os, const rclcpp::Parameter &pv)
 
RCLCPP_PUBLIC std::ostream & operator<< (std::ostream &os, const std::vector< Parameter > &parameters)
 
RCLCPP_PUBLIC ParameterMap parameter_map_from (const rcl_params_t *const c_params, const char *node_fqn=nullptr)
 
RCLCPP_PUBLIC ParameterValue parameter_value_from (const rcl_variant_t *const c_value)
 
RCLCPP_PUBLIC ParameterMap parameter_map_from_yaml_file (const std::string &yaml_filename, const char *node_fqn=nullptr)
 
RCLCPP_PUBLIC std::vector< Parameterparameters_from_map (const ParameterMap &parameter_map, const char *node_fqn=nullptr)
 
RCLCPP_PUBLIC std::string to_string (ParameterType type)
 Return the name of a parameter type.
 
RCLCPP_PUBLIC std::ostream & operator<< (std::ostream &os, ParameterType type)
 
RCLCPP_PUBLIC std::string to_string (const ParameterValue &value)
 Return the value of a parameter as a string.
 
template<typename MessageT , typename AllocatorT , typename PublisherT >
PublisherFactory create_publisher_factory (const rclcpp::PublisherOptionsWithAllocator< AllocatorT > &options)
 Return a PublisherFactory with functions setup for creating a PublisherT<MessageT, AllocatorT>.
 
RCLCPP_PUBLIC std::string qos_policy_name_from_kind (rmw_qos_policy_kind_t policy_kind)
 
RCLCPP_PUBLIC bool operator== (const QoS &left, const QoS &right)
 Check if two QoS profiles are exactly equal in all policy values.
 
RCLCPP_PUBLIC bool operator!= (const QoS &left, const QoS &right)
 
RCLCPP_PUBLIC QoSCheckCompatibleResult qos_check_compatible (const QoS &publisher_qos, const QoS &subscription_qos)
 Check if two QoS profiles are compatible. More...
 
RCLCPP_PUBLIC const char * qos_policy_kind_to_cstr (const QosPolicyKind &qpk)
 
RCLCPP_PUBLIC std::ostream & operator<< (std::ostream &os, const QosPolicyKind &qpk)
 
template<typename MessageT , typename CallbackT , typename AllocatorT , typename SubscriptionT = rclcpp::Subscription<MessageT, AllocatorT>, typename MessageMemoryStrategyT = typename SubscriptionT::MessageMemoryStrategyType>
SubscriptionFactory create_subscription_factory (CallbackT &&callback, const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &options, typename MessageMemoryStrategyT::SharedPtr msg_mem_strat, std::shared_ptr< rclcpp::topic_statistics::SubscriptionTopicStatistics > subscription_topic_stats=nullptr)
 Return a SubscriptionFactory setup to create a SubscriptionT<MessageT, AllocatorT>. More...
 
RCLCPP_PUBLIC Time operator+ (const rclcpp::Duration &lhs, const rclcpp::Time &rhs)
 
RCLCPP_PUBLIC builtin_interfaces::msg::Time convert_rcl_time_to_sec_nanos (const rcl_time_point_value_t &time_point)
 Convert rcl_time_point_value_t to builtin_interfaces::msg::Time. More...
 
RCLCPP_PUBLIC std::tuple< std::string, std::string, std::string > extract_type_identifier (const std::string &full_type)
 Extract the package name, middle module, and type name from a full type string. More...
 
RCLCPP_PUBLIC std::string get_typesupport_library_path (const std::string &package_name, const std::string &typesupport_identifier)
 Look for the library in the ament prefix paths and return the path to the type support library. More...
 
RCLCPP_PUBLIC std::shared_ptr< rcpputils::SharedLibrary > get_typesupport_library (const std::string &type, const std::string &typesupport_identifier)
 Load the type support library for the given type. More...
 
RCLCPP_PUBLIC const rosidl_message_type_support_t * get_message_typesupport_handle (const std::string &type, const std::string &typesupport_identifier, rcpputils::SharedLibrary &library)
 Extracts the message type support handle from the library. More...
 
RCLCPP_PUBLIC const rosidl_service_type_support_t * get_service_typesupport_handle (const std::string &type, const std::string &typesupport_identifier, rcpputils::SharedLibrary &library)
 Extracts the service type support handle from the library. More...
 
RCLCPP_PUBLIC const rosidl_action_type_support_t * get_action_typesupport_handle (const std::string &type, const std::string &typesupport_identifier, rcpputils::SharedLibrary &library)
 Extracts the action type support handle from the library. More...
 
RCLCPP_PUBLIC void init (int argc, char const *const *argv, const InitOptions &init_options=InitOptions(), SignalHandlerOptions signal_handler_options=SignalHandlerOptions::All)
 Initialize communications via the rmw implementation and set up a global signal handler. More...
 
RCLCPP_PUBLIC bool install_signal_handlers (SignalHandlerOptions signal_handler_options=SignalHandlerOptions::All)
 Install the global signal handler for rclcpp. More...
 
RCLCPP_PUBLIC bool signal_handlers_installed ()
 Return true if the signal handlers are installed, otherwise false.
 
RCLCPP_PUBLIC SignalHandlerOptions get_current_signal_handler_options ()
 Get the current signal handler options. More...
 
RCLCPP_PUBLIC bool uninstall_signal_handlers ()
 Uninstall the global signal handler for rclcpp. More...
 
RCLCPP_PUBLIC std::vector< std::string > init_and_remove_ros_arguments (int argc, char const *const *argv, const InitOptions &init_options=InitOptions())
 Initialize communications via the rmw implementation and set up a global signal handler. More...
 
RCLCPP_PUBLIC std::vector< std::string > remove_ros_arguments (int argc, char const *const *argv)
 Remove ROS-specific arguments from argument vector. More...
 
RCLCPP_PUBLIC bool ok (rclcpp::Context::SharedPtr context=nullptr)
 Check rclcpp's status. More...
 
RCLCPP_PUBLIC bool shutdown (rclcpp::Context::SharedPtr context=nullptr, const std::string &reason="user called rclcpp::shutdown()")
 Shutdown rclcpp context, invalidating it for derived entities. More...
 
RCLCPP_PUBLIC void on_shutdown (std::function< void()> callback, rclcpp::Context::SharedPtr context=nullptr)
 Register a function to be called when shutdown is called on the context. More...
 
RCLCPP_PUBLIC bool sleep_for (const std::chrono::nanoseconds &nanoseconds, rclcpp::Context::SharedPtr context=nullptr)
 Use the global condition variable to block for the specified amount of time. More...
 
template<typename T >
bool add_will_overflow (const T x, const T y)
 Safely check if addition will overflow. More...
 
template<typename T >
bool add_will_underflow (const T x, const T y)
 Safely check if addition will underflow. More...
 
template<typename T >
bool sub_will_overflow (const T x, const T y)
 Safely check if subtraction will overflow. More...
 
template<typename T >
bool sub_will_underflow (const T x, const T y)
 Safely check if subtraction will underflow. More...
 
RCLCPP_PUBLIC const char * get_c_string (const char *string_in)
 Return the given string. More...
 
RCLCPP_PUBLIC const char * get_c_string (const std::string &string_in)
 Return the C string from the given std::string. More...
 
RCLCPP_PUBLIC std::vector< const char * > get_c_vector_string (const std::vector< std::string > &strings_in)
 Return the std::vector of C string from the given std::vector<std::string>. More...
 
template<class MsgT , class Rep = int64_t, class Period = std::milli>
bool wait_for_message (MsgT &out, std::shared_ptr< rclcpp::Subscription< MsgT >> subscription, std::shared_ptr< rclcpp::Context > context, std::chrono::duration< Rep, Period > time_to_wait=std::chrono::duration< Rep, Period >(-1))
 Wait for the next incoming message. More...
 
template<class MsgT , class Rep = int64_t, class Period = std::milli>
bool wait_for_message (MsgT &out, rclcpp::Node::SharedPtr node, const std::string &topic, std::chrono::duration< Rep, Period > time_to_wait=std::chrono::duration< Rep, Period >(-1), const rclcpp::QoS &qos=rclcpp::SystemDefaultsQoS())
 Wait for the next incoming message. More...
 
rclcpp::GenericService::SharedPtr create_generic_service (std::shared_ptr< node_interfaces::NodeBaseInterface > node_base, std::shared_ptr< node_interfaces::NodeGraphInterface > node_graph, std::shared_ptr< node_interfaces::NodeServicesInterface > node_services, const std::string &service_name, const std::string &service_type, GenericServiceCallback any_callback, const rclcpp::QoS &qos, rclcpp::CallbackGroup::SharedPtr group)
 
void bounds_check_duration_sum (int64_t lhsns, int64_t rhsns, uint64_t max)
 
void bounds_check_duration_difference (int64_t lhsns, int64_t rhsns, uint64_t max)
 
void bounds_check_duration_scale (int64_t dns, double scale, uint64_t max)
 
void copy_rcl_message (const rcl_serialized_message_t &from, rcl_serialized_message_t &to)
 
bool ok (Context::SharedPtr context)
 
bool shutdown (Context::SharedPtr context, const std::string &reason)
 
void on_shutdown (std::function< void()> callback, Context::SharedPtr context)
 
bool sleep_for (const std::chrono::nanoseconds &nanoseconds, Context::SharedPtr context)
 

Detailed Description

Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.

Typedef Documentation

◆ StaticWaitSet

template<std::size_t NumberOfSubscriptions, std::size_t NumberOfGuardCondtions, std::size_t NumberOfTimers, std::size_t NumberOfClients, std::size_t NumberOfServices, std::size_t NumberOfWaitables>
using rclcpp::StaticWaitSet = typedef rclcpp::WaitSetTemplate< rclcpp::wait_set_policies::SequentialSynchronization, rclcpp::wait_set_policies::StaticStorage< NumberOfSubscriptions, NumberOfGuardCondtions, NumberOfTimers, NumberOfClients, NumberOfServices, NumberOfWaitables > >

WaitSet configuration which does not allow changes after construction.

This wait set requires that you specify all entities at construction, and prevents you from calling the typical add and remove functions. It also requires that you specify how many of each item there will be as a template argument.

It will share ownership of the entities until destroyed, therefore it will prevent the destruction of entities so long as the wait set exists, even if the user lets their copy of the shared pointer to the entity go out of scope.

Since the wait set cannot be mutated, it does not need to be thread-safe.

See also
rclcpp::WaitSetTemplate for API documentation

Definition at line 73 of file wait_set.hpp.

◆ ThreadSafeWaitSet

Like WaitSet, this configuration is dynamic, but is also thread-safe.

This wait set allows you to add and remove items dynamically, and it will automatically remove items that are let out of scope each time wait() or prune_destroyed_entities() is called.

It will also ensure that adding and removing items explicitly from the wait set is done in a thread-safe way, protecting against concurrent add and deletes, as well as add and deletes during a wait(). This thread-safety comes at some overhead and the use of thread synchronization primitives.

See also
rclcpp::WaitSetTemplate for API documentation

Definition at line 99 of file wait_set.hpp.

◆ WaitSet

Most common user configuration of a WaitSet, which is dynamic but not thread-safe.

This wait set allows you to add and remove items dynamically, and it will automatically remove items that are let out of scope each time wait() or prune_destroyed_entities() is called.

It will not, however, provide thread-safety for adding and removing entities while waiting.

See also
rclcpp::WaitSetTemplate for API documentation

Definition at line 45 of file wait_set.hpp.

Enumeration Type Documentation

◆ DeliveredMessageKind

enum rclcpp::DeliveredMessageKind : uint8_t
strong

The kind of message that the subscription delivers in its callback, used by the executor.

This enum needs to exist because the callback handle is not accessible to the executor's scope.

"Kind" is used since what is being delivered is a category of messages, for example, there are different ROS message types that can be delivered, but they're all ROS messages.

As a concrete example, all of the following callbacks will be considered ROS_MESSAGE for DeliveredMessageKind:

  • void callback(const std_msgs::msg::String &)
  • void callback(const std::string &) // type adaption
  • void callback(std::unique_ptr<std_msgs::msg::String>)

Definition at line 79 of file subscription_base.hpp.

◆ FutureReturnCode

Return codes to be used with spin_until_future_complete.

SUCCESS: The future is complete and can be accessed with "get" without blocking. This does not indicate that the operation succeeded; "get" may still throw an exception. INTERRUPTED: The future is not complete, spinning was interrupted by Ctrl-C or another error. TIMEOUT: Spinning timed out.

Definition at line 33 of file future_return_code.hpp.

◆ IntraProcessBufferType

Used as argument in create_publisher and create_subscriber when intra-process communication is enabled

Enumerator
SharedPtr 

Set the data type used in the intra-process buffer as std::shared_ptr<MessageT>

UniquePtr 

Set the data type used in the intra-process buffer as std::unique_ptr<MessageT>

CallbackDefault 

Set the data type used in the intra-process buffer as the same used in the callback.

Definition at line 23 of file intra_process_buffer_type.hpp.

◆ IntraProcessSetting

Used as argument in create_publisher and create_subscriber.

Enumerator
Enable 

Explicitly enable intraprocess comm at publisher/subscription level.

Disable 

Explicitly disable intraprocess comm at publisher/subscription level.

NodeDefault 

Take intraprocess configuration from the node.

Definition at line 22 of file intra_process_setting.hpp.

◆ SignalHandlerOptions

Option to indicate which signal handlers rclcpp should install.

Enumerator
All 

Install both sigint and sigterm, this is the default behavior.

SigInt 

Install only a sigint handler.

SigTerm 

Install only a sigterm handler.

None 

Do not install any signal handler.

Definition at line 47 of file utilities.hpp.

◆ TopicStatisticsState

Represent the state of topic statistics collector. Used as argument in create_subscriber.

Enumerator
Enable 

Explicitly enable topic statistics at subscription level.

Disable 

Explicitly disable topic statistics at subscription level.

NodeDefault 

Take topic statistics state from the node.

Definition at line 23 of file topic_statistics_state.hpp.

Function Documentation

◆ add_will_overflow()

template<typename T >
bool rclcpp::add_will_overflow ( const T  x,
const T  y 
)

Safely check if addition will overflow.

The type of the operands, T, should have defined std::numeric_limits<T>::max(), >, < and - operators.

Parameters
[in]xis the first addend.
[in]yis the second addend.
Template Parameters
Tis type of the operands.
Returns
True if the x + y sum is greater than T::max value.

Definition at line 248 of file utilities.hpp.

Referenced by operator+(), rclcpp::Time::operator+(), and rclcpp::Time::operator+=().

Here is the caller graph for this function:

◆ add_will_underflow()

template<typename T >
bool rclcpp::add_will_underflow ( const T  x,
const T  y 
)

Safely check if addition will underflow.

The type of the operands, T, should have defined std::numeric_limits<T>::min(), >, < and - operators.

Parameters
[in]xis the first addend.
[in]yis the second addend.
Template Parameters
Tis type of the operands.
Returns
True if the x + y sum is less than T::min value.

Definition at line 265 of file utilities.hpp.

Referenced by operator+(), rclcpp::Time::operator+(), and rclcpp::Time::operator+=().

Here is the caller graph for this function:

◆ convert_rcl_time_to_sec_nanos()

builtin_interfaces::msg::Time rclcpp::convert_rcl_time_to_sec_nanos ( const rcl_time_point_value_t time_point)

Convert rcl_time_point_value_t to builtin_interfaces::msg::Time.

Parameters
[in]time_pointis a rcl_time_point_value_t
Returns
the builtin_interfaces::msg::Time from the time_point

Definition at line 288 of file time.cpp.

References RCL_S_TO_NS.

Referenced by rclcpp::Time::operator builtin_interfaces::msg::Time().

Here is the caller graph for this function:

◆ copy_all_parameter_values()

template<typename NodeT1 , typename NodeT2 >
void rclcpp::copy_all_parameter_values ( const NodeT1 &  source,
const NodeT2 &  destination,
const bool  override_existing_params = false 
)

Copy all parameters from one source node to another destination node. May throw exceptions if parameters from source are uninitialized or undeclared.

Parameters
sourceNode to copy parameters from
destinationNode to copy parameters to
override_existing_paramsDefault false. Whether to override existing destination params if both the source and destination contain the same parameter.

Definition at line 42 of file copy_all_parameter_values.hpp.

◆ create_client()

template<typename ServiceT >
rclcpp::Client<ServiceT>::SharedPtr rclcpp::create_client ( std::shared_ptr< node_interfaces::NodeBaseInterface node_base,
std::shared_ptr< node_interfaces::NodeGraphInterface node_graph,
std::shared_ptr< node_interfaces::NodeServicesInterface node_services,
const std::string &  service_name,
const rclcpp::QoS qos = rclcpp::ServicesQoS(),
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)

Create a service client with a given type.

Parameters
[in]node_baseNodeBaseInterface implementation of the node on which to create the client.
[in]node_graphNodeGraphInterface implementation of the node on which to create the client.
[in]node_servicesNodeServicesInterface implementation of the node on which to create the client.
[in]service_nameThe name on which the service is accessible.
[in]qosQuality of service profile for client.
[in]groupCallback group to handle the reply to service calls.
Returns
Shared pointer to the created client.

Definition at line 43 of file create_client.hpp.

References rcl_client_options_s::qos, and rcl_client_get_default_options().

Here is the call graph for this function:

◆ create_generic_client() [1/2]

template<typename NodeT >
rclcpp::GenericClient::SharedPtr rclcpp::create_generic_client ( NodeT  node,
const std::string &  service_name,
const std::string &  service_type,
const rclcpp::QoS qos = rclcpp::ServicesQoS(),
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)

Create a generic service client with a name of given type.

The NodeT type needs to have NodeBaseInterface implementation, NodeGraphInterface implementation and NodeServicesInterface implementation of the node which to create the client.

Parameters
[in]nodeThe node on which to create the client.
[in]service_nameThe name on which the service is accessible.
[in]service_typeThe name of service type, e.g. "test_msgs/srv/BasicTypes"
[in]qosQuality of service profile for client.
[in]groupCallback group to handle the reply to service calls.
Returns
Shared pointer to the created client.

Definition at line 71 of file create_generic_client.hpp.

References create_generic_client().

Here is the call graph for this function:

◆ create_generic_client() [2/2]

rclcpp::GenericClient::SharedPtr rclcpp::create_generic_client ( std::shared_ptr< node_interfaces::NodeBaseInterface node_base,
std::shared_ptr< node_interfaces::NodeGraphInterface node_graph,
std::shared_ptr< node_interfaces::NodeServicesInterface node_services,
const std::string &  service_name,
const std::string &  service_type,
const rclcpp::QoS qos = rclcpp::ServicesQoS(),
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)

Create a generic service client with a name of given type.

Parameters
[in]node_baseNodeBaseInterface implementation of the node on which to create the client.
[in]node_graphNodeGraphInterface implementation of the node on which to create the client.
[in]node_servicesNodeServicesInterface implementation of the node on which to create the client.
[in]service_nameThe name on which the service is accessible.
[in]service_typeThe name of service type, e.g. "test_msgs/srv/BasicTypes"
[in]qosQuality of service profile for client.
[in]groupCallback group to handle the reply to service calls.
Returns
Shared pointer to the created client.

Definition at line 21 of file create_generic_client.cpp.

References rclcpp::QoS::get_rmw_qos_profile(), rcl_client_options_s::qos, and rcl_client_get_default_options().

Referenced by rclcpp::Node::create_generic_client(), and create_generic_client().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_generic_publisher()

template<typename AllocatorT = std::allocator<void>>
std::shared_ptr<GenericPublisher> rclcpp::create_generic_publisher ( rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr  topics_interface,
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.

The returned pointer will never be empty, but this function can throw various exceptions, for instance when the message's package can not be found on the AMENT_PREFIX_PATH.

Parameters
topics_interfaceNodeTopicsInterface pointer used in parts of the setup
topic_nameTopic name
topic_typeTopic type
qosQoS settings
optionsPublisher options. Not all publisher options are currently respected, the only relevant options for this publisher are event_callbacks, use_default_callbacks, and callback_group.

Definition at line 45 of file create_generic_publisher.hpp.

References get_typesupport_library().

Referenced by rclcpp::Node::create_generic_publisher().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_generic_service() [1/2]

template<typename NodeT , typename CallbackT >
rclcpp::GenericService::SharedPtr rclcpp::create_generic_service ( NodeT  node,
const std::string &  service_name,
const std::string &  service_type,
CallbackT &&  callback,
const rclcpp::QoS qos,
rclcpp::CallbackGroup::SharedPtr  group 
)

Create a generic service with a given type.

The NodeT type needs to have NodeBaseInterface implementation and NodeServicesInterface implementation of the node which to create the generic service.

Parameters
[in]nodeThe node on which to create the generic service.
[in]service_nameThe name on which the service is accessible.
[in]service_typeThe name of service type, e.g. "std_srvs/srv/SetBool".
[in]callbackThe callback to call when the service gets a request.
[in]qosQuality of service profile for the service.
[in]groupCallback group to handle the reply to service calls.
Returns
Shared pointer to the created service.

Definition at line 85 of file create_generic_service.hpp.

References rclcpp::QoS::get_rmw_qos_profile().

Here is the call graph for this function:

◆ create_generic_service() [2/2]

template<typename CallbackT >
rclcpp::GenericService::SharedPtr rclcpp::create_generic_service ( std::shared_ptr< node_interfaces::NodeBaseInterface node_base,
std::shared_ptr< node_interfaces::NodeServicesInterface node_services,
const std::string &  service_name,
const std::string &  service_type,
CallbackT &&  callback,
const rclcpp::QoS qos,
rclcpp::CallbackGroup::SharedPtr  group 
)

Create a generic service with a given type.

Parameters
[in]node_baseNodeBaseInterface implementation of the node on which to create the generic service.
[in]node_servicesNodeServicesInterface implementation of the node on which to create the service.
[in]service_nameThe name on which the service is accessible.
[in]service_typeThe name of service type, e.g. "std_srvs/srv/SetBool".
[in]callbackThe callback to call when the service gets a request.
[in]qosQuality of service profile for the service.
[in]groupCallback group to handle the reply to service calls.
Returns
Shared pointer to the created service.

Definition at line 47 of file create_generic_service.hpp.

References rclcpp::QoS::get_rmw_qos_profile(), rcl_service_options_s::qos, and rcl_service_get_default_options().

Here is the call graph for this function:

◆ create_generic_subscription()

template<typename CallbackT , typename AllocatorT = std::allocator<void>>
std::shared_ptr<GenericSubscription> rclcpp::create_generic_subscription ( rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr  topics_interface,
const std::string &  topic_name,
const std::string &  topic_type,
const rclcpp::QoS qos,
CallbackT &&  callback,
const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &  options = (    rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>()  ) 
)

Create and return a GenericSubscription.

The returned pointer will never be empty, but this function can throw various exceptions, for instance when the message's package can not be found on the AMENT_PREFIX_PATH.

Parameters
topics_interfaceNodeTopicsInterface pointer used in parts of the setup.
topic_nameTopic name
topic_typeTopic type
qosQoS settings
callbackCallback for new messages of serialized form
optionsPublisher options. Not all publisher options are currently respected, the only relevant options for this publisher are event_callbacks, use_default_callbacks, and callback_group.

Definition at line 51 of file create_generic_subscription.hpp.

References get_typesupport_library(), and rclcpp::AnySubscriptionCallback< MessageT, AllocatorT >::set().

Referenced by rclcpp::Node::create_generic_subscription().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_publisher()

template<typename MessageT , typename AllocatorT = std::allocator<void>, typename PublisherT = rclcpp::Publisher<MessageT, AllocatorT>, typename NodeT >
std::shared_ptr<PublisherT> rclcpp::create_publisher ( NodeT &&  node,
const std::string &  topic_name,
const rclcpp::QoS qos,
const rclcpp::PublisherOptionsWithAllocator< AllocatorT > &  options = (    rclcpp::PublisherOptionsWithAllocator<AllocatorT>()  ) 
)

Create and return a publisher of the given MessageT type.

The NodeT type only needs to have a method called get_node_topics_interface() which returns a shared_ptr to a NodeTopicsInterface.

In case options.qos_overriding_options is enabling qos parameter overrides, NodeT must also have a method called get_node_parameters_interface() which returns a shared_ptr to a NodeParametersInterface.

Definition at line 94 of file create_publisher.hpp.

◆ create_service() [1/2]

template<typename ServiceT , typename CallbackT >
rclcpp::Service<ServiceT>::SharedPtr rclcpp::create_service ( std::shared_ptr< node_interfaces::NodeBaseInterface node_base,
std::shared_ptr< node_interfaces::NodeServicesInterface node_services,
const std::string &  service_name,
CallbackT &&  callback,
const rclcpp::QoS qos,
rclcpp::CallbackGroup::SharedPtr  group 
)

Create a service with a given type.

Parameters
[in]node_baseNodeBaseInterface implementation of the node on which to create the service.
[in]node_servicesNodeServicesInterface implementation of the node on which to create the service.
[in]service_nameThe name on which the service is accessible.
[in]callbackThe callback to call when the service gets a request.
[in]qosQuality of service profile for the service.
[in]groupCallback group to handle the reply to service calls.
Returns
Shared pointer to the created service.

Definition at line 43 of file create_service.hpp.

References rclcpp::QoS::get_rmw_qos_profile().

Here is the call graph for this function:

◆ create_service() [2/2]

template<typename ServiceT , typename CallbackT >
rclcpp::Service<ServiceT>::SharedPtr rclcpp::create_service ( std::shared_ptr< node_interfaces::NodeBaseInterface node_base,
std::shared_ptr< node_interfaces::NodeServicesInterface node_services,
const std::string &  service_name,
CallbackT &&  callback,
const rmw_qos_profile_t &  qos_profile,
rclcpp::CallbackGroup::SharedPtr  group 
)

Create a service with a given type.

Definition at line 60 of file create_service.hpp.

References rcl_service_options_s::qos, and rcl_service_get_default_options().

Here is the call graph for this function:

◆ create_subscription() [1/2]

template<typename MessageT , typename CallbackT , typename AllocatorT = std::allocator<void>, typename SubscriptionT = rclcpp::Subscription<MessageT, AllocatorT>, typename MessageMemoryStrategyT = typename SubscriptionT::MessageMemoryStrategyType, typename NodeT >
std::shared_ptr<SubscriptionT> rclcpp::create_subscription ( NodeT &  node,
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 of the given MessageT type.

The NodeT type only needs to have a method called get_node_topics_interface() which returns a shared_ptr to a NodeTopicsInterface, or be a NodeTopicsInterface pointer itself.

In case options.qos_overriding_options is enabling qos parameter overrides, NodeT must also have a method called get_node_parameters_interface() which returns a shared_ptr to a NodeParametersInterface.

Template Parameters
MessageT
CallbackT
AllocatorT
SubscriptionT
MessageMemoryStrategyT
NodeT
Parameters
node
topic_name
qos
callback
options
msg_mem_strat
Returns
the created subscription
Exceptions
std::invalid_argumentif topic statistics is enabled and the publish period is less than or equal to zero.

Definition at line 176 of file create_subscription.hpp.

◆ create_subscription() [2/2]

template<typename MessageT , typename CallbackT , typename AllocatorT = std::allocator<void>, typename SubscriptionT = rclcpp::Subscription<MessageT, AllocatorT>, typename MessageMemoryStrategyT = typename SubscriptionT::MessageMemoryStrategyType>
std::shared_ptr<SubscriptionT> rclcpp::create_subscription ( rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &  node_parameters,
rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr &  node_topics,
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 of the given MessageT type.

See create_subscription().

Definition at line 205 of file create_subscription.hpp.

◆ create_subscription_factory()

template<typename MessageT , typename CallbackT , typename AllocatorT , typename SubscriptionT = rclcpp::Subscription<MessageT, AllocatorT>, typename MessageMemoryStrategyT = typename SubscriptionT::MessageMemoryStrategyType>
SubscriptionFactory rclcpp::create_subscription_factory ( CallbackT &&  callback,
const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &  options,
typename MessageMemoryStrategyT::SharedPtr  msg_mem_strat,
std::shared_ptr< rclcpp::topic_statistics::SubscriptionTopicStatistics subscription_topic_stats = nullptr 
)

Return a SubscriptionFactory setup to create a SubscriptionT<MessageT, AllocatorT>.

Parameters
[in]callbackThe user-defined callback function to receive a message
[in]optionsAdditional options for the creation of the Subscription.
[in]msg_mem_stratThe message memory strategy to use for allocating messages.
[in]subscription_topic_statsOptional stats callback for topic_statistics

Definition at line 81 of file subscription_factory.hpp.

References rclcpp::AnySubscriptionCallback< MessageT, AllocatorT >::set().

Here is the call graph for this function:

◆ create_timer() [1/2]

template<typename DurationRepT , typename DurationT , typename CallbackT >
rclcpp::GenericTimer<CallbackT>::SharedPtr rclcpp::create_timer ( rclcpp::Clock::SharedPtr  clock,
std::chrono::duration< DurationRepT, DurationT >  period,
CallbackT  callback,
rclcpp::CallbackGroup::SharedPtr  group,
node_interfaces::NodeBaseInterface node_base,
node_interfaces::NodeTimersInterface node_timers,
bool  autostart = true 
)

Convenience method to create a general timer with node resources.

Template Parameters
DurationRepT
DurationT
CallbackT
Parameters
clockclock to be used
periodperiod to execute callback. This duration must be 0 <= period < nanoseconds::max()
callbackcallback to execute via the timer period
groupcallback group
node_basenode base interface
node_timersnode timer interface
autostartdefines if the timer should start it's countdown on initialization or not.
Returns
shared pointer to a generic timer
Exceptions
std::invalid_argumentif either clock, node_base or node_timers are nullptr, or period is negative or too large

Definition at line 146 of file create_timer.hpp.

References rclcpp::node_interfaces::NodeTimersInterface::add_timer(), and rclcpp::node_interfaces::NodeBaseInterface::get_context().

Here is the call graph for this function:

◆ create_timer() [2/2]

template<typename CallbackT >
rclcpp::TimerBase::SharedPtr rclcpp::create_timer ( std::shared_ptr< node_interfaces::NodeBaseInterface node_base,
std::shared_ptr< node_interfaces::NodeTimersInterface node_timers,
rclcpp::Clock::SharedPtr  clock,
rclcpp::Duration  period,
CallbackT &&  callback,
rclcpp::CallbackGroup::SharedPtr  group = nullptr,
bool  autostart = true 
)

Create a timer with a given clock

Definition at line 87 of file create_timer.hpp.

References rclcpp::Duration::to_chrono().

Referenced by create_timer(), and rclcpp::Node::create_timer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_wall_timer()

template<typename DurationRepT , typename DurationT , typename CallbackT >
rclcpp::WallTimer<CallbackT>::SharedPtr rclcpp::create_wall_timer ( std::chrono::duration< DurationRepT, DurationT >  period,
CallbackT  callback,
rclcpp::CallbackGroup::SharedPtr  group,
node_interfaces::NodeBaseInterface node_base,
node_interfaces::NodeTimersInterface node_timers,
bool  autostart = true 
)

Convenience method to create a wall timer with node resources.

Template Parameters
DurationRepT
DurationT
CallbackT
Parameters
periodperiod to execute callback. This duration must be 0 <= period < nanoseconds::max()
callbackcallback to execute via the timer period
groupcallback group
node_basenode base interface
node_timersnode timer interface
Returns
shared pointer to a wall timer
Exceptions
std::invalid_argumentif either node_base or node_timers are null, or period is negative or too large

Definition at line 191 of file create_timer.hpp.

References rclcpp::node_interfaces::NodeTimersInterface::add_timer(), and rclcpp::node_interfaces::NodeBaseInterface::get_context().

Referenced by rclcpp::Node::create_wall_timer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ expand_topic_or_service_name()

std::string rclcpp::expand_topic_or_service_name ( const std::string &  name,
const std::string &  node_name,
const std::string &  namespace_,
bool  is_service = false 
)

Expand a topic or service name and throw if it is not valid.

This function can be used to "just" validate a topic or service name too, since expanding the topic name is required to fully validate a name.

If the name is invalid, then InvalidTopicNameError is thrown or InvalidServiceNameError if is_service is true.

This function can take any form of a topic or service name, i.e. it does not have to be a fully qualified name. The node name and namespace are used to expand it if necessary while validating it.

Expansion is done with rcl_expand_topic_name. The validation is doen with rcl_validate_topic_name and rmw_validate_full_topic_name, so details about failures can be found in the documentation for those functions.

Parameters
namethe topic or service name to be validated
node_namethe name of the node associated with the name
namespace_the namespace of the node associated with the name
is_serviceif true InvalidServiceNameError is thrown instead
Returns
expanded (and validated) topic name
Exceptions
InvalidTopicNameErrorif name is invalid and is_service is false
InvalidServiceNameErrorif name is invalid and is_service is true
std::bad_allocif memory cannot be allocated
RCLErrorif an unexpect error occurs
std::runtime_errorif the topic name is unexpectedly valid or, if the rcl name is invalid or if the rcl namespace is invalid

Definition at line 32 of file expand_topic_or_service_name.cpp.

References rcl_expand_topic_name(), rcl_get_default_allocator, rcl_get_default_topic_name_substitutions(), RCL_RET_BAD_ALLOC, RCL_RET_ERROR, RCL_RET_INVALID_ARGUMENT, RCL_RET_NODE_INVALID_NAME, RCL_RET_NODE_INVALID_NAMESPACE, RCL_RET_OK, RCL_RET_TOPIC_NAME_INVALID, RCL_RET_UNKNOWN_SUBSTITUTION, RCL_TOPIC_NAME_VALID, rcl_topic_name_validation_result_string(), and rcl_validate_topic_name().

Referenced by rclcpp::Client< ServiceT >::Client(), rclcpp::node_interfaces::NodeGraph::count_clients(), rclcpp::node_interfaces::NodeGraph::count_publishers(), rclcpp::node_interfaces::NodeGraph::count_services(), rclcpp::node_interfaces::NodeGraph::count_subscribers(), rclcpp::GenericService::GenericService(), rclcpp::PublisherBase::PublisherBase(), rclcpp::Service< ServiceT >::Service(), and rclcpp::SubscriptionBase::SubscriptionBase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_type_identifier()

std::tuple< std::string, std::string, std::string > rclcpp::extract_type_identifier ( const std::string &  full_type)

Extract the package name, middle module, and type name from a full type string.

This function takes a full type string (e.g., "std_msgs/msg/String") and extracts the package name, middle module (if any), and type name. The middle module is the part between the package name and the type name, which is typically used for message types. For example, for "std_msgs/msg/String", it returns ("std_msgs", "msg", "String").

Parameters
[in]full_type
Exceptions
std::runtime_errorif the input full type string is malformed or does not follow the expected format.
Returns
A tuple containing the package name, middle module (if any), and type name.

Definition at line 79 of file typesupport_helpers.cpp.

Referenced by get_typesupport_library().

Here is the caller graph for this function:

◆ get_action_typesupport_handle()

const rosidl_action_type_support_t * rclcpp::get_action_typesupport_handle ( const std::string &  type,
const std::string &  typesupport_identifier,
rcpputils::SharedLibrary &  library 
)

Extracts the action type support handle from the library.

Note
The library needs to match the action type. The shared library must stay loaded for the lifetime of the result.
Parameters
[in]typeThe action type, e.g. "example_interfaces/action/Fibonacci"
[in]typesupport_identifierType support identifier, typically "rosidl_typesupport_cpp"
[in]libraryThe shared type support library
Exceptions
std::runtime_errorif the symbol of type not found in the library.
Returns
A action type support handle

Definition at line 171 of file typesupport_helpers.cpp.

◆ get_c_string() [1/2]

const char * rclcpp::get_c_string ( const char *  string_in)

Return the given string.

This function is overloaded to transform any string to C-style string.

Parameters
[in]string_inis the string to be returned
Returns
the given string

Definition at line 206 of file utilities.cpp.

Referenced by rclcpp::SubscriptionBase::set_content_filter(), and rclcpp::SubscriptionOptionsWithAllocator< Allocator >::to_rcl_subscription_options().

Here is the caller graph for this function:

◆ get_c_string() [2/2]

const char * rclcpp::get_c_string ( const std::string &  string_in)

Return the C string from the given std::string.

Parameters
[in]string_inis a std::string
Returns
the C string from the std::string

Definition at line 212 of file utilities.cpp.

◆ get_c_vector_string()

std::vector< const char * > rclcpp::get_c_vector_string ( const std::vector< std::string > &  strings_in)

Return the std::vector of C string from the given std::vector<std::string>.

Parameters
[in]strings_inis a std::vector of std::string
Returns
the std::vector of C string from the std::vector<std::string>

Definition at line 218 of file utilities.cpp.

Referenced by rclcpp::SubscriptionBase::set_content_filter(), and rclcpp::SubscriptionOptionsWithAllocator< Allocator >::to_rcl_subscription_options().

Here is the caller graph for this function:

◆ get_contexts()

std::vector< Context::SharedPtr > rclcpp::get_contexts ( )

Return a copy of the list of context shared pointers.

This function is thread-safe.

Definition at line 535 of file context.cpp.

◆ get_current_signal_handler_options()

SignalHandlerOptions rclcpp::get_current_signal_handler_options ( )

Get the current signal handler options.

If no signal handler is installed, SignalHandlerOptions::None is returned.

Definition at line 59 of file utilities.cpp.

References rclcpp::SignalHandler::get_current_signal_handler_options(), and rclcpp::SignalHandler::get_global_signal_handler().

Here is the call graph for this function:

◆ get_log_directory()

std::filesystem::path rclcpp::get_log_directory ( )

Get the current logging directory.

For more details of how the logging directory is determined, see rcl_logging_get_logging_directory().

Returns
the logging directory being used.
Exceptions
rclcpp::exceptions::RCLErrorif an unexpected error occurs.

Definition at line 59 of file logger.cpp.

◆ get_logger()

Logger rclcpp::get_logger ( const std::string &  name)

Return a named logger.

The returned logger's name will include any naming conventions, such as a name prefix. Currently there are no such naming conventions but they may be introduced in the future.

Parameters
[in]namethe name of the logger
Returns
a logger with the fully-qualified name including naming conventions, or
a dummy logger if logging is disabled.

Definition at line 34 of file logger.cpp.

Referenced by rclcpp::SubscriptionBase::clear_on_new_intra_process_message_callback(), rclcpp::PublisherBase::clear_on_new_qos_event_callback(), rclcpp::SubscriptionBase::clear_on_new_qos_event_callback(), rclcpp::experimental::IntraProcessManager::do_intra_process_publish(), rclcpp::node_interfaces::NodeGraph::get_client_names_and_types_by_node(), rclcpp::SubscriptionBase::get_content_filter(), get_node_logger(), rclcpp::node_interfaces::NodeGraph::get_publisher_names_and_types_by_node(), rclcpp::node_interfaces::NodeGraph::get_subscriber_names_and_types_by_node(), rclcpp::experimental::IntraProcessManager::get_subscription_count(), rclcpp::Context::init(), rclcpp::QoS::keep_last(), rclcpp::LoanedMessage< MessageT, AllocatorT >::LoanedMessage(), rclcpp::experimental::IntraProcessManager::lowest_available_capacity(), rclcpp::PublisherBase::lowest_available_ipm_capacity(), rclcpp::executors::MultiThreadedExecutor::MultiThreadedExecutor(), rclcpp::SerializedMessage::operator=(), rclcpp::QoSInitialization::QoSInitialization(), rclcpp::SubscriptionBase::set_content_filter(), rclcpp::SubscriptionBase::set_on_new_intra_process_message_callback(), rclcpp::PublisherBase::set_on_new_qos_event_callback(), rclcpp::SubscriptionBase::set_on_new_qos_event_callback(), rclcpp::EventHandlerBase::set_on_ready_callback(), rclcpp::experimental::SubscriptionIntraProcessBase::set_on_ready_callback(), rclcpp::TimerBase::set_on_reset_callback(), rclcpp::graph_listener::GraphListener::shutdown(), rclcpp::LoanedMessage< MessageT, AllocatorT >::~LoanedMessage(), rclcpp::SerializedMessage::~SerializedMessage(), and rclcpp::SubscriptionBase::~SubscriptionBase().

Here is the caller graph for this function:

◆ get_message_typesupport_handle()

const rosidl_message_type_support_t * rclcpp::get_message_typesupport_handle ( const std::string &  type,
const std::string &  typesupport_identifier,
rcpputils::SharedLibrary &  library 
)

Extracts the message type support handle from the library.

Note
The library needs to match the topic type. The shared library must stay loaded for the lifetime of the result.
Parameters
[in]typeThe topic type, e.g. "std_msgs/msg/String"
[in]typesupport_identifierType support identifier, typically "rosidl_typesupport_cpp"
[in]libraryThe shared type support library
Exceptions
std::runtime_errorif the symbol of type not found in the library.
Returns
A message type support handle

Definition at line 141 of file typesupport_helpers.cpp.

Referenced by rclcpp::GenericService::GenericService().

Here is the caller graph for this function:

◆ get_node_logger()

Logger rclcpp::get_node_logger ( const rcl_node_t node)

Return a named logger using an rcl_node_t.

This is a convenience function that does error checking and returns the node logger name, or "rclcpp" if it is unable to get the node name.

Parameters
[in]nodethe rcl node from which to get the logger name
Returns
a logger based on the node name, or "rclcpp" if there's an error

Definition at line 45 of file logger.cpp.

References get_logger(), and rcl_node_get_logger_name().

Referenced by rclcpp::GenericService::GenericService(), rclcpp::PublisherBase::PublisherBase(), and rclcpp::SubscriptionBase::SubscriptionBase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_service_typesupport_handle()

const rosidl_service_type_support_t * rclcpp::get_service_typesupport_handle ( const std::string &  type,
const std::string &  typesupport_identifier,
rcpputils::SharedLibrary &  library 
)

Extracts the service type support handle from the library.

Note
The library needs to match the service type. The shared library must stay loaded for the lifetime of the result.
Parameters
[in]typeThe service type, e.g. "std_srvs/srv/Empty"
[in]typesupport_identifierType support identifier, typically "rosidl_typesupport_cpp"
[in]libraryThe shared type support library
Exceptions
std::runtime_errorif the symbol of type not found in the library.
Returns
A service type support handle

Definition at line 156 of file typesupport_helpers.cpp.

Referenced by rclcpp::GenericService::GenericService().

Here is the caller graph for this function:

◆ get_typesupport_library()

std::shared_ptr< rcpputils::SharedLibrary > rclcpp::get_typesupport_library ( const std::string &  type,
const std::string &  typesupport_identifier 
)

Load the type support library for the given type.

Parameters
[in]typeThe topic type, e.g. "std_msgs/msg/String"
[in]typesupport_identifierType support identifier, typically "rosidl_typesupport_cpp"
Exceptions
std::runtime_errorif the library is not found or cannot be loaded.
Returns
A shared library

Definition at line 134 of file typesupport_helpers.cpp.

References extract_type_identifier(), and get_typesupport_library_path().

Referenced by create_generic_publisher(), create_generic_subscription(), and rclcpp::GenericService::GenericService().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_typesupport_library_path()

std::string rclcpp::get_typesupport_library_path ( const std::string &  package_name,
const std::string &  typesupport_identifier 
)

Look for the library in the ament prefix paths and return the path to the type support library.

Parameters
[in]package_nameThe name of the package containing the type support library, e.g. "std_msgs".
[in]typesupport_identifierType support identifier, typically "rosidl_typesupport_cpp"
Exceptions
std::runtime_errorif the library is not found.
Returns
The path to the type support library.

Definition at line 103 of file typesupport_helpers.cpp.

Referenced by get_typesupport_library().

Here is the caller graph for this function:

◆ init()

void rclcpp::init ( int  argc,
char const *const *  argv,
const InitOptions init_options = InitOptions(),
SignalHandlerOptions  signal_handler_options = SignalHandlerOptions::All 
)

Initialize communications via the rmw implementation and set up a global signal handler.

Initializes the global context which is accessible via the function rclcpp::contexts::get_global_default_context(). Also, installs the global signal handlers with the function rclcpp::install_signal_handlers().

See also
rclcpp::Context::init() for more details on arguments and possible exceptions
Parameters
[in]argcnumber of command-line arguments to parse.
[in]argvarray of command-line arguments to parse.
[in]init_optionsinitialization options to apply.
[in]signal_handler_optionsoption to indicate which signal handlers should be installed.

Definition at line 34 of file utilities.cpp.

References install_signal_handlers().

Referenced by init_and_remove_ros_arguments().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_and_remove_ros_arguments()

std::vector< std::string > rclcpp::init_and_remove_ros_arguments ( int  argc,
char const *const *  argv,
const InitOptions init_options = InitOptions() 
)

Initialize communications via the rmw implementation and set up a global signal handler.

Additionally removes ROS-specific arguments from the argument vector.

See also
rclcpp::Context::init() for more details on arguments and possible exceptions
Returns
Members of the argument vector that are not ROS arguments.
Exceptions
anythingremove_ros_arguments can throw

Definition at line 113 of file utilities.cpp.

References init(), and rcl_get_default_allocator.

Here is the call graph for this function:

◆ install_signal_handlers()

bool rclcpp::install_signal_handlers ( SignalHandlerOptions  signal_handler_options = SignalHandlerOptions::All)

Install the global signal handler for rclcpp.

This function should only need to be run one time per process. It is implicitly run by rclcpp::init(), and therefore this function does not need to be run manually if rclcpp::init() has already been run.

The signal handler will shutdown all initialized context. It will also interrupt any blocking functions in ROS allowing them react to any changes in the state of the system (like shutdown).

This function is thread-safe.

Parameters
[in]signal_handler_optionsoption to indicate which signal handlers should be installed.
Returns
true if signal handler was installed by this function, false if already installed.

Definition at line 47 of file utilities.cpp.

References rclcpp::SignalHandler::get_global_signal_handler(), and rclcpp::SignalHandler::install().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ok()

RCLCPP_PUBLIC bool rclcpp::ok ( rclcpp::Context::SharedPtr  context = nullptr)

Check rclcpp's status.

This may return false for a context which has been shutdown, or for a context that was shutdown due to SIGINT being received by the rclcpp signal handler.

If nullptr is given for the context, then the global context is used, i.e. the context initialized by rclcpp::init().

Parameters
[in]contextOptional check for shutdown of this Context.
Returns
false if shutdown has been called, true otherwise

Referenced by rclcpp::executors::SingleThreadedExecutor::spin(), rclcpp::experimental::executors::EventsExecutor::spin(), rclcpp::Executor::spin_some_impl(), rclcpp::experimental::executors::EventsExecutor::spin_some_impl(), and rclcpp::node_interfaces::NodeGraph::wait_for_graph_change().

Here is the caller graph for this function:

◆ on_shutdown()

RCLCPP_PUBLIC void rclcpp::on_shutdown ( std::function< void()>  callback,
rclcpp::Context::SharedPtr  context = nullptr 
)

Register a function to be called when shutdown is called on the context.

If nullptr is given for the context, then the global context is used, i.e. the context initialized by rclcpp::init().

These callbacks are called when the associated Context is shutdown with the Context::shutdown() method. When shutdown by the SIGINT handler, shutdown, and therefore these callbacks, is called asynchronously from the dedicated signal handling thread, at some point after the SIGINT signal is received.

See also
rclcpp::Context::on_shutdown()
Parameters
[in]callbackto be called when the given context is shutdown
[in]contextwith which to associate the context

◆ operator+()

Time rclcpp::operator+ ( const rclcpp::Duration lhs,
const rclcpp::Time rhs 
)
Exceptions
std::overflow_errorif addition leads to overflow

Definition at line 234 of file time.cpp.

References add_will_overflow(), add_will_underflow(), rclcpp::Time::get_clock_type(), rclcpp::Duration::nanoseconds(), and rclcpp::Time::nanoseconds().

Here is the call graph for this function:

◆ parameter_map_from()

ParameterMap rclcpp::parameter_map_from ( const rcl_params_t *const  c_params,
const char *  node_fqn = nullptr 
)

Convert parameters from rcl_yaml_param_parser into C++ class instances.

Parameters
[in]c_paramsC structures containing parameters for multiple nodes.
[in]node_fqna Fully Qualified Name of node, default value is nullptr. If it's not nullptr, return the relative node parameters belonging to this node_fqn.
Returns
a map where the keys are fully qualified node names and values a list of parameters.
Exceptions
InvalidParametersExceptionif the rcl_params_t is inconsistent or invalid.

make sure there is a leading slash on the fully qualified node name

Definition at line 36 of file parameter_map.cpp.

References parameter_value_from().

Referenced by parameter_map_from_yaml_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parameter_map_from_yaml_file()

ParameterMap rclcpp::parameter_map_from_yaml_file ( const std::string &  yaml_filename,
const char *  node_fqn = nullptr 
)

Get the ParameterMap from a yaml file.

Parameters
[in]yaml_filenamefull name of the yaml file.
[in]node_fqna Fully Qualified Name of node, default value is nullptr.
Returns
an instance of a parameter map
Exceptions
fromrcl error of rcl_parse_yaml_file()

Definition at line 159 of file parameter_map.cpp.

References parameter_map_from(), and RCL_RET_ERROR.

Referenced by rclcpp::AsyncParametersClient::load_parameters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parameter_value_from()

ParameterValue rclcpp::parameter_value_from ( const rcl_variant_t *const  c_value)

Convert parameter value from rcl_yaml_param_parser into a C++ class instance.

Parameters
[in]c_valueC structure containing a value of a parameter.
Returns
an instance of a parameter value
Exceptions
InvalidParameterValueExceptionif the rcl_variant_t is inconsistent or invalid.

Definition at line 100 of file parameter_map.cpp.

Referenced by parameter_map_from().

Here is the caller graph for this function:

◆ parameters_from_map()

std::vector< rclcpp::Parameter > rclcpp::parameters_from_map ( const ParameterMap parameter_map,
const char *  node_fqn = nullptr 
)

Get the Parameters from ParameterMap.

Parameters
[in]parameter_mapa parameter map.
[in]node_fqna Fully Qualified Name of node, default value is nullptr.
Returns
a list of a parameter

Definition at line 173 of file parameter_map.cpp.

Referenced by rclcpp::AsyncParametersClient::load_parameters().

Here is the caller graph for this function:

◆ qos_check_compatible()

QoSCheckCompatibleResult rclcpp::qos_check_compatible ( const QoS publisher_qos,
const QoS subscription_qos 
)

Check if two QoS profiles are compatible.

Two QoS profiles are compatible if a publisher and subcription using the QoS policies can communicate with each other.

If any policies have value "system default" or "unknown" then it is possible that compatiblity cannot be determined. In this case, the value QoSCompatility::Warning is set as part of the returned structure.

Example usage:

publisher_qos, subscription_qos);
if (rclcpp::QoSCompatibility::Error != result.compatibility) {
// QoS not compatible ...
// result.reason contains info about the incompatibility
} else if (rclcpp::QoSCompatibility::Warning != result.compatibility) {
// QoS may not be compatible ...
// result.reason contains info about the possible incompatibility
}
RCLCPP_PUBLIC QoSCheckCompatibleResult qos_check_compatible(const QoS &publisher_qos, const QoS &subscription_qos)
Check if two QoS profiles are compatible.
Definition: qos.cpp:351
Result type for checking QoS compatibility.
Definition: qos.hpp:310
QoSCompatibility compatibility
Compatibility result.
Definition: qos.hpp:312
Parameters
[in]publisher_qosThe QoS profile for a publisher.
[in]subscription_qosThe QoS profile for a subscription.
Returns
Struct with compatiblity set to QoSCompatibility::Ok if the QoS profiles are compatible, or
Struct with compatibility set to QoSCompatibility::Warning if there is a chance the QoS profiles are not compatible, or
Struct with compatibility set to QoSCompatibility::Error if the QoS profiles are not compatible.
Exceptions
rclcpp::exceptions::QoSCheckCompatibilityExceptionif an unexpected error occurs.

Definition at line 351 of file qos.cpp.

References rclcpp::QoSCheckCompatibleResult::compatibility, rclcpp::QoS::get_rmw_qos_profile(), and rclcpp::QoSCheckCompatibleResult::reason.

Here is the call graph for this function:

◆ remove_ros_arguments()

std::vector< std::string > rclcpp::remove_ros_arguments ( int  argc,
char const *const *  argv 
)

Remove ROS-specific arguments from argument vector.

Some arguments may not have been intended as ROS arguments. This function populates the arguments in a vector. Since the first argument is always assumed to be a process name, the vector will always contain the process name.

Parameters
[in]argcNumber of arguments.
[in]argvArgument vector.
Returns
Members of the argument vector that are not ROS arguments.
Exceptions
anythingthrow_from_rcl_error can throw
rclcpp::exceptions::RCLErrorif the parsing fails

Definition at line 126 of file utilities.cpp.

References rcl_arguments_fini(), rcl_get_default_allocator, rcl_get_zero_initialized_arguments(), rcl_parse_arguments(), and RCL_RET_OK.

Here is the call graph for this function:

◆ shutdown()

RCLCPP_PUBLIC bool rclcpp::shutdown ( rclcpp::Context::SharedPtr  context = nullptr,
const std::string &  reason = "user called rclcpp::shutdown()" 
)

Shutdown rclcpp context, invalidating it for derived entities.

If nullptr is given for the context, then the global context is used, i.e. the context initialized by rclcpp::init().

If the global context is used, then the signal handlers are also uninstalled.

This will also cause the "on_shutdown" callbacks to be called.

See also
rclcpp::Context::shutdown()
Parameters
[in]contextOptional to be shutdown
[in]reasonOptional string passed to the context shutdown method
Returns
true if shutdown was successful, false if context was already shutdown

◆ sleep_for()

RCLCPP_PUBLIC bool rclcpp::sleep_for ( const std::chrono::nanoseconds &  nanoseconds,
rclcpp::Context::SharedPtr  context = nullptr 
)

Use the global condition variable to block for the specified amount of time.

This function can be interrupted early if the associated context becomes invalid due to shutdown() or the signal handler.

See also
rclcpp::Context::sleep_for

If nullptr is given for the context, then the global context is used, i.e. the context initialized by rclcpp::init().

Parameters
[in]nanosecondsA std::chrono::duration representing how long to sleep for.
[in]contextOptional which may interrupt this sleep
Returns
true if the condition variable did not timeout.

◆ spin()

void rclcpp::spin ( rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr)

Create a default single-threaded executor and spin the specified node.

Parameters
[in]node_ptrShared pointer to the node to spin.

Definition at line 50 of file executors.cpp.

References rclcpp::Executor::add_node(), rclcpp::Executor::remove_node(), and rclcpp::executors::SingleThreadedExecutor::spin().

Here is the call graph for this function:

◆ spin_all()

void rclcpp::spin_all ( rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr,
std::chrono::nanoseconds  max_duration 
)

Create a default single-threaded executor and execute all available work exhaustively.

Parameters
[in]node_ptrShared pointer to the node to spin.

Definition at line 18 of file executors.cpp.

References rclcpp::Executor::spin_node_all().

Here is the call graph for this function:

◆ spin_some()

void rclcpp::spin_some ( rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_ptr)

Create a default single-threaded executor and execute any immediately available work.

Parameters
[in]node_ptrShared pointer to the node to spin.

Definition at line 35 of file executors.cpp.

References rclcpp::Executor::spin_node_some().

Here is the call graph for this function:

◆ sub_will_overflow()

template<typename T >
bool rclcpp::sub_will_overflow ( const T  x,
const T  y 
)

Safely check if subtraction will overflow.

The type of the operands, T, should have defined std::numeric_limits<T>::max(), >, < and + operators.

Parameters
[in]xis the minuend.
[in]yis the subtrahend.
Template Parameters
Tis type of the operands.
Returns
True if the difference x - y sum is grater than T::max value.

Definition at line 282 of file utilities.hpp.

Referenced by rclcpp::Time::operator-(), and rclcpp::Time::operator-=().

Here is the caller graph for this function:

◆ sub_will_underflow()

template<typename T >
bool rclcpp::sub_will_underflow ( const T  x,
const T  y 
)

Safely check if subtraction will underflow.

The type of the operands, T, should have defined std::numeric_limits<T>::min(), >, < and + operators.

Parameters
[in]xis the minuend.
[in]yis the subtrahend.
Template Parameters
Tis type of the operands.
Returns
True if the difference x - y sum is less than T::min value.

Definition at line 299 of file utilities.hpp.

Referenced by rclcpp::Time::operator-(), and rclcpp::Time::operator-=().

Here is the caller graph for this function:

◆ uninstall_signal_handlers()

bool rclcpp::uninstall_signal_handlers ( )

Uninstall the global signal handler for rclcpp.

This function does not necessarily need to be called, but can be used to undo what rclcpp::install_signal_handlers() or rclcpp::init() do with respect to signal handling. If you choose to use it, this function only needs to be run one time. It is implicitly run by rclcpp::shutdown(), and therefore this function does not need to be run manually if rclcpp::shutdown() has already been run.

This function is thread-safe.

Returns
true if signal handler was uninstalled by this function, false if was not installed.

Definition at line 66 of file utilities.cpp.

References rclcpp::SignalHandler::get_global_signal_handler(), and rclcpp::SignalHandler::uninstall().

Here is the call graph for this function:

◆ wait_for_message() [1/2]

template<class MsgT , class Rep = int64_t, class Period = std::milli>
bool rclcpp::wait_for_message ( MsgT &  out,
rclcpp::Node::SharedPtr  node,
const std::string &  topic,
std::chrono::duration< Rep, Period >  time_to_wait = std::chrono::duration<Rep, Period>(-1),
const rclcpp::QoS qos = rclcpp::SystemDefaultsQoS() 
)

Wait for the next incoming message.

Wait for the next incoming message to arrive on a specified topic before the specified timeout.

Parameters
[out]outis the message to be filled when a new message is arriving
[in]nodethe node pointer to initialize the subscription on.
[in]topicthe topic to wait for messages.
[in]time_to_waitparameter specifying the timeout before returning.
[in]qosparameter specifying QoS settings for the subscription.
Returns
true if a message was successfully received, false if message could not be obtained or shutdown was triggered asynchronously on the context.

Definition at line 93 of file wait_for_message.hpp.

◆ wait_for_message() [2/2]

template<class MsgT , class Rep = int64_t, class Period = std::milli>
bool rclcpp::wait_for_message ( MsgT &  out,
std::shared_ptr< rclcpp::Subscription< MsgT >>  subscription,
std::shared_ptr< rclcpp::Context context,
std::chrono::duration< Rep, Period >  time_to_wait = std::chrono::duration<Rep, Period>(-1) 
)

Wait for the next incoming message.

Given an already initialized subscription, wait for the next incoming message to arrive before the specified timeout.

Parameters
[out]outis the message to be filled when a new message is arriving.
[in]subscriptionshared pointer to a previously initialized subscription.
[in]contextshared pointer to a context to watch for SIGINT requests.
[in]time_to_waitparameter specifying the timeout before returning.
Returns
true if a message was successfully received, false if message could not be obtained or shutdown was triggered asynchronously on the context.

Definition at line 44 of file wait_for_message.hpp.

References rclcpp::WaitSetTemplate< SynchronizationPolicy, StoragePolicy >::add_guard_condition(), rclcpp::WaitSetTemplate< SynchronizationPolicy, StoragePolicy >::add_subscription(), rclcpp::WaitSetTemplate< SynchronizationPolicy, StoragePolicy >::get_rcl_wait_set(), rcl_wait_set_s::guard_conditions, rclcpp::WaitSetTemplate< SynchronizationPolicy, StoragePolicy >::remove_subscription(), and rclcpp::WaitSetTemplate< SynchronizationPolicy, StoragePolicy >::wait().

Here is the call graph for this function: