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

Revision history [back]

click to hide/show revision 1
initial version

Currently they exist in the same package. The python file in src/ and the message in msg/. It seems like in most examples, people do not put them in the same package.

Examples maybe, but in reality this is not necessarily always the case. I know plenty packages that ship msgs (and srvs and actions) in the same package in which they are used.

It also seems like msg/ is stored at the workspace level.

This seems very strange to me. I've never seen that and it would also not work.

I am having trouble importing the message from a python file in the same package as the message.

Please let me know what the convention is around this topic, and if you have any suggestions as to why the import statement is not working.

(CMakeLists.txt and package.xml of the package are fine)

So something isn't working for you, but you have already concluded that your build script and package manifest are correct.

In reality in most cases the issue is with those two, especially when dealing with messages, so it would be a good idea to show us:

  1. your CMakeLists.txt and package.xml, and
  2. the actualy error you see when trying to import your msgs, because right now you only tell us that "it is not working", which is not enough for anyone to figure out what is going wrong