Sample Robot C++ Stuck in Auton?

I have heard that sample robot can run loops so tight it can choke off other processes, is it possible to be stuck in a while loop that would prevent exiting the loop and auton for teleop? The specific example was running a motor until an encoder value was reached, which never was due to the device being stuck. Robot wouldn’t exit auton, or do anything until the robot code was restarted. Any help appreciated!

It depends on the setup (iterative/command/timed/other), but it is possible for it to fail to exit the while loop and fail to hand over control of the drives for teleop.

You might want to consider implementing some sort of timeout on your while loop, for example (in C-esque pseudocode):


while(!(encoder==target) && (timeSinceStarted < timeOut))
{
   do auto routine;
   update(timeSinceStarted);
}

It might also be helpful to increase the tolerance on your loop exit condition and see if that makes any difference.

You could also add

&& IsAutonomous()

to that while loop condition so that it exits at the end of Autonomous.

Thanks!