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

I agree with @ahendrix you should probably use the parameter server. You can create a yaml file like this:

my_node:
  boxes:
    box1:
      width: 1
      height: 1
      length: 2
    box2:
      width: 4
   ...

You can then include this in your launch file:

<launch>
  <arg name="box_file" default="$(find my_package)/config/boxes.yaml" />
  <rosparam command="load" file="$(arg box_file)"/>

  <node pkg="my_package" type="box_node" name="box_node"/>
</launch>

Afterwards in your box node you can query the parameter namespace boxes and get a dictionary of all the defined boxes (python) or an xmlrpc struct (C++) which you can then parse for the information you want. See this answer on how to use the xmlrpc struct. The usage of python dictionaries should be straight forward.

If you use the parameter server there is also no need to publish these box values you can just query the server in all the nodes you might need the boxes in.