ros::spin() can't work contione
when I subscribe a message (ros::Subscriber sub=nh.subscribe("message",1000,callback);)and I put the ros::spin() in a subprocess(if(fork==0){ros::spin()}), it can't work as expected, it can't subscribe the message contione, only 999 messages can be subscribed,but when I put the spin() out of the If(fork==0),it can work as usual.
I am asking a stupid question but did you check if fork is equal to zero with as basic printout as example ? What is the variable fork ? Is the code
if (fork==0)
inside a thread ?I have checked it. it can work, fork==0 means inside a subprocess,
Could I suggest you to check this two pages: This question: http://answers.ros.org/question/53055... make me think your could be a duplicate. And the theory http://wiki.ros.org/roscpp/Overview/C... .