-
Notifications
You must be signed in to change notification settings - Fork 1k
LinearOpMode executing without starting #225
Comments
This sounds like a problem with your OpMode rather than with the SDK. I've looked at the changes in 5.4 and nothing was changed that would make me suspect the SDK is at fault. |
@OviedoRobotics Is your opmode on github someplace? |
In Autonomous, after calling waitForStart() you need to make sure stop wasn't pressed before you execute your autonomous code. I always put a " if (!isStopRequested()) {} " condition around all of my Auto code to make sure it doesn't even think about starting if I press stop before play. |
@gearsincorg That is one way to do it, though if you go that route I'd prefer simply returning from the function rather than wrapping your entire main auto in an "if" :) |
It's purely a personal preference. When I was learning to code (many years back, pre Java, pre C) I was taught to only have one exit point from a function. It stuck, and now it just helps me with diagnostics and other flow related debugging. Funny how some habits never die. |
This appears to be intermittent, but since updating to v5.4 we have seen several instances where we will initialize a LinearOpMode (our autonomous) and when we press stop (without having pressed start) the robot will execute a second of autonomous after waitForStart and stop. We had not seen this behavior with v5.3.
The text was updated successfully, but these errors were encountered: