0
$\begingroup$

Rosanswers logo

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?


Originally posted by RosFan19 on ROS Answers with karma: 107 on 2015-05-14

Post score: 0


Original comments

Comment by gvdhoorn on 2015-05-15:
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.

Comment by gvdhoorn on 2015-05-15:
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?

Comment by Reiner on 2015-06-02:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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?

Another issue might be the generate/add messages components of your CMakeLists.txt


Originally posted by anonymous8676 with karma: 327 on 2015-05-14

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.