Go to Post If an alternate is used, all four teams are equal members of the alliance. (Trophies, trips, bling, book tours, custody of the children etc.) - Btower [more]
Home
Go Back   Chief Delphi > Technical > Control System
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 28-01-2010, 19:57
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Slow Dashboard Images SOLUTION

After a long period of debugging for the Dashboard camera images, I found a solution to the slow images. The graphs on the far right side of the Dashboard slow down the camera images dramatically. I removed those graphs from the Dashboard exe and it now runs at near live speed. The copy of the Dashboard currently running on our Classmate is attached
Attached Files
File Type: zip Dashboard.zip (132.3 KB, 296 views)
Reply With Quote
  #2   Spotlight this post!  
Unread 01-02-2010, 07:34
synth3tk's Avatar
synth3tk synth3tk is offline
Volunteer / The Blue Alliance
AKA: David Thomas
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Ohio
Posts: 2,005
synth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond reputesynth3tk has a reputation beyond repute
Re: Slow Dashboard Images SOLUTION

Interesting. I'll load it up on ours today and see what happens.
__________________
Quote:
The difference between theory and application is that in theory, theory and application are the same; In application, they are not.
Reply With Quote
  #3   Spotlight this post!  
Unread 03-02-2010, 21:23
Ken Streeter's Avatar
Ken Streeter Ken Streeter is offline
Let the MAYHEM begin!
FRC #1519 (Mechanical Mayhem)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Team: Milford, NH; Me: Bedford, NH
Posts: 470
Ken Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond repute
Re: Slow Dashboard Images SOLUTION

Quote:
Originally Posted by Radical Pi View Post
After a long period of debugging for the Dashboard camera images, I found a solution to the slow images. ... The copy of the Dashboard currently running on our Classmate is attached
I must be missing the obvious, but how does one replace the original Dashboard functionality with the dashboard application in the attached file?
__________________
Ken Streeter - Team 1519 - Mechanical Mayhem (Milford Area Youth Homeschoolers Enriching Minds)
2015 NE District Winners with 195 & 2067, 125 & 1786, 230 & 4908, and 95 & 1307
2013 World Finalists & Archimedes Division Winners with 33 & 469
2013 & 2012 North Carolina Regional Winners with teams 435 & 4828 and 1311 & 2642
2011, 2010, 2006 Granite State Regional Winners with teams 175 & 176, 1073 & 1058, and 1276 & 133
Team 1519 Video Gallery - including Chairman's Video, and the infamous "Speed Racer!"
Reply With Quote
  #4   Spotlight this post!  
Unread 04-02-2010, 07:11
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: Slow Dashboard Images SOLUTION

After doing some profiling and testing the other day, I also have recommendations for video back to the dashboard.

If there is a big lag, ~5 seconds of lag, that is caused by a TCP backlog somewhere in the network from camera to cRIO to bridge to router to laptop. Clearly it could be happening anywhere a processor is bogged down, but the cases I was most easily able to reproduce was to set the camera to high frame rate, then run everything on one classmate so that it was fully bogged down. Using probes in LabVIEW I was able to see that the cRIO was sending images every 33ms over TCP, but the classmate was only displaying them every 100 ms or so. That means that the laptop TCP cache quickly fills with images and the lag builds to around five seconds with occasional jumps. To correct this BIG lag, do less on the cRIO. An upcoming driver station will assist in this as I found some UI things that could be sped up, but if you have other tools on the classmate and you look at the Task Manager and see the CPU fully loaded, that is the likely explanation for the lag.

As for the frame rate, it is highly affected by the jpeg image size being sent by the camera. Specifically, images larger than 16k in size are causing slow memory allocations, ~100ms, at various places in the WPI and development libraries. Below 16K, the allocations take much less time, ~5ms. By setting image compression on the camera you can see the effect.

To reproduce these results, turn off the continuous circle detection. For LV this means turning of the button on Robot Main. C and Java sample code do not do the detection until the button is pressed.

With the image size set to small 160x120, most any compression will achieve high frame rates, 20-30 Hz. The default of 5% is fine.

With medium image size, 320x240, the 5% image compression will result in a frame rate of around 8Hz at the classmate. Raising the compression to 20% should raise the frame rate dramatically as the image size falls below the 16K mark.

For large, 640x480, the compression number necessary to get the image size small enough is around 75%.

Similar numbers were seen to work for C++. Note that high compression numbers affect image quality, and this is not a linear affect. Allocations above 16K are all pretty slow, and below are all pretty fast. Plus, the camera will not and cannot produce images faster than 33ms, so super high compression will do nothing but distort the image. If you plan to use image processing to find ellipses, this will perform more reliably with low compression images. The numbers listed above should be a reasonable tradeoff of quality and speed, but feel free to experiment.

It may also be useful to enable and disable ellipse detection depending on the task being accomplished or on the mode of the match.

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 04-02-2010, 11:02
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,756
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Slow Dashboard Images SOLUTION

Quote:
Originally Posted by Ken Streeter View Post
I must be missing the obvious, but how does one replace the original Dashboard functionality with the dashboard application in the attached file?
One way is to copy the zipped files to C:\Program Files\FRC Dashboard

Another way is to put the files wherever you want and edit the file: C:\Documents and Settings\All Users\Documents\FRC DS Data Storage.ini
The line to edit will jump right out at you:
Code:
DashboardCmdLine=""C:\\Program Files\\FRC Dashboard\\Dashboard.exe""
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 04-02-2010 at 16:47.
Reply With Quote
  #6   Spotlight this post!  
Unread 04-02-2010, 15:16
Steve Warner Steve Warner is offline
Controls / Programming
FRC #0234 (Cyber Blue)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Indiana
Posts: 41
Steve Warner is an unknown quantity at this point
Re: Slow Dashboard Images SOLUTION

Thanks Greg, this is good information. We have been seeing slow loop times, probably in the 100ms range, but not understanding why. Is there a way to know for sure the size of the image received from the camera?
Reply With Quote
  #7   Spotlight this post!  
Unread 05-02-2010, 08:11
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: Slow Dashboard Images SOLUTION

In the dashboard display, just below the image, it lists the size, then the pixel the mouse is over, and finally the RGB of the pixel. That is commonly what I use.

Greg McKaskle
Reply With Quote
  #8   Spotlight this post!  
Unread 05-02-2010, 09:40
Steve Warner Steve Warner is offline
Controls / Programming
FRC #0234 (Cyber Blue)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Indiana
Posts: 41
Steve Warner is an unknown quantity at this point
Re: Slow Dashboard Images SOLUTION

I don't have the display in front of me but I think it shows the image size (160x120) not the 16K number that you referred to. Is there a way to see if we are above or below the 16K size? We changed to 160x120 and left the compression at 30% and it did run faster. We changed the compression to 5%, as you mentioned, and it slowed down again. It would be interesting to know the size being generated.
Reply With Quote
  #9   Spotlight this post!  
Unread 06-02-2010, 03:12
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Slow Dashboard Images SOLUTION

Quote:
Originally Posted by Steve Warner View Post
I don't have the display in front of me but I think it shows the image size (160x120) not the 16K number that you referred to. Is there a way to see if we are above or below the 16K size? We changed to 160x120 and left the compression at 30% and it did run faster. We changed the compression to 5%, as you mentioned, and it slowed down again. It would be interesting to know the size being generated.
If you dig into the get image VI in the dashboard, there is a size indicator. If you want to display it on the dashboard, you'll need to wire it out of each connector pane up to the top level.
Reply With Quote
  #10   Spotlight this post!  
Unread 06-02-2010, 07:52
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: Slow Dashboard Images SOLUTION

Ah. I misunderstood what size you wanted. The JPEG image size is the string size coming from the TCP read on the attachment. To find the VI, you can Ctl-F, change to text, click the checkbox at the bottom to include vi.lib VIs, and search for 1.0.0.0 or something similar.

As for the difference at 5%. I saw a pretty strong correlation to the 16K number using LV. Joe Hershberger saw less of a correlation using C++. I believe his numbers started dropping earlier, but didn't drop as fast. He and I were also running with a DS update which is still being tested and is not released. So, I'd pay less attention to the exact numbers and more to the fact that the image size, and thus the camera resolution and compression has a pretty big impact on frame rate back to the dashboard. A bigger impact than I'd thought.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	TCP JPG.png
Views:	106
Size:	40.5 KB
ID:	8529  

Last edited by Greg McKaskle : 06-02-2010 at 07:56.
Reply With Quote
  #11   Spotlight this post!  
Unread 08-02-2010, 15:44
Damaku250's Avatar
Damaku250 Damaku250 is offline
Electromechaneumatics guy
AKA: Craig Hoo
FRC #3161 (H.T. Tronic Titans)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: ON, Canada
Posts: 38
Damaku250 is an unknown quantity at this point
Re: Slow Dashboard Images SOLUTION

EDIT: Spoke too soon, nevermind
__________________

-Rookie All Star Award [WAT Regional 2010]
Electrical/Control systems, Mechanical and Pneumatics teams, Human player

Last edited by Damaku250 : 08-02-2010 at 16:02.
Reply With Quote
  #12   Spotlight this post!  
Unread 12-02-2010, 10:30
Steve Warner Steve Warner is offline
Controls / Programming
FRC #0234 (Cyber Blue)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Indiana
Posts: 41
Steve Warner is an unknown quantity at this point
Re: Slow Dashboard Images SOLUTION

This may seem like an odd question but does the size of the file change depending on the complexity of the image being processed. We had our C++ code running like it should, made a very simple change, like reading an analog value, and the processor suddenly slowed down. I was sending a printf to the console to check the analog value and I noticed it was slow and downloads started taking about 20 seconds instead of 4 or 5. I commented all of this out and it still runs slow. I remember when I first started last night the camera was pointed up toward the ceiling with very bright lights and a dark ceiling. A very simple image. At some point I moved the camera to look across the room which was a very busy image. Before I left last night I didn't think to aim it back at the ceiling to see if the system speeded up. I did check the camera config and it had not changed (160x120, 30 compression, 10 frames/sec). Is there another setting that I'm missing? Any ideas?
Reply With Quote
  #13   Spotlight this post!  
Unread 12-02-2010, 11:03
Steve Warner Steve Warner is offline
Controls / Programming
FRC #0234 (Cyber Blue)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Indiana
Posts: 41
Steve Warner is an unknown quantity at this point
Re: Slow Dashboard Images SOLUTION

I should also mention that we are using WPILib 4.0. We had a problem with 4.1 and have not tried 4.2 yet.
Reply With Quote
  #14   Spotlight this post!  
Unread 12-02-2010, 12:25
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Slow Dashboard Images SOLUTION

Quote:
Originally Posted by Steve Warner View Post
This may seem like an odd question but does the size of the file change depending on the complexity of the image being processed. We had our C++ code running like it should, made a very simple change, like reading an analog value, and the processor suddenly slowed down. I was sending a printf to the console to check the analog value and I noticed it was slow and downloads started taking about 20 seconds instead of 4 or 5. I commented all of this out and it still runs slow. I remember when I first started last night the camera was pointed up toward the ceiling with very bright lights and a dark ceiling. A very simple image. At some point I moved the camera to look across the room which was a very busy image. Before I left last night I didn't think to aim it back at the ceiling to see if the system speeded up. I did check the camera config and it had not changed (160x120, 30 compression, 10 frames/sec). Is there another setting that I'm missing? Any ideas?
The image size definitely changes with image complexity, but I would guess that's not the source of the slowdown. Perhaps you are getting a lot of particle detections that all need to be analyzed. Also, you should have your vision processing in an independent task, so as not to affect your robot control rates.

When you were seeing slow downloads, do you mean downloads of images or of new robot programs or what? If it was slow to run your code, you probably have some task that is chewing up the CPU and need to reboot your cRIO.

Another common source of slow downs is camera exposure. If you are shining a light directly into the lens, the camera can run full speed. If it's a dim scene, it can make the image stream significantly slower.

-Joe
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
Camera Solution ProgrammerMike7 Programming 12 02-02-2010 10:32
Labview Dashboard and updated IFI dashboard spec Joe Ross LabView and Data Acquisition 1 04-04-2006 02:04
the solution focus fanatic Chit-Chat 8 18-01-2006 15:36
How slow is too slow? Joe Ross Rules/Strategy 23 12-10-2004 20:23


All times are GMT -5. The time now is 00:21.

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