Ask Your Question
0

custom msg in pub/sub node

asked 2012-03-04 21:59:02 -0500

kshitij gravatar image

updated 2012-03-06 05:49:13 -0500

kwc gravatar image

Want to implement user defined msg in nodes I edited CMakeLists.txt to include rosbuild_genmsg().

In the publisher/subscriber node, do I have to include it like in the case of std_msg? (i.e. #include "msg/custom_msg.h" or something?)

Will this correspond to the following change: ros::Publisher chatter_pub = n.advertise<msg::custom_msg>("chatter", 1000);

Further, I want to create a subscriber node, and publish messages to it manually, should the corresponding callback method be modified as:

void chatterCallback(const msg::custom_msg::ConstPtr& msg) { ROS_INFO("I heard: [%s]", msg->data.c_str()); }

Thanks a lot, really appreciate your help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-03-04 22:29:41 -0500

dornhege gravatar image

What you use as msg should be the package name.

Otherwise it should work.

edit flag offensive delete link more

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: 2012-03-04 21:59:02 -0500

Seen: 634 times

Last updated: Mar 04 '12