Ros::spinOnce(), how does it work?
Hi,
I have a servo and I am trying to call a service from a client code. Then, based on the software architecture of the client, the call is supposed to be taken up by a service server. In the launch file I specified both the client and server code name.
In both client and server node, I have used ros::spinOnce
to use looping. The client code is written in a manner that it checks for any input given from keyboard. I noticed that if I don't give any input, it still goes to the server node.
I used print statements to check it.
Specifically, I mean to say that although the client.call
function is not accessed in the client code, it still goes into the while
loop section of the ROS::Rate
in the server code and keeps on printing the test string for a while. Then, again it goes back to the while
loop of ros::Rate
section in client code. This process keeps on repeating.
My question is that how does ros run the server code if it has not been called yet?
thanks,
https://github.com/ros/ros_comm/blob/...
Please edit your question with the relevant source code. That would make it a lot easier for people to answer it.
Stefan's right, it would be easier if we can just look at your code (or a simplified version of it).