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

How to assign array to a parameter with rosrun?

asked 2013-03-21 04:35:41 -0500

Tareq Haque gravatar image

footprint: [[0.4, 0.0], [-0.16, -0.22], [-0.18, 0.35]]

If I want to add this footprint parameter with rosrun like below: rosrun move_base move_base __name:=move_base_node _local_costmap/footprint:=[[0.4,0.0],[-0.16,-0.22],[-0.18,0.35]]

footprint becomes a string.

What is the right syntax to assign integer array in footprint parameter?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-21 05:33:16 -0500

You use standard YAML syntax for rosrun paramter assignment.

That being said, I was able to reproduce the behavior you're seeing, and also got some interesting results. Perhaps this is a bug in rosrun? See below:

rosrun rospy_tutorials talker __name:=talker _test:=[0,1,2]
rosparam get /talker/test
    [0, 1, 2]

rosrun roscpp_tutorials talker __name:=talker _test:=[0,1,2]
rosparam get /talker/test

It appears as if parameters are correctly YAML-parsed when using rosrun with a python node, but not with a cpp node. I tried all sorts of different variations on the YAML bit. Using a scalar number works, but all other more-complex YAML constructs (sequences, maps, etc.) all seem to parse as plain strings.

Does anyone have a correct formulation, or is this really a rosrun bug? I was able to reproduce the same behavior in both groovy and fuerte (current debian packages).

edit flag offensive delete link more

Question Tools


Asked: 2013-03-21 04:35:41 -0500

Seen: 983 times

Last updated: Mar 21 '13