Ask Your Question

Revision history [back]

To publish, you need to add this line to your code (where you want to publish your msg) pointPub.publish(the-message-you-want-to-publish);

To publish, you need to add this line to your code (where you want to publish your msg) pointPub.publish(the-message-you-want-to-publish);

I think you should remove the instantiation of ros::NodeHandle nh; in your constructor. add it as an one of your private class attributes (ros::NodeHandle nh_ ). then initialize it in your constructor like this: JoyToPoint(ros::NodeHandle& nh): nh_(nh). In your main will look like this

int main(int argc, char **argv)
 {

 ros::init(argc, argv, "joy_to_point");
 ros::NodeHandle nh;
 JoyToPoint point(nh);
 ros::spin();
 return 0;
 }

`