File tree Expand file tree Collapse file tree
core/src/main/java/edu/wpi/grip/core/sources Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030@ XStreamAlias (value = "grip:Camera" )
3131public class CameraSource extends Source implements StartStoppable {
3232
33+ /**
34+ * The path that Axis cameras stream MJPEG videos from. Although any URL can be supplied
35+ * {@link CameraSource.Factory#create(String)}, allowing this to work with basically any network video stream, this
36+ * default path allows the Axis M1011 cameras used in FRC to work when only an IP address is supplied.
37+ */
38+ public final static String DEFAULT_IP_CAMERA_PATH = "/mjpg/video.mjpg" ;
39+
3340 private final static String DEVICE_NUMBER_PROPERTY = "deviceNumber" ;
3441 private final static String ADDRESS_PROPERTY = "address" ;
3542 private static Logger logger = Logger .getLogger (CameraSource .class .getName ());
@@ -75,6 +82,11 @@ public FrameGrabber create(int deviceNumber) {
7582 }
7683
7784 public FrameGrabber create (String addressProperty ) throws MalformedURLException {
85+ // If no path was specified in the URL (ie: it was something like http://10.1.90.11/), use the default path
86+ // for Axis M1011 cameras.
87+ if (new URL (addressProperty ).getPath ().length () <= 1 ) {
88+ addressProperty += DEFAULT_IP_CAMERA_PATH ;
89+ }
7890 return new IPCameraFrameGrabber (addressProperty );
7991 }
8092 }
You can’t perform that action at this time.
0 commit comments