# Using msgs from the same package

Hi,

I'm trying to use msgs from the current package. So usually it's like this, when I'm using a different package:

#include package_name/msg_name


But I'm trying to use the msg I created in the same project package Let's say my package name is first_package and msg is first_msg, but doing so:

#include first_package/first_msg


Doesnt seem to work. Well why should I import something that is already in my package. What is the correct syntax here?

edit retag close merge delete

It is always a good idea to include verbatim any error messages or warnings that you receive. Just stating that it doesn't work is making it really difficult for us to help you.

( 2015-05-15 01:37:48 -0500 )edit

Also: for almost all msg pkgs, the package_name is used as the namespace for the messages, so in your example package_name and project_name should probably be identical?

( 2015-05-15 01:38:50 -0500 )edit

I know, it's not a big help, but it may be worthwhile to move your message definition to a separate package (see ros best practices). Also, try simply copying the tutorial (see tutorials understanding topics) and analysing the differences, helps me usually.

( 2015-06-02 03:14:52 -0500 )edit

Sort by » oldest newest most voted

Anonymous

Hi,

Is your #include in the following form with the triangular braces and *.h?

#include <first_package/first_msg.h>


Are you getting an error in the compiling process? If so, what type of error?

more