ROS 2 rclcpp + rcl - jazzy  jazzy
ROS 2 C++ Client Library with ROS Client Library
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
rclcpp::AsyncParametersClient Class Reference

Public Member Functions

RCLCPP_PUBLIC AsyncParametersClient (const rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_interface, const rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_interface, const rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_interface, const rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_interface, const std::string &remote_node_name, const rmw_qos_profile_t &qos_profile, rclcpp::CallbackGroup::SharedPtr group=nullptr)
 Create an async parameters client. More...
 
RCLCPP_PUBLIC AsyncParametersClient (const rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_interface, const rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_interface, const rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_interface, const rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_interface, const std::string &remote_node_name="", const rclcpp::QoS &qos_profile=rclcpp::ParametersQoS(), rclcpp::CallbackGroup::SharedPtr group=nullptr)
 Create an async parameters client. More...
 
template<typename NodeT >
 AsyncParametersClient (const std::shared_ptr< NodeT > node, const std::string &remote_node_name, const rmw_qos_profile_t &qos_profile, rclcpp::CallbackGroup::SharedPtr group=nullptr)
 Constructor. More...
 
template<typename NodeT >
 AsyncParametersClient (const std::shared_ptr< NodeT > node, const std::string &remote_node_name="", const rclcpp::QoS &qos_profile=rclcpp::ParametersQoS(), rclcpp::CallbackGroup::SharedPtr group=nullptr)
 
template<typename NodeT >
 AsyncParametersClient (NodeT *node, const std::string &remote_node_name, const rmw_qos_profile_t &qos_profile, rclcpp::CallbackGroup::SharedPtr group=nullptr)
 Constructor. More...
 
template<typename NodeT >
 AsyncParametersClient (NodeT *node, const std::string &remote_node_name="", const rclcpp::QoS &qos_profile=rclcpp::ParametersQoS(), rclcpp::CallbackGroup::SharedPtr group=nullptr)
 
RCLCPP_PUBLIC std::shared_future< std::vector< rclcpp::Parameter > > get_parameters (const std::vector< std::string > &names, std::function< void(std::shared_future< std::vector< rclcpp::Parameter >>) > callback=nullptr)
 
RCLCPP_PUBLIC std::shared_future< std::vector< rcl_interfaces::msg::ParameterDescriptor > > describe_parameters (const std::vector< std::string > &names, std::function< void(std::shared_future< std::vector< rcl_interfaces::msg::ParameterDescriptor >>) > callback=nullptr)
 
RCLCPP_PUBLIC std::shared_future< std::vector< rclcpp::ParameterType > > get_parameter_types (const std::vector< std::string > &names, std::function< void(std::shared_future< std::vector< rclcpp::ParameterType >>) > callback=nullptr)
 
RCLCPP_PUBLIC std::shared_future< std::vector< rcl_interfaces::msg::SetParametersResult > > set_parameters (const std::vector< rclcpp::Parameter > &parameters, std::function< void(std::shared_future< std::vector< rcl_interfaces::msg::SetParametersResult >>) > callback=nullptr)
 
RCLCPP_PUBLIC std::shared_future< rcl_interfaces::msg::SetParametersResult > set_parameters_atomically (const std::vector< rclcpp::Parameter > &parameters, std::function< void(std::shared_future< rcl_interfaces::msg::SetParametersResult >) > callback=nullptr)
 
RCLCPP_PUBLIC std::shared_future< std::vector< rcl_interfaces::msg::SetParametersResult > > delete_parameters (const std::vector< std::string > &parameters_names)
 Delete several parameters at once. More...
 
RCLCPP_PUBLIC std::shared_future< std::vector< rcl_interfaces::msg::SetParametersResult > > load_parameters (const std::string &yaml_filename)
 Load parameters from yaml file. More...
 
RCLCPP_PUBLIC std::shared_future< std::vector< rcl_interfaces::msg::SetParametersResult > > load_parameters (const rclcpp::ParameterMap &parameter_map)
 Load parameters from parameter map. More...
 
RCLCPP_PUBLIC std::shared_future< rcl_interfaces::msg::ListParametersResult > list_parameters (const std::vector< std::string > &prefixes, uint64_t depth, std::function< void(std::shared_future< rcl_interfaces::msg::ListParametersResult >) > callback=nullptr)
 
template<typename CallbackT , typename AllocatorT = std::allocator<void>>
rclcpp::Subscription< rcl_interfaces::msg::ParameterEvent >::SharedPtr on_parameter_event (CallbackT &&callback, const rclcpp::QoS &qos=rclcpp::ParameterEventsQoS(), const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &options=(rclcpp::SubscriptionOptionsWithAllocator< AllocatorT >()))
 
RCLCPP_PUBLIC bool service_is_ready () const
 Return if the parameter services are ready. More...
 
template<typename RepT = int64_t, typename RatioT = std::milli>
bool wait_for_service (std::chrono::duration< RepT, RatioT > timeout=std::chrono::duration< RepT, RatioT >(-1))
 Wait for the services to be ready. More...
 

Static Public Member Functions

template<typename CallbackT , typename NodeT , typename AllocatorT = std::allocator<void>>
static rclcpp::Subscription< rcl_interfaces::msg::ParameterEvent >::SharedPtr on_parameter_event (NodeT &&node, CallbackT &&callback, const rclcpp::QoS &qos=rclcpp::ParameterEventsQoS(), const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &options=(rclcpp::SubscriptionOptionsWithAllocator< AllocatorT >()))
 

Protected Member Functions

RCLCPP_PUBLIC bool wait_for_service_nanoseconds (std::chrono::nanoseconds timeout)
 

Detailed Description

Definition at line 50 of file parameter_client.hpp.

Constructor & Destructor Documentation

◆ AsyncParametersClient() [1/6]

RCLCPP_PUBLIC rclcpp::AsyncParametersClient::AsyncParametersClient ( const rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_base_interface,
const rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr  node_topics_interface,
const rclcpp::node_interfaces::NodeGraphInterface::SharedPtr  node_graph_interface,
const rclcpp::node_interfaces::NodeServicesInterface::SharedPtr  node_services_interface,
const std::string &  remote_node_name,
const rmw_qos_profile_t &  qos_profile,
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)
inline

Create an async parameters client.

Parameters
[in]node_base_interfaceThe node base interface of the corresponding node.
[in]node_topics_interfaceNode topic base interface.
[in]node_graph_interfaceThe node graph interface of the corresponding node.
[in]node_services_interfaceNode service interface.
[in]remote_node_nameName of the remote node
[in]qos_profileThe rmw qos profile to use to subscribe
[in]group(optional) The async parameter client will be added to this callback group.
Deprecated:
use rclcpp::QoS instead of rmw_qos_profile_t

Definition at line 68 of file parameter_client.hpp.

◆ AsyncParametersClient() [2/6]

AsyncParametersClient::AsyncParametersClient ( const rclcpp::node_interfaces::NodeBaseInterface::SharedPtr  node_base_interface,
const rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr  node_topics_interface,
const rclcpp::node_interfaces::NodeGraphInterface::SharedPtr  node_graph_interface,
const rclcpp::node_interfaces::NodeServicesInterface::SharedPtr  node_services_interface,
const std::string &  remote_node_name = "",
const rclcpp::QoS qos_profile = rclcpp::ParametersQoS(),
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)

Create an async parameters client.

Parameters
[in]node_base_interfaceThe node base interface of the corresponding node.
[in]node_topics_interfaceNode topic base interface.
[in]node_graph_interfaceThe node graph interface of the corresponding node.
[in]node_services_interfaceNode service interface.
[in]remote_node_name(optional) name of the remote node
[in]qos_profile(optional) The qos profile to use to subscribe
[in]group(optional) The async parameter client will be added to this callback group.

Definition at line 32 of file parameter_client.cpp.

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

Here is the call graph for this function:

◆ AsyncParametersClient() [3/6]

template<typename NodeT >
rclcpp::AsyncParametersClient::AsyncParametersClient ( const std::shared_ptr< NodeT >  node,
const std::string &  remote_node_name,
const rmw_qos_profile_t &  qos_profile,
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)
inline

Constructor.

Parameters
[in]nodeThe async parameters client will be added to this node.
[in]remote_node_namename of the remote node
[in]qos_profileThe rmw qos profile to use to subscribe
[in]group(optional) The async parameter client will be added to this callback group.
Deprecated:
use rclcpp::QoS instead of rmw_qos_profile_t

Definition at line 116 of file parameter_client.hpp.

◆ AsyncParametersClient() [4/6]

template<typename NodeT >
rclcpp::AsyncParametersClient::AsyncParametersClient ( const std::shared_ptr< NodeT >  node,
const std::string &  remote_node_name = "",
const rclcpp::QoS qos_profile = rclcpp::ParametersQoS(),
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)
inlineexplicit
Parameters
[in]nodeThe async parameters client will be added to this node.
[in]remote_node_name(optional) name of the remote node
[in]qos_profile(optional) The qos profile to use to subscribe
[in]group(optional) The async parameter client will be added to this callback group.

Definition at line 138 of file parameter_client.hpp.

◆ AsyncParametersClient() [5/6]

template<typename NodeT >
rclcpp::AsyncParametersClient::AsyncParametersClient ( NodeT *  node,
const std::string &  remote_node_name,
const rmw_qos_profile_t &  qos_profile,
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)
inline

Constructor.

Parameters
[in]nodeThe async parameters client will be added to this node.
[in]remote_node_nameName of the remote node
[in]qos_profileThe rmw qos profile to use to subscribe
[in]group(optional) The async parameter client will be added to this callback group.
Deprecated:
use rclcpp::QoS instead of rmw_qos_profile_t

Definition at line 163 of file parameter_client.hpp.

◆ AsyncParametersClient() [6/6]

template<typename NodeT >
rclcpp::AsyncParametersClient::AsyncParametersClient ( NodeT *  node,
const std::string &  remote_node_name = "",
const rclcpp::QoS qos_profile = rclcpp::ParametersQoS(),
rclcpp::CallbackGroup::SharedPtr  group = nullptr 
)
inlineexplicit
Parameters
[in]nodeThe async parameters client will be added to this node.
[in]remote_node_name(optional) name of the remote node
[in]qos_profile(optional) The qos profile to use to subscribe
[in]group(optional) The async parameter client will be added to this callback group.

Definition at line 185 of file parameter_client.hpp.

Member Function Documentation

◆ delete_parameters()

std::shared_future< std::vector< rcl_interfaces::msg::SetParametersResult > > AsyncParametersClient::delete_parameters ( const std::vector< std::string > &  parameters_names)

Delete several parameters at once.

This function behaves like command-line tool ros2 param delete would.

Parameters
parameters_namesvector of parameters names
Returns
the future of the set_parameter service used to delete the parameters

Definition at line 277 of file parameter_client.cpp.

◆ load_parameters() [1/2]

std::shared_future< std::vector< rcl_interfaces::msg::SetParametersResult > > AsyncParametersClient::load_parameters ( const rclcpp::ParameterMap parameter_map)

Load parameters from parameter map.

This function filters the parameters to be set based on the node name.

If two duplicate keys exist in node names belongs to one FQN, there is no guarantee which one could be set.

Parameters
parameter_mapnamed parameters to be loaded
Returns
the future of the set_parameter service used to load the parameters
Exceptions
InvalidParametersExceptionif there is no parameter to set

Definition at line 306 of file parameter_client.cpp.

References rclcpp::parameters_from_map().

Here is the call graph for this function:

◆ load_parameters() [2/2]

std::shared_future< std::vector< rcl_interfaces::msg::SetParametersResult > > AsyncParametersClient::load_parameters ( const std::string &  yaml_filename)

Load parameters from yaml file.

This function behaves like command-line tool ros2 param load would.

Parameters
yaml_filenamethe full name of the yaml file
Returns
the future of the set_parameter service used to load the parameters

Definition at line 290 of file parameter_client.cpp.

References rclcpp::parameter_map_from_yaml_file().

Here is the call graph for this function:

◆ on_parameter_event()

template<typename CallbackT , typename NodeT , typename AllocatorT = std::allocator<void>>
static rclcpp::Subscription<rcl_interfaces::msg::ParameterEvent>::SharedPtr rclcpp::AsyncParametersClient::on_parameter_event ( NodeT &&  node,
CallbackT &&  callback,
const rclcpp::QoS qos = rclcpp::ParameterEventsQoS(),
const rclcpp::SubscriptionOptionsWithAllocator< AllocatorT > &  options = (      rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>()  ) 
)
inlinestatic

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.

Definition at line 316 of file parameter_client.hpp.

◆ service_is_ready()

bool AsyncParametersClient::service_is_ready ( ) const

Return if the parameter services are ready.

This method checks the following services:

  • get parameter
  • get parameter
  • set parameters
  • list parameters
  • describe parameters
Returns
true if the service is ready, false otherwise

Definition at line 353 of file parameter_client.cpp.

References rclcpp::ClientBase::service_is_ready().

Here is the call graph for this function:

◆ wait_for_service()

template<typename RepT = int64_t, typename RatioT = std::milli>
bool rclcpp::AsyncParametersClient::wait_for_service ( std::chrono::duration< RepT, RatioT >  timeout = std::chrono::duration<RepT, RatioT>(-1))
inline

Wait for the services to be ready.

Parameters
timeoutmaximum time to wait
Returns
true if the services are ready and the timeout is not over, false otherwise

Definition at line 354 of file parameter_client.hpp.


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