|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
Re: TrackTwoColors execution time
Another aspect that will effect the CPU loading is how often you are calling the TrackTwoColors() routine. The number of images per second that are retrieved from the camera is set at the StartCameraTask() call. Once you have a new image and process it once, if you keep calling TrackTwoColors() you will not only chew up CPU time, but you will keep getting the same answer back (you're checking the same image). If the camera task is a lower priority than the main task (I don't know) then the constant vision processing in the main loop may be backlogging the camera task. Regardless, it's a whole lot of useless CPU hogging.
We made a 'newImageAvailable()' function, which uses the GetImage() function (which returns a timestamp) to determine when a new image is available. So we only have to do our version of the TrackTwoColors() call once per new image. With a 160x120 image size, we easily do 15 frames per second. We could maybe do more but haven't tried. Steve C. |
|
#17
|
||||
|
||||
|
Re: TrackTwoColors execution time
Is there any way that we could see a sample of your newImageAvailable() function Kruuzr? I'm looking at the GetImage() function but I see it returning an int (1 for success and -1 for failure). Not the double timestamp.
Last edited by CardcaptorRLH85 : 16-02-2009 at 17:43. |
|
#18
|
|||
|
|||
|
Re: TrackTwoColors execution time
Quote:
I don't have the code in front of me, but I believe the two parameters for GetImage() are Image* and double*. It may get the image into your Image* param but it also puts the timestamp into your double. The code looks something like this: Image* image; // created using frcCreateImage() somewhere else bool newImageAvailable() { double timestamp; static double lastTimestamp = 0.0; GetImage( image, ×tamp ); if ( timestamp > lastTimestamp ) { lastTimestamp = timestamp; return true; } return false; } I may have missed something but I think that's it. Steve C. |
|
#19
|
||||
|
||||
|
Re: TrackTwoColors execution time
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Single button function execution | RonStoppable102 | Programming | 2 | 05-01-2007 09:45 |
| User Processor Execution Time | Andrew Blair | Programming | 1 | 12-02-2006 21:52 |
| Loop execution time for Autonomous code | Transporter08 | Programming | 2 | 13-02-2005 16:17 |
| How to measure execution time? And code size? | gnormhurst | Programming | 17 | 17-02-2004 08:06 |
| Actual execution time measurement | Dan | Technical Discussion | 5 | 24-03-2003 11:36 |