Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your problem is that you're not doing anything to install or configure your python file in the CMakeLists.txt to be useable from another package. There's lots of other questions relating to that such as: https://answers.ros.org/question/298740/ros2-c-and-python-in-same-package-is-it-possible/

However in your case I would strongly recommend against trying to do that, and instead recommend that you put the constants into your .msg file so that as you've noticed they'll be easily available in python, but also in C++ and any other language for which a node is written. They will all share the constant values in all languages using the autogenerated code.

You can find documentation on constants at: http://wiki.ros.org/msg#Constants