Ask Your Question

param server C++ lists

asked 2012-01-13 01:20:03 -0500

narcispr gravatar image

updated 2014-01-28 17:11:07 -0500

ngrennan gravatar image

I'm defining config vectors through the param server using yaml files:

sample: velocity_controller/velocity_max: [0.3, 0.2, 0.2, 0.0, 0.0, 0.5]

If I want to parse these vectors from a python node I use this code:

_velocity_max = array( rospy.get_param("velocity_controller/velocity_max") )

However, in C++, using the ros::param::getCached() I'm only able to parse the following types: string, int, double, bool or XmlRpcValue.

How I can import my values into a std::vector<double> ?

Thank you!

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2012-01-13 01:50:57 -0500

AHornung gravatar image

You need to convert the lists yourself from XmlRpcValue, see

edit flag offensive delete link more


Thank you! I can't understand how I skip this example :)
narcispr gravatar image narcispr  ( 2012-01-16 02:19:09 -0500 )edit

answered 2014-05-21 09:35:40 -0500

jbohren gravatar image

updated 2014-05-21 09:56:43 -0500

In ROS groovy and forward you can now get vectors and dictionaries of primitives and strings without having to use the XmlRpc API:

See the unit tests for examples, but it works like you'd expect it to work:

I've updated the wiki doc here:

edit flag offensive delete link more


Thanks for updating the wiki Jon. This API addition never got publicized enough, and addresses an important pain point in the roscpp API.

Adolfo Rodriguez T gravatar image Adolfo Rodriguez T  ( 2014-05-21 22:01:26 -0500 )edit

answered 2012-01-13 01:51:21 -0500

dornhege gravatar image

Specifically for lists the param server documentation has a code example.

edit flag offensive delete link more

answered 2012-01-13 01:25:09 -0500

DimitriProsser gravatar image

Give my answer to this question a look. It allows you to look up parameters into a map. I use it to build an array of strings, but you could easily just use doubles instead.

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


Asked: 2012-01-13 01:20:03 -0500

Seen: 7,375 times

Last updated: May 21 '14