Hi peshala,

If the class in defined in some file in the include like classX.h and a classX.cpp, then after including

#include <packageX/classX.h>

you should be able to use the namespaces defined thereof as this is equivalent to having the file in the same dir and including it using the "" directives. The manifest just makes the include process nicer and avoid copying files all over. I dont think its related to any namespace issues AFAIK. Maybe someone else on the list has a better idea.


billy

On 6 October 2010 04:42, Peshala Jayasekara <peshala_24@yahoo.com> wrote:
Hi Billy,

Thanks for your reply.
Now, I am having a linking error where I want to use a class from packageX in packageY.
I did
<export>
    <cpp cflags="-I{prefix}/include"/>
</export>
in the manifest.xml of packageX
and
<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
Peshala

From: Billy Okal <b.okal@jacobs-university.de>
To: User discussions <ros-users@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

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


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

billy

On 5 October 2010 09:49, Peshala Jayasekara <peshala_24@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.

Thanks
Peshala


_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users




--
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"


_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users




--
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"