razar51
11-02-2015, 17:49
I am currently using the automatic capture function to display a USB camera feed on the driver station, and I ran into a potential problem.
Since the roborio assigns a name to the USB camera, and the code must call out that name in order to define the correct camera object, when the camera is unplugged the code will crash on Init. This means that if someone accidentally unplugs the camera before a match the robot code will crash and the robot will do nothing for the whole match.
The same thing happens if the camera is replaced by a different camera (since the roborio assigns a different name).
Is there a way to wrap some protective code around the camera initialization so that it will not cause the code to crash in the absence of a camera? Or is there a way to query the names of the devices currently plugged into the roborio?
Since the roborio assigns a name to the USB camera, and the code must call out that name in order to define the correct camera object, when the camera is unplugged the code will crash on Init. This means that if someone accidentally unplugs the camera before a match the robot code will crash and the robot will do nothing for the whole match.
The same thing happens if the camera is replaced by a different camera (since the roborio assigns a different name).
Is there a way to wrap some protective code around the camera initialization so that it will not cause the code to crash in the absence of a camera? Or is there a way to query the names of the devices currently plugged into the roborio?