Why can't I 'get' my rosrun parameters?
I have a node that should be able to run other nodes. It has a basic method of doing so using
system("rosrun myproject Robot robotname:='Botty'");
This should set the parameter robotname to 'Botty'. In my Robot node file, I have this code that should retrieve that parameter:
std::string robotname;
n.getParam("robotname", robotname);
ROS_INFO(robotname.c_str());
However, nothing is printed. When I execute rosparam list
, the corresponding parameter is /RobotNode1/robotname
. What am I doing wrong? I think that rosparam list
output might be a good hint - is there a way to set that parameter when executing rosrun without referencing RobotNode1
?
[edit] n is a NodeHandle.
Note that
robotname:='Botty'
does not set/RobotNode1/robotname
, but just/robotname
. Use_robotname:=Botty
for parameters in the node's namespace.