|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: LabView/C++ equally capable?
There are a couple things that will affect frame rate. I'll cover the ones I remember, and then talk about why frame rate isn't necessarily that important.
Frame Rate: One obvious thing that can limit frame rate is the frame rate setting. Setting it to a low number will delay the request for the frame. Setting it too high will request the next as soon as one arrives and will go as fast as other factors allow. Another issue is the resolution. Each resolution change is a 4x pixels difference. 640x480 images are nearly 1MB bit and take 100ms simply to decompress. All processing will be about four times as expensive as the 320x240. The 320x240 images take about 22ms to decode, and this was the size I used for the examples. This was really just a built in performance handicap, and it is about 4x slower than the 160x120 image. The small image takes 8ms to decode and the processing will similarly be about four times faster. The next issue, which affects LV more than C++ is the setup of the camera. If you don't add the FRC, FRC account on the camera, it takes multiple requests for the cRIO to get an image from the camera. The driver doesn't know which account will work, so it goes through three of them in sequence. For performance, you'd like it to succeed on the first, the FRC, FRC one. The last issue has to do with various camera settings. The camera will lower the frame rate if it doesn't have enough light for a good exposure. The settings that affect this are the Exposure, Exposure Priority, and Brightness. The other things mentioned such as the width of the hue will not have a large affect on performance, but since they will produce more blobs in the mask to analyze, they will have some affect. Also, the Saturation and Luminance will have some affect as well, since any pixels that can be eliminated by Sat or Lum are cheaper than having to do the calculations for Hue. Again, I think these settings are secondary for performance. Performance isn't everything: This may be counter intuitive, but FPS isn't really super important. More important is the lag, or the latency. This is defined as the time between when something happens in the real world, and when the image processing can notice it. It may seem that higher FPS would fix this, but think about how the awards shows have a 10 second delay to allow the censors to block things that aren't supposed to be televised. They don't change the FPS to do this, instead they buffer the images. The places images can be buffered include in the camera TCP stack, the cRIO TCP stack, and in the user's program. To measure the latency, I used the LED on the front of the cRIO itself, but you can use one off of a digital card if you'd prefer. Turn the LED on, and time the amount of time it takes for vision to receive an image with the LED on. Because the camera exposure and the LED will be unsynchronized, you'll need to look at numerous measurements and do some statistics to see how things behave. When I measured this, both the 320x240 and 160x120 sizes had around 60ms of latency with the simplest processing I could have. Clearly this will go up as the processing becomes more complex. What this means is that everything the cRIO senses through the camera is really delayed by some amount based on the settings. For this year's processing, I think the amount was probably about 80ms. So by the time the cRIO "sees" something, it has already happened by about 80ms. Why is this important? In order to hit a moving target, you don't want to shoot where something is. You certainly don't want to shoot where it used to be. You want to shoot where it will be. If the ball traveled instantaneously, you'd want to estimate relative velocity and aim about 80ms ahead. Of course the orbit balls are anything but instantaneous flyers, and the further away the target is, the longer the flight time. I dont' have any measured numbers, and it probably depends quite a bit on the delivery mechanism. Anyway, the point is that a higher fps will give you a better estimate of the velocity, but will not allow you to ignore the latency issue. I actually don't have a measurement for latency using C++. It is possible that the numbers are very different. None of this performance related talk has anything to do with it seeing only one color or the other. Those are tuning issues. The camera has many different color settings for white balance, and lighting will change considerably from event to event. Tilting the target to and from the light will also affect the saturation quite a bit. The best way to deal with these is to capture images and take them into vision assistant where you can do a line profile or look at a mask and come to understand how these environmental changes will affect the values that the camera will give you. Then you can try different things out to have the camera behave better, mount the camera better, etc. I put some images up on flicker last year that demonstrate some of the issues. Greg McKaskle |
|
#2
|
||||
|
||||
|
Re: LabView/C++ equally capable?
Greg, thanks for the information. The regular day job got in the way again, finally got the camera set up and working again last night. What you say about latency vs. frame rate makes good sense. I'm a little stumped about how to measure it though. I can see it on the display when I move the camera but I'm not following what you said about using an LED to get timing. Did you just use a stopwatch?
Ivan |
|
#3
|
|||
|
|||
|
Re: LabView/C++ equally capable?
I'll see if I can find the test code. It was basically pointing the camera at the cRIO LEDs, the ones near the power and ethernet plugs. There is an RT function for controlling the LED, and I figured it was close to instantaneous compared to the camera, so I turned it off, and started the camera to acquiring.
At some point, I'd turn the LED on, record the time on the cRIO, then loop inspecting images until one showed up with the LED lit. To detect the LED being lit, I use the regular Camera Get which uncompresses the image, then I measured the intensity of a pixel over the LED. A that point, turn the LED back off, wait for things to settle, and do it over again. I decided to wait a random amount with the LED off. This gave me a pretty good statistical picture of the latency. It shows the minimum, the typical and the maximum time you could expect for a given camera setup. Greg McKaskle |
|
#4
|
||||
|
||||
|
Re: LabView/C++ equally capable?
you know you can use Java right?
|
|
#5
|
|||||
|
|||||
|
Re: LabView/C++ equally capable?
Last year, you couldn't. The only data we have is from last year (other than beta test data from this year). Therefore, we have to make this comparison until such time as Java camera code becomes available through some means.
|
|
#6
|
||||
|
||||
|
Re: LabView/C++ equally capable?
that makes sense. we have no data from last year cuz all our programers graduated and didnt bother passing on their knowlege. so we gotta start from scratch. and we only know how to text program not visual so my team is gunna use java
|
|
#7
|
|||||
|
|||||
|
Re: LabView/C++ equally capable?
If you're starting from scratch, don't dismiss LabVIEW out of hand. For someone new to programming for FRC robots, I think it's a whole lot faster to learn.
|
|
#8
|
|||||
|
|||||
|
Re: LabView/C++ equally capable?
On the other hand, if they already know Java, it might be a whole lot faster to learn how to adapt it to robot programming. Ditto for C++.
|
|
#9
|
|||
|
|||
|
Re: LabView/C++ equally capable?
Not knowing how to do something is a poor excuse for not doing it. Give it a shot before you dismiss it. You might like it, you might hate it, but you'll be better off for having tried it.
|
|
#10
|
||||
|
||||
|
Re: LabView/C++ equally capable?
weve been trying to figure it out but we havent figured it out. we can make the computer make a random noise but thats about it.
were just gunna stick with robotc and labview. |
|
#11
|
||||
|
||||
|
Re: LabView/C++ equally capable?
Quote:
|
|
#12
|
|||
|
|||
|
Re: LabView/C++ equally capable?
The Axis 206 camera supports three resolutions. These three steps will be the best improvements overall. To get other sizes, you'll end up decimating or subsetting one of the larger sizes. This is still often worth it.
As for when resolution cuts are no longer worth it, in the real world, the nice cameras have an amazing flexibility with resolution, even to the point of having an image one pixel tall and X pixels wide. This may be useful when material is moving on a conveyer beneath the camera and you really only have time to process the new material. Greg McKaskle |
|
#13
|
||||
|
||||
|
Re: LabView/C++ equally capable?
oy... some of the sample programs for RobotC (specifically the servo testbed thing) arent working!!!! we have everything hooked up right but its not cooperating. do we need servos for the robot or can we go without them?
|
|
#14
|
|||||
|
|||||
|
Re: LabView/C++ equally capable?
Quote:
If you're trying to run a program to test servos, I'd imagine that servos would be an important part of the setup. |
|
#15
|
||||
|
||||
|
Re: LabView/C++ equally capable?
we were using a testbed set up thing (i dont have the papers with me to say what exactly it is) to help us learn how to start wiring servos and motors. the one with only the motor worked fine with the sample program provided. when we connected the servo (exactly as the instructions said) it didnt want to run and said there was an error.
any suggestions? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Labview 8.5 vs. FRC Labview 8.5 | pyr0b0y | NI LabVIEW | 0 | 01-02-2009 22:20 |
| Labview | tseres | Programming | 2 | 23-05-2007 00:27 |
| can bots with omni wheels capable of going up robots? | Tri_Lam | Technical Discussion | 12 | 13-01-2007 16:15 |
| Is this hardware capable of balance? | sanddrag | Electrical | 15 | 02-08-2005 15:36 |