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

Load 2D parameter from parameter server

asked 2015-07-30 21:10:34 -0500

anonymous user


Hi all,

I have a YAML file which successfully loads the following into the server:

        joints: [ [name_1_1, name_1_2], 
            [name_2_1, name_2_2], 
            [name_4_1, name_4_2], 
            [name_5_1, name_5_2], 
            [name_6_1, name_6_2] ]

But I am having problems writing the c++ to return the contents. For a 1D vector I can easily use:

std::vector<std::string> names;
nh.getParam("/joints", names);

where the YAML could be:

joints: [name_1, name_2, name_3]

To go 2D I tried to load it with:

std::vector< std::vector<std::string> > names;
nh.getParam("/joints", names);

But I get a build error:

no matching function for call to ‘ros::NodeHandle::getParam(const char [17], std::vector<std::vector<std::basic_string<char> > >&)’

How can I load 2D parameters from the ros parameter server in C++?

Thank you in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-07-31 01:28:15 -0500

mgruhler gravatar image

There is no automatic way to do this. You have have to write a parser using XmlRpc yourself.

See the ROS documentation on the Paramter Server, the ROS XmlRpc API, and maybe this ROS Answers question for reference.

edit flag offensive delete link more

Question Tools



Asked: 2015-07-30 21:10:34 -0500

Seen: 1,474 times

Last updated: Jul 31 '15