[ros-users] Communicating between two user created packages

Peshala Jayasekara peshala_24 at yahoo.com
Wed Oct 6 02:42:25 UTC 2010

Hi Billy,

Thanks for your reply.
Now, I am having a linking error where I want to use a class from packageX in 
I did

    <cpp cflags="-I{prefix}/include"/></export>

in the manifest.xml of packageX
<depend package="packageX"/>
in the manifest.xml of packageY

#include <packageX/X.h> works fine with no compilation errors but
having a linking error.

undefined reference to `my_namespace::X::X()`

What am I missing here?

Thanks in advance

From: Billy Okal <b.okal at jacobs-university.de>
To: User discussions <ros-users at code.ros.org>
Sent: Tuesday, October 5, 2010 20:40:30
Subject: Re: [ros-users] Communicating between two user created packages

hi Peshala,

This is very simple, say you have packages packagex and packagey

And have designed messages in either of them, or even both

Say you have a message X.msg in packagex and want to use in packagey

in the manifest.xml of packagex, you need to add the following line

    <cpp cflags="-I{prefix}/msg/cpp/"/>

then in manifest.xml of packagey you need to add the following line

<depend package="packagex"/>

The you should be set. To use the message in the cpp code all you need to do is 
now include the message headers as

#include <packagex/X.h>

and proceed to use it in the code. For python you will just need to use 'from 
packagex import *'

There are also a number of tutorials online which explain this.

Have fun


On 5 October 2010 09:49, Peshala Jayasekara <peshala_24 at yahoo.com> wrote:

Dear all,
>How can we communicate between two user created packages using a user created 
>ROS msg?
>When I referred the tutorials, it only provides a scenario when the two 
>executables (publisher and listener) are in the same package.
>Do we have to create the same msg in both the packages?
>Also, I'm having trouble figuring out how to include headers from a user created 
>package to another package. 
>Any advise would be greatly appreciated, since I'm a beginner.
>ros-users mailing list
>ros-users at code.ros.org


Viele Gruss/Best Regards,
Billy Okal
Jacobs University Bremen
#5383, MA 333

"sure vi is user friendly, its just particular about who to be friends with"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20101005/c8869d8b/attachment-0003.html>

More information about the ros-users mailing list