|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Image processing and performance
Hi everyone,
Currently, I've gotten my program to recognize the pink and green flags, but the image processing functions take a long time (about 1/4 a second or more). I'm using threads ("tasks" on the cRIO) for the different parts of our code, and there's currently 3 threads. I'm wondering if the threads are all getting 1/3 of the CPU, and so that's slowing down our code. Is that possible? If so, can I set the priority of some threads to be higher? I noticed in the constructor for the Task class that I can specify a priority (it defaults to 100). Is 1 the highest or 100? How can I set the priority of the thread which runs OperatorControl? Thanks, -Kevin |
|
#2
|
||||
|
||||
|
Re: Image processing and performance
Quote:
Quote:
The highest priority is 0 -- 255 is the lowest. Take my word for this, you don't want to use a priority higher than 51 for your robot tasks unless you know exactly what you're doing. Quote:
Just call the SetPriority method. I'm neither a C++ fan nor a C++ expert, so I can't tell you how to 'get' a task object for a task your didn't 'instantiate'. Note that you can create tasks and do whatever you like with them, in a less obfuscated way, by simply calling the vxWorks taskLib API. |
|
#3
|
|||
|
|||
|
Re: Image processing and performance
It is possible to set priority of a task, but you should be somewhat careful as a higher priority task that doesn't sleep may largely shut down lower priority tasks. A better approach is to look at the tasks and see which of them should be more efficient or sleep because it has nothing better to do.
Greg McKaskle |
|
#4
|
|||||
|
|||||
|
Re: Image processing and performance
Did you try reducing the resolution of the frame?
|
|
#5
|
|||
|
|||
|
Re: Image processing and performance
If you are using a class inherited from IterativeRobot, note that there is no built in delay, so it will use as much processing power as possible, the kernel splitting it equally with tasks of the same priority. To correct this, you can add a taskDelay() call in each of the XXXContinuous functions.
The delay should be long enough to cede as much processing power to other threads as possible without being so long that you are missing calls to the XXXPeriodic functions. (Assuming you are not using the XXXContinuous for anything time sensitive.) Make sure to include taskLib.h which declares this method. Here is some documentation on VxWorks tasks if you are interested in reading more. |
|
#6
|
|||
|
|||
|
Re: Image processing and performance
You also probably want to take a look at your vision processing system and see if anything can be sped up there. Using the lowest resolution at which you can still identify the target will be helpful, as well as using a nested structure for target identification(for example, only look for a pink flag if a suitable green flag has already been found)
|
|
#7
|
||||
|
||||
|
Re: Image processing and performance
Quote:
To enable round-robin scheduling, the user code needs to call kernelTimeSlice() and pass it a tick count. Those interested in knowing more about this stuff should use the Workbench HELP facility -- Help -> Help Contents. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [not-FIRST] Camera Image Processing | Greg Marra | Programming | 11 | 11-03-2008 21:10 |
| Image Processing on mouth ROI | tommy_chai | Programming | 0 | 20-11-2007 08:32 |
| thoughts about image processing | 3dude_2231 | Technical Discussion | 5 | 12-11-2007 13:26 |
| Critique my image processing program... | Salik Syed | Programming | 13 | 29-06-2006 16:57 |
| STAMP (Statistical Team Analysis of Match Performance) is off and running! | Ethulin | Scouting | 6 | 04-02-2006 23:12 |