Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   C++ USB Camera Errors (http://www.chiefdelphi.com/forums/showthread.php?t=133682)

RushAHead 29-01-2015 20:30

C++ USB Camera Errors
 
Hello!
My team is attempting to use the Microsoft LifeCam HD-3000 USB camera on our robot; however, we are encountering error messages in the driver station. We have tried to use the Simple Vision example code (unaltered), but it isn't working.
We have verified that we can see the camera on the web based configuration page and that we are using the correct name in the code (we are). The code builds fine, but as soon as we upload to the robot, we are receiving the error message:

"Error on line 188 of CameraServer.cpp: Incompatible State: The operation cannot be completed: Choose "USB Camera HW" on the dashboard at CameraServer::Serve()"

We program in C++ and use the C++ SmartDashboard. We did add a USB Webcam Viewer object to SmartDashboard, but it only shows the standard gray background with an "ERROR" pink strip at the bottom in its area.

Any fixes/ ideas?

codedr 31-01-2015 11:09

Re: C++ USB Camera Errors
 
We got this to work by exiting the driver station and dashboard, reseting the roborio
and restarting the driver station. After selecting usb camera hw, it started working.

The exact line in the c++ code is complaining about the camera client making a request not in hardware compression mode (req.compression != kHardwareCompression).

MamaSpoldi 07-03-2015 13:42

Re: C++ USB Camera Errors
 
We are having this same problem. We are coding in C++ and using the SmartDashboard.

We added the following to our code:

Code:

void TalonXVI::RobotInit()
{
    printf("CameraServer being started\n");
    CameraServer::GetInstance()->SetQuality(50);
    //the camera name (ex "cam0") was verified through the roborio web interface
    CameraServer::GetInstance()->StartAutomaticCapture("cam0");
}

We are getting the following error message (repeatedly):
Quote:

Error on line 188 of CameraServer.cpp: Incompatible State: The operation cannot be completed: Choose "USB Camera HW" on the dashboard
at CameraServer::Serve()
at /home/lvuser/FRCUserProgram() [0x29284]
at /home/lvuser/FRCUserProgram() [0x29110]
at /home/lvuser/FRCUserProgram() [0x28ea8]
at /home/lvuser/FRCUserProgram() [0x28d1c]
at /lib/libstdc++.so.6.0.20(+0xa2954) [0x411a3954]
And no image displayed. We tried restarting the driverstation, dashboard, and roboRIO but still get the error message. However the Error line on the dashboard USB WebCam control now says: "ERROR: roboRIO-230.local".

Any suggestions would be much appreciated. Thanks.

epylko 07-03-2015 14:26

Re: C++ USB Camera Errors
 
We are using C++ and the USB camera as well. There are a couple of things we have done to get video in the C++ dashboard.

1. Make sure you have the patched widget located here: http://www.chiefdelphi.com/forums/sh...d.php?t=134404

2. When you start the driver station, start the default dashboard and then make sure you have USB Camera HW selected. You should see video in that dashboard. After you have video working there, switch to the C++ dashboard and add the patched widget to the dashboard.

I believe that will work - that's from memory. Let us know if that works.

MamaSpoldi 09-03-2015 09:52

Re: C++ USB Camera Errors
 
Quote:

Originally Posted by epylko (Post 1454769)
We are using C++ and the USB camera as well. There are a couple of things we have done to get video in the C++ dashboard.

1. Make sure you have the patched widget located here: http://www.chiefdelphi.com/forums/sh...d.php?t=134404

2. When you start the driver station, start the default dashboard and then make sure you have USB Camera HW selected. You should see video in that dashboard. After you have video working there, switch to the C++ dashboard and add the patched widget to the dashboard.

I believe that will work - that's from memory. Let us know if that works.

Really appreciate that info. We followed your procedure and it WORKED! Thanks. :D

MamaSpoldi 09-03-2015 20:12

Re: C++ USB Camera Errors
 
So we had it working and now it does not work again after running without it on the robot for other testing (it was not securely mounted so we didn't want to damage it). Any advice? Do we have to go through the whole process (with the Labview dashboard and then changing over to the C++ SmartDashboard) each new time we bring up the robot with the camera? Do we need to reboot the driverstation after the camera is added?

Thanks

Alan Anderson 10-03-2015 00:16

Re: C++ USB Camera Errors
 
Quote:

Originally Posted by MamaSpoldi (Post 1455764)
So we had it working and now it does not work again after running without it on the robot for other testing...

Did you plug it back into the same port it was in before? Check the roboRIO web page to see whether its name is now cam1 instead of cam0.

cbf 13-03-2015 18:30

Re: C++ USB Camera Errors
 
Quote:

Originally Posted by MamaSpoldi (Post 1455764)
So we had it working and now it does not work again after running without it on the robot for other testing (it was not securely mounted so we didn't want to damage it). Any advice? Do we have to go through the whole process (with the Labview dashboard and then changing over to the C++ SmartDashboard) each new time we bring up the robot with the camera? Do we need to reboot the driverstation after the camera is added?

Thanks

It's just flakey. Many of the underlying classes don't return errors (mostly declared void). If anything goes wrong, it just keeps spewing errors to the message window on the dashboard.

This is much harder than it should be.


All times are GMT -5. The time now is 12:33.

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