$ rosrun beginner_tutorials hello_doubles _my_doubles_array:="[1.1,2.2,3.3]"
Note that after running the command, the ROS parameter server contains a parameter /hello_doubles/my_doubles_array with a string value of '[1.1, 2.2., 3.3]' and not the expected double array [1.1, 2.2, 3.3].
Eventually, I realized the rosrun program passes the list as a string instead of an array of doubles. In order to pass a double array parameter, the following methods could be used instead: (1) use the rosparam set command, or (2) use the rosparam load command.
Use the rosparam set command to pass a double array parameter
- In a Terminal, type in the following command: $ rosparam set /hello_doubles/my_double_array "[1.1, 2.2, 3.3]"
Use the rosparam load command to set a double array parameter
- Using a text editor, create a yaml file e.g. hello_doubles.yaml with the following lines:
where my_doubles_array is the name of the double array parameter - In a Terminal, type in the following command to load the yaml file:
$ rosparam load /path/to/hello_doubles.yaml
No comments:
Post a Comment