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
pub_ = nh_.advertise<project_name::msg_name>("topic", 1);
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
pub_ = nh_.advertise<first_project::first_msg>("topic", 1);
Doesnt seem to work. Well why should I import something that is already in my package. What is the correct syntax here?
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.
Also: for almost all msg pkgs, the
package_name
is used as the namespace for the messages, so in your examplepackage_name
andproject_name
should probably be identical?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.