|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
USB Cameras with roboRIO
Because of space restrictions on our robot, we were hoping to use a smaller USB camera instead of an axis camera or the Microsoft lifecam camera. Specifically, we got this endoscope camera to use. Unfortunately when we try to get an image from it using the roboRIO we just get a message that mentions something of an invalid image. Is there anything special that I need to do to get cameras that aren't the Microsoft camera to work or will the roboRIO only work with the one USB camera?
|
|
#2
|
|||
|
|||
|
Re: USB Cameras with roboRIO
Most USB cameras will work. Are you by any chance using the SmartDashboard? If so, then try the Labview ("default") Dashboard and set it to USB Camera (HW). Once you get a video feed there, you can then switch the SmartDashboard.
This is due to a bug in the WPILib CameraServer class (that's been there for at least two years). We made our own version that fixed the bug. |
|
#3
|
||||
|
||||
|
Re: USB Cameras with roboRIO
We are using the Labview dashboard and setting the camera to HW. I know the camera works because we tried it on our laptop and it ran right away. We just can't get an image with it connected to the roboRIO
|
|
#4
|
|||
|
|||
|
Re: USB Cameras with roboRIO
You might try using Vision Assistant. Connect your laptop to the roboRIO, camera to roboRIO. Open Vision Assistant and select Acquire Image. Choose the second acquisition method that includes USB. Change the target from My Computer to the roboRIO. See if the camera shows up there and see if it works.
Some USB cameras do not work with UVC, the linux mechanism for USB webcams, but do work with DirectShow, the MS mechanism. If it works in Vision Assistant, it should work with the WPILib VIs. Greg McKaskle |
|
#5
|
|||
|
|||
|
Re: USB Cameras with roboRIO
Quote:
We find that having to go to the Default Dashboard to get the video feed going (via USB Camera HW), then switching to SmartDashboard annoying. One of those things that we would rather not have to do while frantically setting up for a match. We are using USBcamera class and code in C++. |
|
#6
|
||||
|
||||
|
Re: USB Cameras with roboRIO
Quote:
|
|
#7
|
|||
|
|||
|
Re: USB Cameras with roboRIO
Quote:
The student who did that fix posted his code on TeamForge (we couldn't figure out how to formally submit it). The cause of the bug is trivial -- when the CameraServer on the robot parses a request for a frame from the client (e.g. SmartDashboard running on the laptop), it expects a packet with a twelve octet header -- representing three 4-byte integers, the 2nd of which must be -1, indicating hardware compression (which is the only option supported). It reads this packet with: Code:
if (read(conn, &req, sizeof(req)) == -1) Code:
if (req.compression != kHardwareCompression) ... keco195 -- if you're using the (default) LabView dashboard, this isn't your issue, and I apologize for hijacking your thread! |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|