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

Recursive Message Data

asked 2021-08-27 02:40:09 -0500

wzli gravatar image

Regarding ROS2 but also applicable to ROS.

I want to send a tree data structure in a single message. This requires the message definition to contain a reference to a dynamical sized array of itself, which did not sit well with the IDL generator. Is there any way to achieve this? I realize it may be unsupported, then consider as a feature request.

Alternative methods I like to avoid:

  1. Splitting up into multiple or an array of messages with full path stamped on every node like the TF implementation.
  2. Serializing into a custom binary or text format embedded into a buffer message field.
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-08-27 03:01:37 -0500

gvdhoorn gravatar image

updated 2021-08-27 03:32:38 -0500

No, this is not supported right now afaik.

I realize it may be unsupported, then consider as a feature request.

posting a feature request on ROS Answers is not going to work.

Please use a more appropriate venue for that, such as the ros2/ros2 Github organisation.

Alternative methods I like to avoid:

1. Splitting up into multiple or an array of messages with full path stamped on every node like the TF implementation.

I've seen people encode graphs in ROS messages by storing vertices/nodes in a list and then combine that with an adjacency matrix. Makes for a pretty efficient serialisation.

Something to realise perhaps (but you may already know this): ROS messages are not intended to be used as data structures directly, nor do they have to represent or mirror (in memory) the exact same structure as the data they carry. The recursive property of the tree you mention would be an example of a characteristic which does not necessarily need to be mapped 1-to-1 to the ROS message used to communicate the information.

Considering ROS messages as an interchange format only would make the requirement for encoding and decoding a vertex + adjacency list on the sending and receiving side less 'strange' I believe.

This is the same approach as used for sensor_msgs/Image and sensor_msgs/PointCloud2 fi. Even geometry_msgs/Pose et al. are not intended to be used directly: they are always supposed to be converted to non-msg types and then used with the libraries that provided those types (hence the to-from-Eigen and to-from-Bullet conversion packages provided).

edit flag offensive delete link more

Comments

Example of an existing package: PickNikRobotics/graph_msgs.

Not a 'standard' package, but an example.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-27 03:40:25 -0500 )edit

Could you add a comment describing the approach you ended up using?

It would be good to document success or working alternatives.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-30 03:21:31 -0500 )edit

Question Tools

Stats

Asked: 2021-08-27 02:35:44 -0500

Seen: 248 times

Last updated: Aug 27 '21