Dealing with custom messages in a complex system

asked 2019-08-07 14:08:22 -0600

Elecia gravatar image

I have my node in a large multi-node, multi-contributor system. Custom messages work and I can use them in my python scripts. My question is about sharing messages and putting together a good workspace.

My node runs on a processor that is separate from the other master and nodes (ROS_MASTER != localhost). The master has many custom messages in different packages. I don't have access to the .debs to install the packages but I can get the messages from /opt/ros/kinetic/shared/<package-name>/msg and ftp it to my system.

I could put the messages in my local /opt/ros/... but I'd rather put it in my version control so I know when messages change (their packages are still in development).

I started put the messages in my catkin workspace under their package name:

  + src
    + my_node1
    + my_node2
    + msg
      + their_packageA
          - dostuff.msg
          - definestuff.msg  (dostuff depends on definestuff)
      + their_packageB
      + their_packageC

(Each one of these packages has messages but I'm going to focus on packageA's dostuff instead of complicating the question. I do need a solution that works across these packages.)

In my CMakeList.txt, I have

add_message_files(DIRECTORY ../msg

And in the package file I had



This seemed to work, I could send and receive messages from my remote master. Then I noticed I'd duplicated the message files in my catkin_ws/msg directory. I'm not sure which dostuff.msg was being used. I decided to collapse the directory down so all the custom messages were under the msg directory, getting rid of the package names.

This seemed to work but I recently created a new workspace and it didn't work. Digging into the old system, there were still package directories in catkin_ws/devel (despite many catkin_make clean commands and a few rm -r build commands; didn't occur to me to look in devel).

The issue that I'm having is that my master no longer recognizes my messages because they are my_node1/dostuff.msg instead of the expected their_packageA/dostuff.msg.

Is there a good way to solve my message placement problems give my constraint of not having their package debians and a desire to have version control?

If I have CMakeLists.txt with each directory such as: add_message_files(DIRECTORY ../msg/packageA FILES dostuff.msg definestuff.msg .... Should I have multiple add_message_files entries or multiple DIRECTORY/FILES in the same add_message_file?

I end up having to have complex add_message_files with both my_node1/CMakeLists.txt and my_node2/CMakeLists.txt, is there a way I can use one file that both nodes include?

Thank you for reading this very long question.

edit retag flag offensive close merge delete