Passing an array of arrays of doubles from a yaml config file
I am using ROS2 foxy and I have an array of arrays of doubles that should set one of the variables in the node. Is it possible to pass that from the yaml config file to c++? I tried to wrap it in a std::vector<std::vector<double>> but I get an error.
My yaml file looks like this:
offboard_navigator:
ros__parameters:
setpoints_lla: [[47.3977507, 8.5456073, 5],
[47.39774376, 8.54576301, 6],
[47.39781572, 8.54577784, 5],
[47.39781739, 8.54558749, 6],
[47.3977507, 8.5456073, 0]]
And this is how I declare the parameter in the ROS2 node code:
this->declare_parameter< std::vector< std::vector <double> > >("setpoints_lla", {{0.0,0.0,0.0}});
this->get_parameter("setpoints_lla", setpoints_list_param_);
And this is the error I am getting:
/opt/ros/foxy/include/rclcpp/node_impl.hpp:166:15: error: no matching function for call to ‘rclcpp::ParameterValue::ParameterValue(const std::vector<std::vector<double, std::allocator<double> > >&)’
166 | rclcpp::ParameterValue(default_value)
Is there another way to implement this so that I can set one of my variables using an array of arrays. Note: all my inner arrays have the same size.
,