Go to Post I remember as a kid thinking how high a team number like 834 was. - Dancin103 [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-01-2009, 16:52
nickmagus's Avatar
nickmagus nickmagus is offline
Registered User
AKA: Nick Clayton
FRC #0008 (Paly Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Palo Alto, Califorinia
Posts: 56
nickmagus is an unknown quantity at this point
Send a message via AIM to nickmagus
Speed of axis camera

Has anyone else noticed that FindTwoColors() takes a really long time? I noticed the camera servo loop was running slowly so I tested the time FindTwoColors() takes and it is about .34 seconds. Thinking it might be a problem with my code, I ran their default code and FindTwoColors() still took .34 seconds. has anyone else encountered this problem?
Reply With Quote
  #2   Spotlight this post!  
Unread 18-01-2009, 16:56
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,753
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Speed of axis camera

If the example doesn't set the resolution, your camera could be set to 640x480. At that resolution, the decoding of the jpg, and the shear number of pixels to process will limit processing to something like four fps.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 18-01-2009, 17:06
gorillamonky gorillamonky is offline
Registered User
FRC #0696
 
Join Date: Jan 2009
Location: la canada
Posts: 33
gorillamonky is an unknown quantity at this point
Re: Speed of axis camera

Quote:
Originally Posted by Greg McKaskle View Post
If the example doesn't set the resolution, your camera could be set to 640x480. At that resolution, the decoding of the jpg, and the shear number of pixels to process will limit processing to something like four fps.

Greg McKaskle
agreed, your resolution can be bulcox and you will still find the colors, try setting your resolution to the lowest you can find.

you also don't need to find multiple colors, finding one is fine, however, you should find the two colors as one color if at all possible so you can differentiate between teams

ie, find the setting for red on top as one color, named rog
and the setting for green on top as one color, named gor
Reply With Quote
  #4   Spotlight this post!  
Unread 18-01-2009, 17:59
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: Speed of axis camera

Quote:
Originally Posted by Greg McKaskle View Post
If the example doesn't set the resolution, your camera could be set to 640x480. At that resolution, the decoding of the jpg, and the shear number of pixels to process will limit processing to something like four fps.

Greg McKaskle
By default the TwoColorDemo code sets it to 320*240 @ 15fps. You can change the FPS setting on line 100 of TwoColorDemo.cpp, and you can change the resolution at line 131 of TwoColorDemo.cpp.

The resolution choices are k640x480, k320x240, k160x120.

I also had the same issue. I haven't had time to experiment with resolution yet, but I suspect that it will help.
__________________
Eric Haskins KC9JVH

Last edited by EHaskins : 18-01-2009 at 18:02.
Reply With Quote
  #5   Spotlight this post!  
Unread 18-01-2009, 18:14
nickmagus's Avatar
nickmagus nickmagus is offline
Registered User
AKA: Nick Clayton
FRC #0008 (Paly Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Palo Alto, Califorinia
Posts: 56
nickmagus is an unknown quantity at this point
Send a message via AIM to nickmagus
Re: Speed of axis camera

I have already done some experimentation with the resolution. It significantly improves the speed of the loop (about 3.3 times faster which is about right since it has 1/4 as many pixels to look through) but the autonomous still only runs at 10 hz (not nearly fast enough). With some further experimentation i found that the frcColorThreshold() appears to be the slowest link. Threading is a possible solution but it seems that that would not help because threading cant increase the processor speed of the cRio. it might not speed up the camera but it would keep it from interfering with the rest of the code.
Reply With Quote
  #6   Spotlight this post!  
Unread 18-01-2009, 18:20
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,753
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Speed of axis camera

Good summary about threading. Many people fall for the -- more threads results in faster execution trap. Having the camera run at 10Hz may be reasonable, but you don't want it to slow everything else down. Give the tasks or threads a shot. It certainly helped the LV stuff to be in an independent loop.

Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 18-01-2009, 18:25
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Speed of axis camera

try setting the res to 160 by 120, and do processing at 15fps.

You can also do a bit of code modifying to only threshold one color, which would significantly increase speed.

what i would think about doing is thresholding one color, then doing the particle analysis, and then doing a linear search through all the returned particles;

if the color patch is big enough, search for the color from the original image that you would expect to be below the color patch (red on green, or green/red) using a 3 point match or more if necessary.

im pretty sure that would at least double the speed.


since thresholding seems to be the slowest operation, perhaps modifying the thresholding algorithm to optimize it for the cRIO's processor might yield some benefit (though it probably already is... and that would be sad)
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY

Last edited by Uberbots : 18-01-2009 at 18:29. Reason: ASM
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting Axis Camera Sauce Programming 8 18-01-2009 20:08
Model of Axis Camera Bochek CAD 2 18-01-2009 17:50
AXIS Camera nickmagus Programming 1 03-01-2009 20:06
Program Axis Camera in c++ excel2474 Programming 5 22-12-2008 17:14
axis camera - problem s0crates FRC Control System 11 16-12-2008 09:34


All times are GMT -5. The time now is 13:46.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi