kalibr icon indicating copy to clipboard operation
kalibr copied to clipboard

Validator hangs in MonoCameraValidator.generateMovoview() when called from CameraChainValidator.synchronizedCallback

Open brawner opened this issue 2 years ago • 2 comments

It's unclear why this is an issue only for me, but the validator hangs for me when after it brings up all the cv2 windows. As I understand it's likely because the GUI calls happening inside a ROS message subscriber, which is being executed in a separate thread.

I believe it's only recommended to interact with the CV2 gui's from the main thread, which is not necessarily the case if you are calling the gui API from within a ROS subscriber callback. In that case, subscriber callbacks should be only adding images to a SPSC queue, which are updated in a while loop in main. Since there is no "spin once" for ros python, that would imply the rospy.spin() would need to run in a background thread and feed images for viewing to the main thread.

https://stackoverflow.com/a/60739664/2089061 https://github.com/opencv/opencv/issues/8407

If you have any recommended workarounds to this issue, that would be very helpful. Thank you

brawner avatar Jun 22 '22 22:06 brawner

Can you provide details of the OS you are using and library version (opencv, ros etc)?

On Wed, Jun 22, 2022 at 6:21 PM Stephen Brawner @.***> wrote:

It's unclear why this is an issue only for me, but the validator hangs for me when after it brings up all the cv2 windows. As I understand it's likely because the GUI calls happening inside a ROS message subscriber, which is being executed in a separate thread.

I believe it's only recommended to interact with the CV2 gui's from the main thread, which is not necessarily the case if you are calling the gui API from within a ROS subscriber callback. In that case, subscriber callbacks should be only adding images to a SPSC queue, which are updated in a while loop in main. Since there is no "spin once" for ros python, that would imply the rospy.spin() would need to run in a background thread and feed images for viewing to the main thread.

https://stackoverflow.com/a/60739664/2089061 opencv/opencv#8407 https://github.com/opencv/opencv/issues/8407

If you have any recommended workarounds to this issue, that would be very helpful. Thank you

— Reply to this email directly, view it on GitHub https://github.com/ethz-asl/kalibr/issues/535, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ6TYX45ZDWF3NSXA3LWHDVQOGVJANCNFSM5ZR7MD2A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

goldbattle avatar Jun 22 '22 22:06 goldbattle

Ubuntu 20.04, ROS noetic. Using the master branch of Kaliber with opencv-python == 4.6.0.66

brawner avatar Jun 22 '22 22:06 brawner