Ask Your Question

Revision history [back]

ros::NodeHandle& private_nh = getPrivateNodeHandle();
ros::NodeHandle& nh = getNodeHandle();

There are just local variables, that only exist within onInit(). You need to declare them in your class declaration and set them in this function. Something like this:

class OD
  ros::NodeHandle private_nh;
  ros::NodeHandle nh;
  void onInit()
      private_nh = getPrivateNodeHandle();
      nh = getNodeHandle();