0
$\begingroup$

Rosanswers logo

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.


Originally posted by kshitij on ROS Answers with karma: 115 on 2012-03-04

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

What you use as msg should be the package name.

Otherwise it should work.


Originally posted by dornhege with karma: 31395 on 2012-03-04

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.