CameraServer has changed substantially for 2017, so the discussion/suggestions from 2016 no longer apply (I'm the author of the 2017 rewrite). To start two cameras, simply do (Java):
Code:
UsbCamera cam0 = CameraServer.getInstance().startAutomaticCapture(0);
UsbCamera cam1 = CameraServer.getInstance().startAutomaticCapture(1);
Note the no-arguments variant of startAutomaticCapture always starts camera 0. Thinking about this, it may be a good idea for us to make this auto-increment in the future to make this a bit easier to use.
There is no stopCamera() in 2017; the camera automatically starts and stops depending on what's connected to it.
You may run into USB bandwidth limits running two cameras simultaneously. Keeping the resolution low is a good way to avoid this. Streaming one camera at a time and switching between them to conserve USB bandwidth isn't well-supported at present (there's nothing to prevent one camera starting before the other stops and thus hitting the bandwidth limit); that's something we will be addressing in a future update.
__________________
Author of
cscore - WPILib CameraServer for 2017+
Author of
ntcore - WPILib NetworkTables for 2016+
Creator of
RobotPy - Python for FRC
2010 FRC World Champions (
294, 67, 177)
2007 FTC World Champions (30, 74,
23)
2001 FRC National Champions (71,
294, 125, 365, 279)