View Single Post
  #1   Spotlight this post!  
Unread 01-02-2017, 09:31
flemdogmillion's Avatar
flemdogmillion flemdogmillion is offline
Programmer, Builder, Driver...
FRC #3007
 
Join Date: Nov 2016
Rookie Year: 2015
Location: Minnesota
Posts: 138
flemdogmillion will become famous soon enoughflemdogmillion will become famous soon enough
PSA: Enable Vision Race Condition

Just solved a really sneaky race condition last night, so I thought I would do something so other people don't fall in that trap and blame their vision slowness on "LabVIEW is slow."

In Robot Main.vi, there is a bit of code shown in the attached image that applies what is effectively a constant (an unwired control) to the global variable Enable Vision. You need to remove this bit of code if you are going to at all use this variable, say, to turn a ring LED on or off. If you do not, you can easily miss this, since you're "not supposed to edit Robot Main.vi." I certainly missed it.

This race condition is characterized by your vision code taking almost exactly 50 ms to loop every time, while it appears to take about 300 ms to update the result variables. As a result, it pretty much just looks like it's running slow.

Happy coding!
Attached Thumbnails
Click image for larger version

Name:	EnableVisionRace.PNG
Views:	48
Size:	2.1 KB
ID:	21671  
__________________
Team 4506: 2015-2016
Team 3007: 2017

Jack of all trades except C++ & Java
Reply With Quote