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

Revision history [back]

click to hide/show revision 1
initial version

1st) Take a look here: roslaunch/xml/param.

For example you can set the parameter test to be a double of value 2.0:

<param name="test" type="double" value="2.0" />

Now the parameter 'test' is loaded into ROS parameter server and you can access it from your node like this:

double testvar;
node_handle.getParam("/test", testvar);
std::cout<<testvar; //prints 2

Look also here for more examples.

2nd) You can do this using the method described above, simply load ID1 and ID2 as default values of parameters and load them inside your node where you can publish them.

3rd) I don't think there's a way to do this from command line only, AFAIK, and i would not endorse that, what if there are 1000 variables? creating a tousand topics would probaly clog your system.

I think the best way would be to create a custom message with an array, if the variables are double the message would look like this:

//customMSG.msg
double[] myvars

Then the subscriber can parse the message and determine how many variables are there.