Dealing with custom messages in a complex system
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/
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:
catkin_ws/
+ 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
FILES
dostuff.msg
definestuff.msg
....
And in the package file I had
<build_depend>message_generation</build_depend>
<exec_depend>message_runtime</exec_depend>
<build_depend>their_packageA</build_depend>
<exec_depend>their_packageA</exec_depend>
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 catkinws/devel (despite many **catkinmake 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: addmessagefiles(DIRECTORY ../msg/packageA FILES dostuff.msg definestuff.msg .... Should I have multiple addmessagefiles entries or multiple DIRECTORY/FILES in the same addmessagefile?
I end up having to have complex addmessagefiles with both mynode1/CMakeLists.txt and mynode2/CMakeLists.txt, is there a way I can use one file that both nodes include?
Thank you for reading this very long question.
Asked by Elecia on 2019-08-07 14:08:22 UTC
Comments