On some systems I experience problems with the keyboard input when using the TrainMarkerBundle node. In particular, the system does not accept any keyboard input. In all tests I have ensured that the OpenCV input window is active.
This bug has been tested on three systems, all running Linux Mint 17.1, using the code compiled from source and from the ROS repositories. On two of these systems no input is accepted, not even the 'q' command to exit the program. For some reason it does work correctly on one of these systems.
Proposed Solution
I have corrected the code at my end and the node works as intended. The wrong data type is used when reading the keyboard input from OpenCV. The input is read as int, while it later parsed by comparing it to chars. The following changes has been made in nodes/TrainMarkerBundle.cpp to correct the code:
int keyCallback(int key); -> int keyCallback(char key); // Around line 86
int keyProcess(int key) -> int keyProcess(char key) // Around line 318
int key = cvWaitKey(20); -> char key = cvWaitKey(20); // Around line 427
Concerns
I do not wish to commit these changes myself since the reason why they work is unclear to me. The cvWaitKey(20) method returns an int. It does not make sense that an earlier conversion to char solved the problem.
_Copied from original issue: sniekum/ar_trackalvar#53
From @richterh on May 5, 2015 10:13
On some systems I experience problems with the keyboard input when using the TrainMarkerBundle node. In particular, the system does not accept any keyboard input. In all tests I have ensured that the OpenCV input window is active.
This bug has been tested on three systems, all running Linux Mint 17.1, using the code compiled from source and from the ROS repositories. On two of these systems no input is accepted, not even the 'q' command to exit the program. For some reason it does work correctly on one of these systems.
Proposed Solution
I have corrected the code at my end and the node works as intended. The wrong data type is used when reading the keyboard input from OpenCV. The input is read as int, while it later parsed by comparing it to chars. The following changes has been made in nodes/TrainMarkerBundle.cpp to correct the code:
Concerns
I do not wish to commit these changes myself since the reason why they work is unclear to me. The cvWaitKey(20) method returns an int. It does not make sense that an earlier conversion to char solved the problem.
_Copied from original issue: sniekum/ar_trackalvar#53