Ask Your Question
0

Can custom messages be located within a package?

asked 2018-10-21 14:35:01 -0600

jburns gravatar image

updated 2018-10-21 14:38:56 -0600

I am attempting to use a custom message inside of a publisher. 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. It also seems like msg/ is stored at the workspace level.

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)

Thank you,

edit: rosmsg show package_name/msg_name works

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-10-21 16:01:29 -0600

gvdhoorn gravatar image

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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-10-21 14:35:01 -0600

Seen: 347 times

Last updated: Oct 21 '18