Go to Post Welcome to ChiefDelphi a month before Kick-Off. This is an annual traditional experience for quite a few regulars. - synth3tk [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 Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 09-02-2010, 14:10
Zme Zme is offline
Registered User
FRC #2619
 
Join Date: Jan 2009
Location: Michigan
Posts: 83
Zme is on a distinguished road
Re: 2010 FRC camera vision tracking delay, image processing lag

i have done it, it worked out ok only problem is the other code ran a little to fast for it too keep up(was using the syncronized object and it took over the var's and never released them), you also have to be careful about data access still have a couple of the really ugly "Fatal Task Level Exceptions" i have yet to track down and kill with fire. i will see if i can get code up later on. please note that the documentation isn't exactly clear on this, the function that you want to make into a task must NOT be part of a class, or atleast in my experience it has gotten rather mad if it is. and also when you give it the function it is withOUT ()'s
here is code for spawning a new task: Task <name>("taskname",(FUNCPTR)(functionname));

don't do this:
Task <name>("taskname",(FUNCPTR)(functionname()));
Reply With Quote
  #2   Spotlight this post!  
Unread 09-02-2010, 14:13
Zme Zme is offline
Registered User
FRC #2619
 
Join Date: Jan 2009
Location: Michigan
Posts: 83
Zme is on a distinguished road
Re: 2010 FRC camera vision tracking delay, image processing lag

as for semaphore etc use a synchronized object, it makes thing rather easy to protect critical areas.
you do still have to declare a semaphore object though

Synchronized sync(<semaphore name>);
Reply With Quote
  #3   Spotlight this post!  
Unread 09-02-2010, 17:06
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,748
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: 2010 FRC camera vision tracking delay, image processing lag

I wasn't sure about C/C++ image processing. The LV code runs in an independent loop, its version of the task, and that seems to be the better way to go. No matter what you do, you will not get the image processing to run at 50Hz.

As for the performance in general, a white paper was posted on ni.com that discusses some tuning and performance issues. By the way, I suspect the arcs are drawn around the targets on the dashboard, not on the cRIO. At least that is the way it is done for LV.

If you have questions the white paper doesn't answer, fire away.

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 09-02-2010, 23:52
Zme Zme is offline
Registered User
FRC #2619
 
Join Date: Jan 2009
Location: Michigan
Posts: 83
Zme is on a distinguished road
Re: 2010 FRC camera vision tracking delay, image processing lag

that is a correct assumption, the dashboard draws the arcs.
I have a random question, is there a maximum number of tasks I can start on the cRIO before it freaks out?
Reply With Quote
  #5   Spotlight this post!  
Unread 10-02-2010, 01:03
pspeer's Avatar
pspeer pspeer is offline
Programming / Electronics
FRC #1730 (TeamDriven)
Team Role: Engineer
 
Join Date: Mar 2007
Rookie Year: 2006
Location: Lee's Summit, MO
Posts: 9
pspeer is an unknown quantity at this point
Re: 2010 FRC camera vision tracking delay, image processing lag

I've read that the maximum number of tasks is limited only by the amount of memory installed on the cRio. Since the cRio is running an embedded operating system, my guess is that very bad things happen once the memory is full.
Reply With Quote
  #6   Spotlight this post!  
Unread 10-02-2010, 02:26
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,748
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: 2010 FRC camera vision tracking delay, image processing lag

That would depend on the task being created. Each task allocates a stack and some other memory. My guess is that a hundred is fine and should be enough.
I'm pretty sure that LV allocates dozens.

If you have other needs, please post.
Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 10-02-2010, 08:50
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: 2010 FRC camera vision tracking delay, image processing lag

On the topic of multithreading, I've done lots of work with multiple threaded programs (both on Windows and VxWorks. Our robot last year ran on 5 different threads). It's not that hard once you get a good grip on how to use semaphores. Send me a PM and I'd be more than happy to help you.

On another note,

Quote:
Originally Posted by Greg McKaskle View Post
By the way, I suspect the arcs are drawn around the targets on the dashboard, not on the cRIO. At least that is the way it is done for LV.
So the dashboard automatically draws arcs on the targets? Do you need to provide additional information to the dashboard for this to happen?
__________________
Reply With Quote
  #8   Spotlight this post!  
Unread 10-02-2010, 10:06
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: 2010 FRC camera vision tracking delay, image processing lag

Quote:
Originally Posted by slavik262 View Post
So the dashboard automatically draws arcs on the targets? Do you need to provide additional information to the dashboard for this to happen?
If you look at the default dashboard program, there is a block at the top that uses the high priority packet to process vision information. It is responsible for displaying the current image and any overlays based on the target information in the packet.
Reply With Quote
  #9   Spotlight this post!  
Unread 10-02-2010, 11:09
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: 2010 FRC camera vision tracking delay, image processing lag

Quote:
Originally Posted by Dave Scheck View Post
If you look at the default dashboard program...
The robot code or the LabVIEW files for the dashboard itself?
__________________
Reply With Quote
  #10   Spotlight this post!  
Unread 10-02-2010, 11:40
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: 2010 FRC camera vision tracking delay, image processing lag

I was referring to the labview dashboard. The robot code needs to populate the packets to match what the dashboard side is expecting, otherwise you get the dreaded data type mismatch error when running the dashboard.

If you open up the default robot-side dashboard demo, you'll see where the vision data gets packed up (we use C++, but the Labview side does the same thing). If you compare that to the high priority packet format on the dashboard side, you'll see how it matches. You can then trace the wires up and to the right to get to the vision block to see how the overlay is done.
Reply With Quote
  #11   Spotlight this post!  
Unread 11-02-2010, 02:41
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,748
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: 2010 FRC camera vision tracking delay, image processing lag

You may already have what you need, but I was pretty sure the sample code for C++ and Java sent the data to the dashboard.

Greg McKaskle
Reply With Quote
  #12   Spotlight this post!  
Unread 11-02-2010, 10:21
pspeer's Avatar
pspeer pspeer is offline
Programming / Electronics
FRC #1730 (TeamDriven)
Team Role: Engineer
 
Join Date: Mar 2007
Rookie Year: 2006
Location: Lee's Summit, MO
Posts: 9
pspeer is an unknown quantity at this point
Re: 2010 FRC camera vision tracking delay, image processing lag

Our team is working with C++ using the WindRiver workbench (not labview) and data is already correctly sent back to the driverstation (data packing is not an issue).

Specifically our issue is the amout of time the tracking function takes to execute, we want it placed in it's own thread.


We need C++ help with:

(1) Creating a new VxWorks task
(to separate vision processing into its own task)

(2) Creating a shared global variable using semaphores
(to pass "target array" information back to the main OperatorControl loop)


Sorry for the confusion, I will post sample code later tonight to illustrate this concept.
Reply With Quote
  #13   Spotlight this post!  
Unread 11-02-2010, 11:52
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: 2010 FRC camera vision tracking delay, image processing lag

Since my explanation is pretty thorough and has little to do specifically with camera code, I've posted it here:

http://www.chiefdelphi.com/forums/sh...ad.php?t=82398

Share and enjoy.
__________________

Last edited by slavik262 : 11-02-2010 at 12:01.
Reply With Quote
  #14   Spotlight this post!  
Unread 18-02-2010, 06:56
charrisTTI charrisTTI is offline
Ramblin' Wreck
AKA: Charles Harris
FRC #0623
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Vienna, VA
Posts: 106
charrisTTI has a spectacular aura aboutcharrisTTI has a spectacular aura about
Send a message via AIM to charrisTTI
Re: 2010 FRC camera vision tracking delay, image processing lag

We are using latest udpates and programming in java. When testing tracking yesterday, we observed that the response time of the robot to the movement of the target got worse, the longer the program ran. After bootup, tracking response and image update were excellent. The more tracking cycles that were initiated, the worse the performance got; to the point where the robot would no longer track. On the drivers station we could see that the target was being tracked but with a significant delay as indicated by when the "locked on" circles were drawns around the target.
__________________
FRC 623 2003,2004,2005,2006,2007,2008, 2009, 2010, 2011
FRC 1900 2007
FVC 60 and 193 2006
FVC 3271 2007
FTC 226 and 369 2008, 2009, 2010, 2011
FTC 3806 2010
Reply With Quote
  #15   Spotlight this post!  
Unread 18-02-2010, 07:24
gvarndell's Avatar
gvarndell gvarndell is offline
Software Engineer
AKA: Addi's and Georgie's Dad
FRC #1629 (GaCo)
Team Role: Parent
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Grantsville, Maryland
Posts: 350
gvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond reputegvarndell has a reputation beyond repute
Re: 2010 FRC camera vision tracking delay, image processing lag

Quote:
Originally Posted by charrisTTI View Post
We are using latest udpates and programming in java.
Piggy-backing on an existing C++ thread, when you're using Java, even though the problem you're asking about is similar, is not likely to get you the help you need.
Consider posting to the Java sub-forum instead?
__________________
Robots never, ever, ever, ever break -- The Robot Repairman (Backyardigans)
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
2010 FRC Camera Live Feed Lag ideasrule Programming 23 11-02-2010 02:33
2010 Camera and vision problems. s133p Programming 76 08-02-2010 21:35
Vision Tracking Camera picking up too much... taoistconvert Programming 8 24-01-2010 22:19
[not-FIRST] Camera Image Processing Greg Marra Programming 11 11-03-2008 21:10


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

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