Hey everyone<br><br>I got a small problem writting a subscriber using the spinOnce command instead of the spin() used in the tutorial. I do not receive anything from the subscription, but I know topics are being published. rviz is showing that the data is published and if I rewrite the code to use spin() like in the tutorial, then I get plenty of information. I have tried to search the problem but did not find anything useful and I hope someone here can see the problem. <br>
<br>My code is: <br><br>int main(int argc, char **argv)<br>{<br> init(argc, argv, "testPlayer");<br> NodeHandle n;<br><br> Subscriber sub;<br><br> Rate loop_rate(5);<br><br> testPlayer test;<br>
<br> while ( ok() ) {<br><br> sub = n.subscribe("scan", 1000, &testPlayer::callBack, &test);<br><br> spinOnce();<br><br> loop_rate.sleep();<br> }<br><br> return 0;<br>
}<br><br>Regards<br><br>Sebastian Aslund<br><br><br>