Quote:
Originally Posted by virtuald
Constructs such as this: Imagine a naive implementation of making an arm move:
Code:
while arm.isNotInPosition():
arm.moveToPosition()
As I'm sure you're aware, there are several obvious problems with this:
- The arm may never be in position (the sensor broke), so your robot keeps moving the arm and does nothing else
- The robot can't drive while this loop is executing
|
Oh, I agree completely there. I've taught my kids around the whole "while this button is pressed keep doing whatever that button does" thing already. Handling more complex scenarios (going to a position automatically on a single button press) isn't too difficult either (I personally don't feel, anyway.)
Quote:
|
In FRC there is no thread killing. If you never return from autonomous, you will never return from autonomous. Timer.delay only sleeps, it does no extra checking.
|
That is very good to know. I think that's currently my only real issue with SampleRobot, then. Easy to catch in Teleop, as you're going to be in a loop by definition, but requires throwing a lot of "did I get disabled?" in your code to be able to respond to getting disabled / end of autonomous quickly. Hmm.