Simplifying how to declare parameters in ROS 2

Interesting.

I think the discussion in this recent post on using ros message in the parameter interface might also be relevant.

From a user-requirements point of view, I second a need:

  1. To load ‘data sets’, i.e. structured data:

    • In one way or another (*)
    • In a variable amount (i.e. a configuration file contains 0 to N data sets of a certain type),
  2. To have this data available:

    • In multiple nodes,
    • Which are distributed across multiple hosts,

    Using multiple configuration files across these hosts is not an option.
    (Mainly since this implies keeping duplicate data across configuration files in sync).

  3. Not all data in a data set is relevant to all nodes.

    E.g. an ‘object_description’ data set could contain:

    • General info, e.g. object_UID and object_name,
    • Perception-related info for the camera_detection node,
    • Picking-related info for the picker_robot node,
    • A destination_identifier for the transportation_node
    • Etc.

    All nodes need the object_UID and object_name, but e.g. the camera_detection node does not need the destination_identifier.

  4. It should be easy to add or edit data.
    E.g. if the data is in a text file, I would prefer:

    • The data-set-related data to be grouped in sections data_set_1, data_set_2, etc.
    • The possible non-data-set-related data to be grouped in sections node_1, node_2, etc.

    As opposed to data-set-related data to be split accross sections common, node_1, node_2, etc


(*) Imo. it does not necessarily _have_ to be through parameters. It might be a misinterpretation, but I sort of conclude from above mentioned thread that parameters are not really intended for structured data?

What I am currently resorting to is:

  • The data sets are loaded by one node,
    • My initial intention was to use parameters,
    • But as this node is inside a gazebo plugin, I resorted to reading from the SDF file,
  • This node decides which data sets are currently active,
  • And it publishes the active data sets using a custom message, which holds a ‘vector of data_set_message
  • All other nodes that need the data subscribe to this topic
    • The publisher QoS is KeepLast(1), reliable and transient_local,
    • So all nodes, including late-joining ones, always get the latest ‘active data sets’,
    • Each time a node receives a new message, it discards the old data sets and loads the new ones.

This works well and suits my current needs, so I am rather pleased with it. But it also feels rather strange as it does not seem to be “the intended way” to do this in ROS 2. It is also not really ‘clean’ (and for some applications probably unacceptable) that the full data sets are sent to all nodes, instead of only the node-specific data.

I think above requirements are pertinent to many applications, so imo. it makes sense to develop a ‘common best practice’ for this, that is part of ROS 2 core.