read yaml parameter in C++
Hi all,
I'm experiencing an issue in using the parameter server:
1) I start a roscore so that I get only one master on this machine. 2) I set a global param manually, say:
rosparam set /test/m '{"id0": 0, "id1": 1}'
3) I start one of my launchfile whose short version is:
<launch>
<node pkg="mypckg" name="mynode" type="mynode" output="screen"/>
</launch>
I get:
roslaunch mypckg mylaunch.launch
... logging to /home/flowers/.ros/log/08d803da-74d2-11e4-9a51-a01d480daef0/roslaunch-zbook-4127.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://zbook:55760/
SUMMARY
========
PARAMETERS
* /rosdistro
* /rosversion
4) In the code of "mynode" I read this param:
string m;
if(!nh.getParam("/test/map", m))
ROS_ERROR("Failed to read 'map' on param server");
5) The above error is triggered, while rosparam get /thr/before still returns an existing value. It looks like I'm not reading params in the same namespace but I'm reading global parameters so I don't understand...
What are the PARAMETERS listed in the SUMMARY? Only parameters defined in the launch file or all available parameters on the server?
What am I missing? Thanks
What is the output of
rosparam list
? You can try that at various points to see what the parameters are or how they're changing (usingrosparam get
)...