Desperately need help optimizing

We are a rookie team, we started with no knowledge of how to do labview (but figured most of it out eventually). We rushed through the six weeks frantically trying to get it to work, without regards for optimization due to time constraints. When we tested it, everything worked individually, except it was VERY laggy. It would work, then cut out, then work again and so on.

We need help optimizing this. We heard things about letting some of the operation happen on the laptop, but we have absolutely no idea how.

I’m willing to send the project to someone who is willing to help… We need it.

did you set waits in any while loops in periodic tasks? There are no loops in teleop I hope, right?

Have you been to your first competition yet? During practice/qualifying rounds, the staff at the event will let you know if you are having any packet loss. This would be caused most likely by the camera. The camera default frame rate is 30 fps and the may recommend changing it to 10 fps. Does it happen when you are tethered? If it does not, it’s probably packet loss across the WiFi.

The other option is what is running in periodictasks.vi. There are different times loops. If you are running something in a fast loop that doesn’t give enough control to other parts, maybe it could tie up the CPU.

In the driver station, there is a tab where you can view CPU and network utilization stats. Do you know if your CPU is running at close to 100%? I’ve read that lots of teams are running near 100% at time.

If you want to post your code, or pictures of the major code you edited, people will give feedback. You can also ask questions you may have had while writing the code related to performance.

Optimizing code mostly involves measuring it, finding the slowest stuff, or the stuff which is farthest from the time it should execute in, and fixing issues until the performance is what you want. There isn’t one problem or one solution.

Greg McKaskle

This. There’s a saying that 80% of execution time is spent on 20% of your code. The hard part is finding the 20%. To do that, you’ll have to go through your code with a fine toothed comb (metaphorically, that is) and try and make is as efficient as possible. Just make sure that all your loops are appropriately throttled, your code is error-free (handling errors in resource intensive), and that you generally have good coding styles. I also like In Place Element Structures, since they provide a good way to write to memory without wasting too much of it. There was also a really good post detailing some ways to reduce some CPU usage, which a lot of teams are struggling with this year.

If you look around the internet, you’ll find that NI is awesome (what else is new?) and has a few really helpful documents on optimizing your code.
http://zone.ni.com/devzone/cda/tut/p/id/3747
http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/vi_memory_usage/
https://decibel.ni.com/content/docs/DOC-15337
http://digital.ni.com/public.nsf/allkb/771AC793114A5CB986256CAB00079F57
http://zone.ni.com/devzone/cda/tut/p/id/11472

Just take some time to go through your code, watch memory/CPU usage closely (it’s displayed on the Driver Station ‘Charts’ tab), and do what you can to bring them down as much as possible.