Go to Post My nephew...loves FIRST. He wants to be an X-Cat but since he lives in Atlanta and that's a heck of a long commute for meetings I told him he probably should strive to be the next best thing: a CircuitRunner. - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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 25-12-2009, 08:48
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,751
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

Let me go over a few techniques for measuring stuff, because the probes and panels in RT are great for debugging, but not for conveying lag. In reality, they are recompressing and transmitting to PC, and then doing the display stuff over again.

To time a portion of a diagram, you note the time, do the diagram, take the time, subtract and display the time. Probably the easiest and most foolproof is to drop a sequence structure around the code you want to measure, add a frame to the beginning, drop in a millisecond time function. Add a frame after you code, drop in a get millisecond time again. Outside the sequence drop a subtract, and wire it up. Note that if you subtract backwards, you'll get values of ~4billion. You want new minus old. Anyway, right click and create an indicator. You may sometimes want to make a chart instead of an indicator so that you can see how consistent the measurement is, see what data or parameter causes it to rise and fall.

To time the camera lag, I needed an external trigger, so I used the LED on the cRIO. You can use one on another piece of HW if it is easier. I aimed that camera at the cRIO LED -- up real close. The LED is off, and in my code I take the time, turn the LED on, and loop getting and processing images until the camera reports that the LED is on. Note the time, then turn things off for awhile and repeat to get a statistical measure of the lag.

To determine if the LED is on in the image I was simply sampling the Green portion of a single pixel. About as simple as I could get. I also assumed that the lag for RT to turn the LED on was minimal. That meant most of what I was measuring was base camera related lag -- exposing the sensor, compressing the image, transmitting the image, cRIO reading the TCP, cRIO decoding the JPEG into an IMAQ image, and finally cRIO processing. I don't have all of the numbers in front of me, but the small and medium images were both about 60ms. Not bad considering that at 30fps, the camera only sends an image every 33. So depending on when the LED goes on relative to the exposure, it could easily be 33 ms on some samples becuase the LED was just barely missed by this frame, and another isn't due for 33ms. In others, you get lucky and the LED goes on just before a frame exposure begins.

Anyway, the other stuff that is pretty easy to measure within the lag I'm discussing is the cRIO stuff. The TCP reads are small, and the cRIO decode is around 7 or 8 ms for small size and around 22ms for medium size. It is 100ms for large.

Feel free to come up with other ways of measuring the lag of other parts of the process and please share. Maybe we can do something about some of them.

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Teleop Lag Xavier Brandall Programming 14 17-03-2009 18:21
[FTC]: Bluetooth lag? Nick 568 FIRST Tech Challenge 5 12-02-2009 07:49
Lag Much? Caldwell_D Technical Discussion 2 09-11-2008 11:46
Lag Issue bizarospooky Programming 7 08-02-2008 17:31
Lead-Lag Compensator eSouL Control System 0 13-08-2004 03:21


All times are GMT -5. The time now is 01:04.

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