Creating a ROS subscriber within a class constructor?
Hello All, I have a callback to some topic that is a method of a class. This works perfectly, except for the fact that I need to initialize this Subscriber within the main() function of my node. Ideally I would like to initialize it within the constructor of my class. Is there a way to do this? In simple terms I would like to add this line to the class constructor rather than main(): ros::Subscriber sub = n.subscribe("chatter", 1000, &Listener::callback, &listener);
Thanks Ammar