i3drobotics / stereo-vision-toolkit

Stereo image processing suite
MIT License
30 stars 10 forks source link

Register if Phobos has been unplugged #7

Closed ghost closed 4 years ago

ghost commented 6 years ago

If Phobos is unplugged while the program is running errors can occur. Currently unable to get the callback to trigger when the device is unplugged. Ideally the tab windows should be disabled if the unplugged event it triggered. (This process is currently working for Deimos however this uses a much simpler process)

jveitchmichaelis commented 6 years ago

Possibly requires a flag for additional events to fire.

https://github.com/i3drobotics/stereo-vision-toolkit/blob/03d5cdb652aefc631062d0a49437ecfa529e153d/src/cameraimagingsource.cpp#L83

Should be:

handle.addListener((DShowLib::GrabberListener*)listener, DShowLib::GrabberListener::eALL);

per https://www.theimagingsource.com/support/documentation/ic-imaging-control-cpp/meth_descGrabber_addListener.htm.

ghost commented 4 years ago

To keep things simple a system has been added to the abstract stereo camera class that will disconnect the camera if it looses more than n frames consecutively. Each child class has a 'disconnectCamera' method that is able to close the camera connections safely even if a device is manually removed. This has been tested with Basler USB, TIS, and Deimos. There an issue with the TIS cameras that the TIS software cannot tell if a camera has been left in an unsafe state when they are reconnected so this will cause an occasional crash. However, if the user restarts the software it closes the connection properly and fixes the issue. As this issue is no longer relevant this issue, this issue will be closed. (New issue: #46 )