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

custom msg in pub/sub node

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

kshitij gravatar image

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

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

dornhege gravatar image

What you use as msg should be the package name.

Otherwise it should work.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-03-04 21:59:02 -0600

Seen: 744 times

Last updated: Mar 04 '12