What is the actual meaning of ros::spin()
I know that ros::spin
can make the subscriber and publisher run in loop to publish or receive data.
But I dont know which part in the program is running in loop or the whole program is running in loop?
int main(int argc, char ** argv )
{
ros::init(argc,argv,"obstacle_finder");
ros::NodeHandle n;
ros::NodeHandle private_nh("~");
ObjDet object_detector(n,private_nh);
ros::spin();
return 0;
}
Such as this example. Will the class ObjDet
run constructor and destructor in every loop also? What is the range in the loop? Can I say all the part in main
will run in every loop?
This is helpful too: http://wiki.ros.org/roscpp/Overview/C....