View Single Post
  #7   Spotlight this post!  
Unread 07-23-2016, 10:19 AM
GoldenGollem's Avatar
GoldenGollem GoldenGollem is offline
Java Programmer
FRC #2509 (Hutchinson Tigerbots)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2015
Location: Minnesota
Posts: 24
GoldenGollem is an unknown quantity at this point
Re: 2 Cameras in Java

Thanks for that info. What we will most likely end up doing is having two cameras but only streaming one at a time to the dashboard. This is the latest version of code that we have for it.(FYI this was in a command format but was changed for simplicity of this site)

Code:
Cameras cameras;
public void robotInit() {
    	//This is for the USB Camera
    	server = CameraServer.getInstance();
    	server.setQuality(50);
    	Cameras.cam = "";
    	server.startAutomaticCapture(Cameras.cam);
    	while(isEnabled()){
    		server.startAutomaticCapture(Cameras.cam);
    	}

//There is a joystick button once pressed it will activate this command SwitchCams
public void SwitchCams() {
        if(Cameras.cam == "cam0"){
    		Cameras.cam = "cam1";
    	}else if(Cameras.cam == "cam1"){
    		Cameras.cam = "0";
    		//Leave following if statement equal to blank
    	}else if(Cameras.cam == "")
    		Cameras.cam = "cam0";
}
__________________
GoldenGollem -Hutchinson Tigerbots 2509
2015 - Mini-MN Regional 2nd Place Finalist
2016 - Mini-MN Regional 1st Place Finalist
Reply With Quote