waitKey and ROS

asked 2015-03-19 11:43:46 -0600

215 gravatar image

updated 2015-03-19 11:55:06 -0600

How can i use Waitkey in ROS..

I have while loop which waits for a user input, and then goes to the next state.. Within i get video image using Image_transport.

So my idea is to have

cout << "Am i done?" << endl;
While(input != 'y')
      Retreive new frames for the function to work with.... 

But the problem is that it keeps outputting "Am i done", which i suspect is because the Ros::spin(), but what doesn't make sense, it how it breaks out of the while loop. How do make it only do the thing within the while loop until a key is pressed.

edit retag flag offensive close merge delete


where is the getting input part ?

bvbdort gravatar image bvbdort  ( 2015-03-19 14:47:06 -0600 )edit

user input

215 gravatar image 215  ( 2015-03-19 15:02:49 -0600 )edit

where is cin ?

bvbdort gravatar image bvbdort  ( 2015-03-19 17:30:07 -0600 )edit

Well.. the way i was thinking of doing was using getch() to detect the input, and if it correspond to a letter ex. 'y' it will jump out.. while(input != 'y' ) { .... input = getch(); }

215 gravatar image 215  ( 2015-03-19 17:47:17 -0600 )edit

may be some small datatype error from reading input. please put your real code about input.

bvbdort gravatar image bvbdort  ( 2015-03-20 06:10:31 -0600 )edit

The reason why i want to use OpenCV wait key.. is because the function within runs imshow("webcam",frame), which require wait key...

215 gravatar image 215  ( 2015-03-26 10:16:05 -0600 )edit