Ask Your Question
0

Custom msg for diference package

asked 2011-07-06 20:06:49 -0500

embeddedheaven gravatar image

Hello,

I am doing the communication between two computer, and I use 2 difference package name.

How can I create and general and custom msg to comunicate between 2 node.

For Example in Package A, I create msg.

Position.msg

float64 x
float64 y
float64 x

and the msg type will be A/Position

and in Package B, I create msg.

Position.msg

float64 x
float64 y
float64 x

and the msg type will be B/Position

:( Thanks all

edit retag flag offensive close merge delete

Comments

If you want the message like the ones you defined, geometry_msgs/Point already does that.
dornhege gravatar imagedornhege ( 2011-07-06 22:16:48 -0500 )edit

2 Answers

Sort by » oldest newest most voted
5

answered 2011-07-06 20:36:11 -0500

Lorenz gravatar image

I assume that you have all packages in one single repository and both computers have it checked out. Then the following should work: B could either use A's message definition or A could use B's message definition. However, it is pretty common in ROS to create a separate package C that only contains the message and no code. All you need to do is to create that package C, put the message file into the msg/ sub-directory and update your CMakeLists.txt to build that message. Then edit A's manifest and let it depend on C, edit B's manifest respectively. In A and B, instead of including A/Position.h or B/Position.h, include C/Position.h.

edit flag offensive delete link more
0

answered 2011-07-20 03:21:39 -0500

embeddedheaven gravatar image

Thanks you I got it

edit flag offensive delete link more

Comments

Can you accept the answer by clicked the checkmark, please.
dornhege gravatar imagedornhege ( 2011-07-20 04:20:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-07-06 20:06:49 -0500

Seen: 702 times

Last updated: Jul 20 '11