View Single Post
  #1   Spotlight this post!  
Unread 17-01-2017, 19:16
Bradley Boxer's Avatar
Bradley Boxer Bradley Boxer is offline
Registered User
AKA: Bradley Boxer
FRC #0303 (TEST Team 303)
Team Role: Programmer
 
Join Date: May 2015
Rookie Year: 2015
Location: United States
Posts: 26
Bradley Boxer is an unknown quantity at this point
Post Axis Camera Not Displaying On Smart Dashboard

My team has been trying to get an Axis Camera (M1011) working for about a week now, with little success.
The Axis Camera light blinks green (we configured it to do that when it was being accessed), but the SmartDashboard "CameraServer Stream Viewer" displays red with "NO CONNECTION" text in the top left, for both the "Rectangle" and "Axis Camera" drop-downs that appear in the properties window.

We are running this code, with the camera static addressed at 10.3.3.31.

Code:
	public void enableRawCam() {
		rawThread = new Thread(() -> {
			rawCamera = CameraServer.getInstance().addAxisCamera("10.3.3.31");
			rawCamera.setResolution(160, 120);
			rawCvSink = CameraServer.getInstance().getVideo();
			rawOutputStream = CameraServer.getInstance().putVideo("Rectangle", 160, 120);
			rawMat = new Mat();
			
			while(!Thread.interrupted()) {
				String sdOutput = runRawCam();
				SmartDashboard.putString("vision thread output", sdOutput);
			}
		});
		rawThread.setDaemon(true);
		rawThread.start();
	}
	
	public String runRawCam() {
		if(rawCvSink.grabFrame(rawMat)==0) {
			rawOutputStream.notifyError(rawCvSink.getError());
			return "errored";
		} else {
			rawOutputStream.putFrame(rawMat);
			return "did not error";
		}	
	}

enableRawCam() is run in the constructor of another class, which is initialized in robotInit().

No errors display in the driverstation, but when we FTP into the Rio and get the log, we get errors as follows:

Code:
Exception in thread "CSListener" VideoException [edu.wpi.cscore.VideoException: wrong property type]
	at edu.wpi.cscore.CameraServerJNI.getEnumPropertyChoices(Native Method)
	at edu.wpi.first.wpilibj.CameraServer.lambda$new$0(CameraServer.java:432)
	at edu.wpi.first.wpilibj.CameraServer$$Lambda$2/5854261.accept(Unknown Source)
Exception in thread "CSListener" VideoException [edu.wpi.cscore.VideoException: wrong property type]
	at edu.wpi.cscore.CameraServerJNI.getEnumPropertyChoices(Native Method)
	at edu.wpi.first.wpilibj.CameraServer.lambda$new$0(CameraServer.java:432)
	at edu.wpi.first.wpilibj.CameraServer$$Lambda$2/5854261.accept(Unknown Source)
Exception in thread "CSListener" VideoException [edu.wpi.cscore.VideoException: invalid property]
	at edu.wpi.cscore.CameraServerJNI.getPropertyMin(Native Method)
	at edu.wpi.first.wpilibj.CameraServer.putSourcePropertyValue(CameraServer.java:313)
	at edu.wpi.first.wpilibj.CameraServer.lambda$new$0(CameraServer.java:418)
	at edu.wpi.first.wpilibj.CameraServer$$Lambda$2/5854261.accept(Unknown Source)
Default IterativeRobot.disabledInit() method... Overload me!
Default IterativeRobot.robotPeriodic() method... Overload me!
NT: server: client CONNECTED: 10.3.3.95 port 59487
NT: server: client CONNECTED: 10.3.3.30 port 62920
EDIT: We can access the camera through the web dashboard, so we know its probably not a problem with the camera.

Any help would be greatly appreciated.
__________________
The opinions expressed in this post are mine and do not necessarily reflect those of my team.

Last edited by Bradley Boxer : 17-01-2017 at 19:23. Reason: clarity
Reply With Quote