|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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?
|
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
Re: Load file quicker
like its running twice as fast or so.
|
|
#7
|
|||||
|
|||||
|
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. Last edited by Mark McLeod : 09-03-2011 at 08:05. |
|
#8
|
|||
|
|||
|
Re: Load file quicker
I tried everything I could to make it run the same speed but I couldn't get it. In the end I made it so that autonomous enabled would run the same case as teleop enabled and start playback right away.
Thanks for all the help guys, it worked even better than I thought it would ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|