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

Revision history [back]

You can query the NodeHandle using the "connected" function:

  if (nh.connected())
  {
     // do something here
  }

It returns a bool as to whether the connection is still active, but be aware there is a timeout before we "break" the connection.