Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 18

Keep running the function without restarting it?

$
0
0
I have this problem that i cannot make run my while(true) without it get restarted.. I think the problem occurs since in my main loop int main { ros::init(argc,argv, "loop"); loop(); ros::spin(); } In side loop() void loop() { cout << "Are you ready" << endl; while(ready == false { //DO SOMETHING ros::spinOnce() //needed since i read from a subscriber in this while loop } cout << "i am out" << endl; while(true) { //do something again ros::spinOnce(); } } Right now it keep printing "are you ready", the idea was it should print it once.. I don't understand how it comes outside the loop.. it seems impossible to do..

Viewing all articles
Browse latest Browse all 18

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>