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