Go to Post So please, think twice before you click that little button that says "reply". - Ken Leung [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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 07-03-2011, 22:47
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Load file quicker

My labview code has the robot loading an xml file that has been previously recorded for autonomous. There is about a 9sec lag to load a 5sec recording. Is there a way to have the robot load this file ahead of time or make it load faster?
Reply With Quote
  #2   Spotlight this post!  
Unread 07-03-2011, 22:52
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: Load file quicker

I doubt I will personally be of any help on this issue, but to get the best help possible from the guys here that really know their stuff I recommend you post either a screenshot or the VI for the code in question so they can see how you are currently loading the file.

No way to know if there is a faster way if they don't know what you are currently doing.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
Reply With Quote
  #3   Spotlight this post!  
Unread 07-03-2011, 23:06
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Load file quicker

Quote:
Originally Posted by Vikesrock View Post
I doubt I will personally be of any help on this issue, but to get the best help possible from the guys here that really know their stuff I recommend you post either a screenshot or the VI for the code in question so they can see how you are currently loading the file.

No way to know if there is a faster way if they don't know what you are currently doing.
Siggy, the same request was made in your previous thread. In addition to seeing the code, seeing the data file you are loading would help also, because there may be some features in it that would point to the problem.

Without seeing that, here are two stabs in the dark.

XML tends to be a "heavy" format. Is it faster if you save and load your data as another format, for example using the spreadsheet or measurement VIs?

It sounds like you are loading the data in autonomous independent. You could load the data in another place, such as begin or disabled, and then publish the data via a global variable to be read in autonomous independent.
Reply With Quote
  #4   Spotlight this post!  
Unread 07-03-2011, 23:53
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Re: Load file quicker

I have moved the load file vi into autonomous disabled, but there is still quite a bit of delay. Attached is my autonomous independent, load file, autoflex code, and a snapshot of where i'm loading the file. The 1st vi in the flat sequence structure of the snapshot just chooses the autonomous mode.
Click image for larger version

Name:	Capture.PNG
Views:	38
Size:	32.5 KB
ID:	10360
Autonomous Independent.vi
Load File.vi
XML AutoFlex.vi
Reply With Quote
  #5   Spotlight this post!  
Unread 08-03-2011, 07:58
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,752
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: Load file quicker

Thanks for posting the code. I still have several questions, and some comments about the way the code is written.

How much data is being written? File size and array size?
What is the typical delta between the points? I'm not sure that you really need to record at 50Hz, but that appears to be what you are doing. I suspect that 1/10th of that much data would still be a pretty good autonomous recording.

For the coding comments -- first off, I wouldn't put this into RobotMain at all. You can put it into the Disabled subVI instead, or you can put it into an independent loop, probably into periodic tasks. A few times a second, check a load or reload global or button on the panel and use the panel to show, perhaps even graph out the file that was loaded.

The Autonomous subVI has a loop with no sleeps. It spins as fast as possible waiting for the clock to pass up the retrieved timestamp. Perhaps you should instead, compute when the point is due, and sleep the loop by that amount. This will lower the CPU from guarantees 100% to far less.

The other comment about the code is that it uses far too many global and sequences. As an example, I've uploaded the load diagram written using wires to transfer the path and array. You can make the code correct with globals, but it is more difficult, and you will get burned by parallel updates or race conditions. Also, it is far less efficient than using wires.

You don't need to immediately stop using globals and sequences, they are a useful tool. But if you find yourself using them to pass data between frames of a sequence, try using a wire instead.

The code comments will improve your runtime performance somewhat, but my guess is that this is a large file and that the bulk of the time is spent loading it. Go ahead and measure that. Put a sequence around the load and the parse nodes and determine the time they take. This will be a cool tool for your team if you can get the implementation cleaned up a bit.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	CD diag pic.png
Views:	36
Size:	14.0 KB
ID:	10373  
Reply With Quote
  #6   Spotlight this post!  
Unread 08-03-2011, 09:46
jrz126 jrz126 is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Erie, PA
Posts: 12
jrz126 is an unknown quantity at this point
Re: Load file quicker

You may also want to reduce the number of inputs you are logging. That should cut down on the file size quite a bit.
Reply With Quote
  #7   Spotlight this post!  
Unread 08-03-2011, 18:19
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Re: Load file quicker

Thanks for all the help guys, I just took a lot of globals out of the program and also removed all the inputs I no longer needed (which is ALOT!). With as much useless data that I took out, I think it will load a lot quicker. Before I was recording 53 different inputs, now i'm at 19 and I could still remove a few more if necessary.

I'll be testing my code in about an hour, if I'm still not satisfied I'll see if I can find out how to write to a different format as Joe suggested.
Reply With Quote
  #8   Spotlight this post!  
Unread 08-03-2011, 23:24
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Re: Load file quicker

The code works now thanks to the changes you guys suggested, I never had to change the file type but I will definitely look into that in the off-season as it would be nice to have the program run without any noticeable delay at all. The one thing I noticed is that the program seemed to playback much faster in autonomous mode than it did in teleop mode (I have a mode to record it in teleop & play it back). Any ideas on what could be causing this?
Reply With Quote
  #9   Spotlight this post!  
Unread 08-03-2011, 23:58
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,752
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: Load file quicker

How much difference are you seeing? Are we talking about a small rounding error that accumulates, or something else?

Greg McKaskle
Reply With Quote
  #10   Spotlight this post!  
Unread 09-03-2011, 00:27
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Re: Load file quicker

like its running twice as fast or so.
Reply With Quote
  #11   Spotlight this post!  
Unread 09-03-2011, 07:45
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,833
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: Load file quicker

Could be your Teleop loop is slower than the 50Hz packet rate.
You might be dropping every other DS packet and your playback rate would appear half speed.

Check the timing of the Teleop loop with Greg's Elapsed Times.vi under Support Code in your Project Explorer window.
Drop one copy in Teleop and another in Autonomous to compare the speeds.
View the Elapsed Times front panel while running the code from your PC.

Then match the Autonomous loop to the times you're getting from Teleop.
I'd suggest using Wait Until Multiple to get the times. A simple Wait will lag just a tiny bit every loop.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 09-03-2011 at 08:05.
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


All times are GMT -5. The time now is 20:48.

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