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

Need help with message declaration

asked 2013-02-22 05:31:02 -0500

dmeltz gravatar image

updated 2013-02-22 07:33:29 -0500

Hello

I wish to use a message type that i created in one of my packages in my other package, but for some reason it doesn't work :

The package were the message is declared named dany_controller_pkg and the message type is velocity_derection.

In order to use this message type in my other new package, i add to the new package Manifest file, the following dependency :

<depend package="dany_controller_pkg"/>

and included in the cpp file of my new package the following declaration :

#include <dany_controller_pkg/velocity_derection.h>

Still for some reason when i compile, the compiler doesn't recognize the imported message type.

The exact compiler error is:

Unresolved inclusion: <dany_controller_pkg/velocity_derection.h>

(Also, in the original package this message type works fine)

What am i missing ? Thanks.

edit retag flag offensive close merge delete

Comments

1

Post the compiler error, please.

KruseT gravatar image KruseT  ( 2013-02-22 05:33:13 -0500 )edit

I added the exact compiler error, you can see it above.

dmeltz gravatar image dmeltz  ( 2013-02-22 05:57:35 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-02-22 10:58:44 -0500

dmeltz gravatar image

updated 2013-02-22 11:13:02 -0500

Turned out that the problem is with the eclipse !

For some reason when i compile using Eclipse it marks all the places where i using velocity_derection topic as errors, and writes that they are Unresolved. But still the compilation succeeds and the program works fine. I have no idea why it behave in this way.

Nevertheless, I want to thank you KruseT and TommyP for your great help !

Also, if someone have any suggestions why it happens, I be happy to know.

edit flag offensive delete link more
0

answered 2013-02-22 05:41:33 -0500

KruseT gravatar image

updated 2013-02-22 09:23:47 -0500

If you get an error about a mising header, you need to add an add_dependency(...) call to your CMakeLists.txt. This has recently been added to the tutorial

add_dependencies(<mytarget> <otherpackage1>_gencpp <otherpackage2>_gencpp)

or with newest genmsg:

add_dependencies(<mytarget> 
                 <otherpackage1>_generate_messages_cpp 
                 <otherpackage2>_generate_messages_cpp)

(gencpp will continue to work, the second option was added to be easier to understand)

UPDATE: Tommy is right, my answer is for catkin only, you are using rosbuild, so my answer does not help you. So tell us exaclty what you are doing, and give us the full log in the question. Do you invoke rosmake? Do you get errors for dany_controller_pkg? Did you enable message generation in the CMakeLists.txt of dany_controller_pkg?

The tutorials are here: http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29

edit flag offensive delete link more

Comments

Where can i found the tutorial you mention ?

dmeltz gravatar image dmeltz  ( 2013-02-22 06:06:07 -0500 )edit

I think this dependency is only needed for a catkin package. What you have done should be enough. Are you sure the file velocity_derection.h exists. Seems to me to be a misspelling of detection.

TommyP gravatar image TommyP  ( 2013-02-22 07:16:09 -0500 )edit

Question Tools

Stats

Asked: 2013-02-22 05:31:02 -0500

Seen: 163 times

Last updated: Feb 22 '13