ROS2 provides a slightly different infrastructure to deal with parameters compared to ROS 1. An introduction guide can be found in Understanding ROS2 parameters. The main difference is that there is no longer a centralized parameter server, but instead, parameters are maintained per node.
This package provides a new Orocos service called rosparam
that can be loaded globally and per Orocos component. The service provides 4 operations:
getParameter()
: loads a parameter from the ROS2 node parameter facility and returns its value.loadProperty()
: loads a parameter from the ROS2 node parameter facility into an Orocos property.setParameter()
: sets a parameter into the ROS2 node parameter facility. With the defaultrtt_ros2_node::Node
, if the parameter does not exist,rosnode
declares one.storeProperty()
: sets a parameter into the ROS2 node parameter facility from the value of an Orocos property. With the defaultrtt_ros2_node::Node
, if the parameter does not exist,rosnode
declares one.
This package can be imported with:
import("rtt_ros2_params")
Then, the service can be loaded into a component named <component>
with:
<component>.loadService('rosparam')
<component>
will have a new service named rosparam
that provides the operations described. These operations can be called with:
<component>.rosparam.setParameter( <args> )
<component>.rosparam.getParameter( <args> )
<component>.rosparam.loadProperty( <args> )
<component>.rosparam.storeProperty( <args> )
In order to work, this service requires two other elements being loaded before calling the operations.
- A ROS2 node service must exist for the component where this service is loaded or globally.
- The typekits provided in
rtt_ros2_rclcpp_typekit
and its dependencies must be loaded
These prerequirements can be achieved by:
import("rtt_ros2")
ros.import("rtt_ros2_params")
To load a ROS2 node specific for a component, please, read the related documentation.