Ask Your Question
3

Load 2D parameter from parameter server

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

cmeaclem gravatar image

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_3_1], 
            [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
6

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 780 times

Last updated: Jul 31 '15