ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

For the slightly different case than what @tfoote linked to, here's how to get a single parameter as an array of values.


We recently merged this feature (made by @ayrton04), see:

  • https://github.com/ros2/rclcpp/pull/443
  • https://github.com/ros2/rcl_interfaces/pull/32

Looks like there's no documentation yet, but there is an example of setting:

https://github.com/ros2/demos/blob/03ee0e0963ecb0990742eaeee22b334c11b16722/demo_nodes_cpp/src/parameters/set_and_get_parameters.cpp#L47-L48

And you can use get_parameter(s) to get the rclcpp::Parameter for it, and on that class there are as_*_array() methods:

https://github.com/ros2/rclcpp/blob/a49281cff3082410621aeea388944b35ba63f819/rclcpp/include/rclcpp/parameter.hpp#L95-L113

Which return vector<T>.