Quote:
|
Originally Posted by NNSWIZ
I have a problem with my autonomous code. ...
|
The other comments that have been posted are correct. You're going to have problems if you use a while loop that way. Your code is being called from within the RC's own code, and that code has lots of other things to do. If those things don't get done in time, the RC will shut you down. You need to make sure that each call to your code completes quickly - it only gets about 26 ms to run.
The "if" version in the pseudocode is more in line with what you need. You'll probably also need a static variable to keep track of which state you are in - starting to turn, working on completing the turn, turn completed, starting to drive, driving, etc.
BTW - The compiler is complaining specifically because you are using a loop whose control statement uses variables whose values aren't being changed in the loop. It is not aware that you might be changing them in an interrupt routine. (That
is where they get updated, right?)