Log in

View Full Version : 2010 FRC Camera Live Feed Lag


ideasrule
24-01-2010, 19:32
We managed to get the live feed working, the only problem being that it isn't live. At first, with the camera set to low resolution and a moderate amount of compression, there was around 5 seconds of lag (and a similar frame rate). Then Patrick logged into the camera, did something, and the lag magically became 0.5 s with a 2Hz frame rate. The following conversation ensued:

Me: What did you do?
Patrick: I changed it to all the best settings. (640x480, 0 compression, etc)
Me: And then it worked.
Patrick: Right.

We tried everything to try and reduce the lag to something acceptable. Decreasing resolution and increasing compression both increased lag time, while changing the exposure/white balance settings did nothing. We did install the Labview update, the DS update, and all of that. We did create a FRC/FRC account. We did image the cRIO with v19.

Help!

DonRotolo
24-01-2010, 19:43
Reducing compression reduces load on the processor.
Smaller frame size means less data to fit through that (relatively) tiny pipeline
Fewer frames per second also means less data. 2 Hz is 2 frames per second, 1/2 second lag is the best you can get at that frame rate.

ideasrule
24-01-2010, 19:49
Smaller frame size means less data to fit through that (relatively) tiny pipeline

I thought so too, but decreasing frame size increased lag time.


Fewer frames per second also means less data. 2 Hz is 2 frames per second, 1/2 second lag is the best you can get at that frame rate.

I know that, but I want to both reduce lag and increase frame rate, not one or the other. (I didn't manually set the frame rate; I let the camera do that.)

Greg McKaskle
24-01-2010, 22:24
This is more lag that I'd expect. Can you describe how you are running the code and the DS? Can you describe the development tools?

Greg McKaskle

ideasrule
24-01-2010, 22:34
The DS is the Classmate, but tomorrow we'll try using another laptop as the DS and see how that works. As for development tools, we're using Java with Netbeans 6.8 on a separate laptop. I just press the "Run" button to run the code; as far as I know, that builds the project, deploys the code, reboots the cRIO, and listens for output from the cRIO.

Kingofl337
24-01-2010, 22:38
Try going to control panels, power options and set the laptop to "Always On". This will ensure the processor is running at 1.6GHz when plugged in. The factory pre-load has it set on Max Battery which causes reduced performance even when plugged in.

Greg McKaskle
24-01-2010, 23:16
It seemed as though some teams were fast user switching and leaving both accounts logged on. That seemed to cause pretty big lags for vision.

Greg McKaskle

ideasrule
25-01-2010, 13:56
OK, here's what I just tried:

Setting battery options to "Always On".
Running the driver station software under the Developer account.
Running the software with the Dashboard selected.
Logging on to only one account at a time.
Using a laptop as the driver station.
Setting the camera's frame rate to 5 frames/sec.

None of the above had an appreciable effect on the lag. Help!

TheDominis
25-01-2010, 14:00
OK, here's what I just tried:

Setting battery options to "Always On".
Running the driver station software under the Developer account.
Running the software with the Dashboard selected.
Logging on to only one account at a time.
Using a laptop as the driver station.
Setting the camera's frame rate to 5 frames/sec.

None of the above had an appreciable effect on the lag. Help!

Increase FPS? I don't know what you mean by lag. You are only going to get a new image every 200ms at that speed....

ideasrule
25-01-2010, 14:59
The problem is that I'm NOT getting one frame every 200 ms. I'm getting one frame every 500 ms. If I were getting 5fps, I'd be happy.

Patrickwhite
25-01-2010, 18:29
Well, we found *a* problem. We had been using the driver account on the ClassMate as the driver station, silly us, of course it's not designed for that exact purpose. When we logged off the driver account and switched to the developer account, the frame rate jumped up by a factor of ten or twenty (on 320x240 resolution), and the lag all but disappeared. What worries us now is we don't know whether this will be allowed at the competition (looked through the competition documents). Does anyone else have this problem and/or have a solution, or know if the Developer account will be allowed for use at the competition?

ideasrule
25-01-2010, 19:33
The story behind this is interesting. Patrick suggested using the developer account to test the camera feed. By chance, I was busy doing something and couldn't tell him he was being stupid because I'd already tried that (which I did). By chance, I had changed the image resolution from 640x480 to 320x240. Against all odds, these two unlikely events happened at the same time and led to our strange discovery. (I changed the resolution back to 640x480 and the lag time became the familiar 1/2 s.)

Another possibly useful piece of info is that I was using the code to test the frame rate by measuring the time it took to get 300 fresh images. We got 5 fps on 640x480, 21 fps on 320x240, and 30 fps on 160x120. However, the live feed was certainly not operating at 5 fps at a resolution of 640x480, regardless of the account used. It always operated at 2 fps.

Mr. Lim
25-01-2010, 22:06
We can confirm the behaviour that 610 is seeing. We get about 2 fps on the DS display, but there is a delay on top of that. The frames update at 2fps, but the frames we see are also more than 1s in the past. We notice this poor performance in the Driver account, even with 160x120 resolution frames.

Strangely, increasing the resolution does not seem to slow the framerates on the DS. In some cases the DS display updated faster on 640x480 than on 160x120.

However, the rate in which the cRIO processed the image was considerably faster with the small resolution.

jhersh
26-01-2010, 04:33
Is the lag and frame rate in your system impacted at all by running wired vs. wireless?

TheDominis
26-01-2010, 13:20
2 FPS is consistent with my benchmarks over in the C++ forums.

http://www.chiefdelphi.com/forums/showthread.php?t=80591

tutkows1
27-01-2010, 19:01
We are haveing the same problem also, are your saying a quick fix for this problem is to run the driverstation under the developer account?

dmlawrence
31-01-2010, 14:55
Same problem here as well

Radical Pi
31-01-2010, 17:26
I found the problem to be the graphs on the right side of the dashboard were causing a huge delay. I removed them and we now get near instant video (minus expected network latency). Our fixed dashboard is here http://www.chiefdelphi.com/forums/showthread.php?t=81378

Radical Pi
31-01-2010, 17:46
http://www.chiefdelphi.com/forums/showthread.php?t=81378

/\ is our solution. The graphs on the right side of the Dashboard were lagging the image considerably so we took them out of the Dashboard and the image is very fast now (only the expected network latency). The fixed Dashboard is attached

Damaku250
08-02-2010, 15:31
What do you guys mean by "logging into the camera?" Is it the Axis Camera setup? Or are we talking about logging in by navigating to its IP address (and what would that be if this is the case)?

ideasrule
08-02-2010, 22:18
What do you guys mean by "logging into the camera?" Is it the Axis Camera setup? Or are we talking about logging in by navigating to its IP address (and what would that be if this is the case)?

We're talking about connecting the camera to the computer via crossover cable, setting your computer's IP & subnet to 192.168.0.99 & 255.255.255.0, and typing http://192.168.0.90 into your browser. 192.168.0.90 is the camera's default IP address.

goodsky
09-02-2010, 09:44
I want to check to make sure that anybody having this issue has seen the latest update (this is for C/C++) that in the description says, "the camera code now is much more efficient with less copies and image buffer allocations in the library.The PC Video server (images back to the dashboard) are much faster now – it should in most cases run at the full camera rate. For image sizes of 320x240 the total lag should be around 0.5 seconds. Smaller images are lower."

If you are using windriver this might help out. I haven't seen an update like this for Labview or Java yet, although I haven't looked as hard.

Get the Updates from here: http://first.wpi.edu/FRC/frccupdates.html

cheesepuffgd
10-02-2010, 23:05
I have had that problem with the camera feed. We are using the lowest resolution, we are running it in the developer account with nothing else open. it is programmed in C++. Is there anything I can do about this?:eek: :eek: :eek: :eek: :eek:

Greg McKaskle
11-02-2010, 02:33
Are you using the new update for C++? The second issue that can cause lag is that the driver station is bogged down. You can check with the task manager.

Greg McKaskle