Go to Post There are zillions more volunteers than paid staff. We are FIRST. - Rick TYler [more]
Home
Go Back   Chief Delphi > Technical > Control System
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2015, 11:04
pluto7443 pluto7443 is offline
Registered User
FRC #4917
 
Join Date: Mar 2014
Location: Canada
Posts: 17
pluto7443 is an unknown quantity at this point
Camera Lag

My team is wanting to use a camera on our robot this year. We are using the Microsoft LifeCam 3000, and it works fine. However, there is about a one second delay. This makes the camera only barely useful. Anyone have any ideas how to reduce or eliminate that lag?
Reply With Quote
  #2   Spotlight this post!  
Unread 10-02-2015, 13:26
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,659
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Camera Lag

We haven't seen a lag anywhere near that long when we did the simpleVision and intermediateVision java examples (we haven't gotten very much farther than that yet). We were able to get what we could believe was 30 fps at 640 pixels across over twisted pair with perhaps a tenth of a second lag (when someone spoke, it looked like a poorly dubbed movie). We haven't tried wireless yet.
  • What resolution, frame rate, and picture quality are you using?
  • What is the USB cable connected to (raspberry pi, roboRIO, something else)? If a pi or something else, how is that signal getting to the roboRIO?
    What language and libraries are you using?
  • Have you tried the simplevision or intermediatevision examples?
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #3   Spotlight this post!  
Unread 13-02-2015, 12:05
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,533
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Camera Lag

Likewise, the MS camera has been extremely responsive for us. There's a delay like you would expect - 100-200 ms.
Reply With Quote
  #4   Spotlight this post!  
Unread 13-02-2015, 13:19
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,752
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: Camera Lag

What are the camera settings and dashboard settings? What bandwidth does the dashboard report?

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 13-02-2015, 20:00
dash121 dash121 is offline
Registered User
FRC #4085
 
Join Date: Oct 2014
Location: Reynoldsburg Ohio
Posts: 23
dash121 is an unknown quantity at this point
Re: Camera Lag

Code:
CameraServer.getInstance().setQuality(50);
    	CameraServer.getInstance().startAutomaticCapture("cam0");
This is our code.. We had to get it down to 1/100 and there was still a full second of lag. We do have alot going through our robot and the Lifecam caused wayy too much lag so much to the point where we could not drive our robot. Our team is pulling off the camera now is there any way to reduce the lag? It is put directly into the USB port.

THANKS!
Reply With Quote
  #6   Spotlight this post!  
Unread 13-02-2015, 20:12
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,752
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: Camera Lag

The vision white paper a few years included info on camera settings and how they affect the image and the size.

The summary is that compression will reduce the size of the image. It is hard to estimate the size of a compressed image, so some cameras also support a bandwidth limited option, but WPILib doesn't expose that since it is a bit advanced and not present on all cameras. The frame rate has a direct, linear relationship to the bandwidth needed. The size of the image determines how many pixels and each step down reduces the size by 4x.

So, if you give the rest of the settings of the camera, we can give better input. The default dashboard shows the fps or frames per second, and it shows the Mbps or Megabits per second. The selector allows you to change the major contributors to bandwidth usage. The LED gives a pretty good indication as to where you are regarding bandwidth usage.

A pretty good rule of thumb is that if you are not receiving as many frames as you request, that your devices will buffer the unread frames and that will cause lag.

Also, what is the CPU usage of the laptop and the roboRIO? If either are maxed out, they may introduce lag.

Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 13-02-2015, 20:31
dash121 dash121 is offline
Registered User
FRC #4085
 
Join Date: Oct 2014
Location: Reynoldsburg Ohio
Posts: 23
dash121 is an unknown quantity at this point
Re: Camera Lag

We lower the bandwith and get the FPS we request. Right now it is the lowest setting we can put it at 160x120 5FPS 30% compression. We should (in theory) have almost no lag. But we should not have the robot stop a full second after we let go of our joystick. Btw the CPU isn't maxed out and I don't know how to check the roboRIO processor.

Last edited by dash121 : 13-02-2015 at 20:34.
Reply With Quote
  #8   Spotlight this post!  
Unread 13-02-2015, 20:36
dash121 dash121 is offline
Registered User
FRC #4085
 
Join Date: Oct 2014
Location: Reynoldsburg Ohio
Posts: 23
dash121 is an unknown quantity at this point
Re: Camera Lag

We lower the bandwith and get the FPS we request. Right now it is the lowest setting we can put it at 160x120 5FPS 30% compression. We should (in theory) have almost no lag. But we should not have the robot stop a full second after we let go of our joystick. Btw the CPU isn't maxed out and I don't know how to check the roboRIO processor.
Reply With Quote
  #9   Spotlight this post!  
Unread 14-02-2015, 08:34
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,752
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: Camera Lag

The roboRIO processor usage is plotted on the chart tab on the right. It is the red line on the lower plot. This info is also logged and can be viewed after the fact using the log file viewer. The Logs... button will launch that for you.

Also, it sounds like you have robot lag, not camera lag like the original post.

Does this happen when the camera is disabled?

It may make the most sense for you to post some log files. You can open the log file viewer and scroll to the bottom and click on some of the logs for one that isn't mostly empty. Post a screenshot, or you can go to Users/public/documents/FRC/Log Files and access the actual files there.

Greg McKaskle
Reply With Quote
Reply


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 05:33.

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