Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Control System (http://www.chiefdelphi.com/forums/forumdisplay.php?f=177)
-   -   Axis Camera Not Displaying On Smart Dashboard (http://www.chiefdelphi.com/forums/showthread.php?t=153833)

Bradley Boxer 17-01-2017 19:16

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.

AustinShalit 17-01-2017 20:01

Re: Axis Camera Not Displaying On Smart Dashboard
 
Take a look at this ScreenSteps page for more information about this bug:
http://wpilib.screenstepslive.com/s/...-faqs-for-2017

Bradley Boxer 17-01-2017 20:18

Re: Axis Camera Not Displaying On Smart Dashboard
 
Quote:

Originally Posted by AustinShalit (Post 1632658)
Take a look at this ScreenSteps page for more information about this bug:
http://wpilib.screenstepslive.com/s/...-faqs-for-2017

When we restart all of the network table clients, the driver station floods with errors saying:

Code:

ERROR: connect() to 10.3.3.31 port 80 error 101 - Network is unreachable (TCPConnector.cpp:175)
But the camera still does not connect.

AustinShalit 17-01-2017 20:22

Re: Axis Camera Not Displaying On Smart Dashboard
 
Can you still access the camera through the web dashboard?

Bradley Boxer 17-01-2017 20:24

Re: Axis Camera Not Displaying On Smart Dashboard
 
Yes, the web dashboard still works fine.

AustinShalit 17-01-2017 20:31

Re: Axis Camera Not Displaying On Smart Dashboard
 
I would restart your entire robot (roboRIO, radio, and camera).

Owen Busler 17-01-2017 20:57

Re: Axis Camera Not Displaying On Smart Dashboard
 
We have restarted multiple times. This problem has persisted for the past 4 days.

AustinShalit 17-01-2017 21:03

Re: Axis Camera Not Displaying On Smart Dashboard
 
If you open OutlineViewer (Eclipse Menubar -> WPILib -> Run Outline Viewer) What do you see listed under /CameraPublisher/{Camera name}/streams?

Bradley Boxer 17-01-2017 21:05

Re: Axis Camera Not Displaying On Smart Dashboard
 
I just got back from our workshop, so I don't have access to the robot at the moment, but I will check tomorrow.

AustinShalit 17-01-2017 21:09

Re: Axis Camera Not Displaying On Smart Dashboard
 
Tomorrow please also try running this code in a new project and test if the camera connects.

Code:

import edu.wpi.first.wpilibj.CameraServer;
import edu.wpi.first.wpilibj.IterativeRobot;

public class Robot extends IterativeRobot {
   
    public void robotInit() {
        CameraServer.getInstance().addAxisCamera("10.3.3.31");
    }
}


AustinShalit 18-01-2017 17:25

Re: Axis Camera Not Displaying On Smart Dashboard
 
After a private message discussion, we discovered another antivirus program was running and preventing SmartDashboard from connecting to the camera.

Bradley Boxer 19-01-2017 21:21

Re: Axis Camera Not Displaying On Smart Dashboard
 
The camera stopped working again today, working fine over USB but repeatedly connecting/disconnecting several times a second when connecting via wireless. We were able to resolve the problem, and I would like to share the solution in case anyone else is encountering this issue.

In the NetworkTables outline viewer, our Axis camera had a value "streams" which contained a string array with
1) the wireless URL of the camera (10.3.3.2:something)
2) the USB URL of the camera (172.22.11.2:something)

The solution was to delete the USB URL. I believe what was happening was that the camera would connect over wireless, see that it had another element in the array that took priority and try and connect to it, fail on the connection, and re-connect over wireless.

Peter Johnson 20-01-2017 04:50

Re: Axis Camera Not Displaying On Smart Dashboard
 
Quote:

Originally Posted by Bradley Boxer (Post 1633736)
The camera stopped working again today, working fine over USB but repeatedly connecting/disconnecting several times a second when connecting via wireless. We were able to resolve the problem, and I would like to share the solution in case anyone else is encountering this issue.

In the NetworkTables outline viewer, our Axis camera had a value "streams" which contained a string array with
1) the wireless URL of the camera (10.3.3.2:something)
2) the USB URL of the camera (172.22.11.2:something)

The solution was to delete the USB URL. I believe what was happening was that the camera would connect over wireless, see that it had another element in the array that took priority and try and connect to it, fail on the connection, and re-connect over wireless.

SmartDashboard doesn't apply a priority, it just round-robins over each address if it gets disconnected. I would suspect it's still getting disconnected from the wireless URL, you're just not seeing the disconnects because it reconnects successfully with minimal delay. Can you run SmartDashboard from a command prompt so you can see what's being printed to the console (the executable is located in C:\Users\yourname\wpilib\tools)? In particular, I'm interested in seeing the "Trying to connect to:" and "Connected to:" messages. Can you also state what the URLs actually are?


All times are GMT -5. The time now is 11:43.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi