When I run my camera processing code under a test harness, the get camera.vi runs at around 12-25 ms. However, once I move it into the main code, it starts to run at around 70-100 ms (checked by placing get camera.vi inside a flat sequence, and measuring tick counts before and after its execution). I haven’t changed any camera settings, so that factor’s out of the question. And the vision processing vis in both my test harness and main code are identical, only the main code incorporates all our other autonomous, teleop, and dashboard code. What could possibly be slowing get camera.vi down?
I spent an afternoon tracking down something very similar only to discover that it was due to the lighting in the room. The camera defaults to using auto exposure, and I recommend you leave it on, but when there isn’t much light, the camera will lengthen the exposure of each frame and slow the frame rate.
I discovered this mainly because I was wearing a dark shirt.
If you point the camera up at the lights in the room and the timing returns to the original, that is it, and it shouldn’t bother you in a location with a reasonable amount of light on the targets.
If pointing it at the lights doesn’t fix it, it may be that you have lots of other things going on in parallel. Get.vi also decodes the JPG. That is a pretty lengthy operation, and if your CPU is loaded, it will take longer – 4x is believable. You probably want to look at parallel loops and make sure they have delays to throttle them. You can also use the System Manager to measure the CPU usage. Make sure to turn off the checkbox in the second tab for more reasonable numbers.
Greg McKaskle