Our team coded a VI that was to be placed in the autonomus program. When it is run on it's own it works perfectly. However when we paste the code into the autonomus area it develops a mind of it's own - sometimes it works perfectly and sometimes it only works partially. What are we doing wrong?
Solved! Go to Solution.
First, the code looks okay and simple enough. I noticed that the motor constants are grayed out in your attachment...make sure they are solid. If this is happening often (and it isn't due to recent changes in the Schematic Editor) then I wonder if you are up to date on the LabVIEW patches needed to have a stable installation that will work for your FTC robotics. (confirm in the 'Help'-About' menu that you have LVLM f5, NXT Module f3, and MCT Toolkit f1)
Two additional considerations here:
(1) You say it worked perfectly 'outside' the autonomous loop. What approach were you using to run the program then? (ie. the program was deployed to the NXT and run by pressing the orange button; running the program from the computer as a computer target while connected to the NXT via bluetooth)
(2) I noticed in your code that you are using the 'speed' setting rather than the 'constant power' on the Move vi. This means that you have encoders on right? Encoders can misread, especially at higher speeds. This could explain the variability of performance. You might see if you can get the desired results using 'constant power' instead.
In closing, sometimes repeated running of a program will cause 'every other' instance to work - don't know why this happens. Just power cycle the NXT and the 12v when this happens.
I look forward to hearing from you soon.