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

Revision history [back]

As I worked more with the code, I see that you are correct, it was not spinOnce() that was blocking, but rather my proposed "solution," using nh.connected() that was actually causing the block. Also, I did not realize the importance of getting spinOnce() called frequently enough, so I was losing the connection during some tasks. Can you give me a rough time limit between those calls?

So my question boils down to what is the best way to determine if the connection to ROS is lost? Also, do you have a suggestion for the best method for waiting for reconnection other than

if (!nh.connected()) spinOnce();