rosserial spinOnce() blocks if not connected to ROS
Using rosserial with an Arduino, I find that spinOnce() blocks if not connected to ROS, which makes sense (since how can you locally know when to go), so I am wondering if the standard call (for nodeHandle nh) inside the loop() should be:
if (nh.connected()) nh.spinOnce();
else { ....deal with having disconnected from ROS and make the robot safe....then wait for reconnection....}
I saw on the logging page: http://www.ros.org/wiki/rosserial/Overview/Logging
//wait until you are actually connected
while (!nh.connected() ){
nh.spinOnce();
}
but from what I am seeing with the arduino, you would get the same result with
nh.spinOnce();
alone, since it blocks. Is that correct?
Once ROS has disconnected, is there some way to put the arduino in a state where it can accept a reconnect cleanly?
Thanks again for all your help with this.