Go to Post what is it exactly that makes people like Dave Lavery more admirable than the video store clerk down the street? - Madison [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-02-2016, 14:08
keco185's Avatar
keco185 keco185 is offline
Registered User
FRC #0484 (Roboforce)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2012
Location: United States
Posts: 6
keco185 is an unknown quantity at this point
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   Spotlight this post!  
Unread 21-02-2016, 16:39
cbf cbf is offline
Registered User
FRC #2877
 
Join Date: Feb 2012
Location: Newton, MA
Posts: 74
cbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nice
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   Spotlight this post!  
Unread 21-02-2016, 17:58
keco185's Avatar
keco185 keco185 is offline
Registered User
FRC #0484 (Roboforce)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2012
Location: United States
Posts: 6
keco185 is an unknown quantity at this point
Re: USB Cameras with roboRIO

Quote:
Originally Posted by cbf View Post
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.
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   Spotlight this post!  
Unread 22-02-2016, 12:00
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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   Spotlight this post!  
Unread 23-02-2016, 07:27
rod@3711 rod@3711 is offline
Registered User
AKA: rod nelson
FRC #3711 (Iron Mustangs)
Team Role: Mentor
 
Join Date: May 2014
Rookie Year: 2014
Location: Trout Lake, WA
Posts: 64
rod@3711 is an unknown quantity at this point
Re: USB Cameras with roboRIO

Quote:
Originally Posted by cbf View Post
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.
Thanx for this note. The camera is much more important this year than last year. Last year we just gave up on the HD-3000 usb camera. This year we switched to a Logitech Usb camera and we get consistent image exposures.

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   Spotlight this post!  
Unread 23-02-2016, 09:44
bdaroz's Avatar
bdaroz bdaroz is offline
Programming Mentor
AKA: Brian Rozmierski
FRC #5881 (TVHS Dragons)
Team Role: Mentor
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Albany, NY
Posts: 371
bdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud ofbdaroz has much to be proud of
Re: USB Cameras with roboRIO

Quote:
Originally Posted by rod@3711 View Post
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++.
We re-tooled much of the CameraServer class in C++ ourselves in order to switch between two USB cameras on the RoboRIO (ugh, bandwidth). In general, the whole class just seemed poorly written and way too touchy.
  #7   Spotlight this post!  
Unread 23-02-2016, 15:10
cbf cbf is offline
Registered User
FRC #2877
 
Join Date: Feb 2012
Location: Newton, MA
Posts: 74
cbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nicecbf is just really nice
Re: USB Cameras with roboRIO

Quote:
Originally Posted by bdaroz View Post
We re-tooled much of the CameraServer class in C++ ourselves in order to switch between two USB cameras on the RoboRIO (ugh, bandwidth). In general, the whole class just seemed poorly written and way too touchy.
Yes, we did exactly the same thing for the same reason, although last year we only wrapped the CameraServer class to switch feeds. This year, we made our own version of it, primarily to get around the bug that rod@3711 complained about.

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)
and then a few lines later checks:

Code:
if (req.compression != kHardwareCompression) ...
Unfortunately, about 90% of the time, the request from the SmartDashboard or the SFX Dashboard (but apparently not the LabView dashboard! -- likely due to different timing) is sent in two packets -- the first packet containing only two bytes, and the second containing the remaining 10 bytes. The read call above asks for however many octets there are at that instant and doesn't make any effort to read the octets that come later. So the req.compression word it's comparing to hasn't even been read yet and is thus zero, so the call fails.

keco195 -- if you're using the (default) LabView dashboard, this isn't your issue, and I apologize for hijacking your thread!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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