How to disconnect (nh) on arduino
I've used while (nh.connected())
so my arduino car starts when ROSMASTER is running .
My problem is that i can't disconnect nodeHandle when i close the ROSMASTER , which is importan for my task . Any suggestions ???
Make sure to call
spinOnce
inside thewhile
loop. Please see an example below:Note that the above snippet is for waiting before publishing or doing ROS-related task. This is why
!
operator is used. However, in your case, it is not required. ThespinOnce
call should be enough.