Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

LinearOpMode executing without starting #225

Open
OviedoRobotics opened this issue Feb 5, 2020 · 5 comments
Open

LinearOpMode executing without starting #225

OviedoRobotics opened this issue Feb 5, 2020 · 5 comments

Comments

@OviedoRobotics
Copy link

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.

@Windwoes
Copy link
Member

Windwoes commented Feb 5, 2020

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.

@cmacfarl
Copy link
Member

cmacfarl commented Feb 5, 2020

@OviedoRobotics Is your opmode on github someplace?

@gearsincorg
Copy link

gearsincorg commented Feb 6, 2020

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.

@Windwoes
Copy link
Member

Windwoes commented Feb 6, 2020

@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" :)

@gearsincorg
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants