Skip to content

Better OpMode#156

Open
JIceberg wants to merge 7 commits intodevfrom
feat-better-opmode
Open

Better OpMode#156
JIceberg wants to merge 7 commits intodevfrom
feat-better-opmode

Conversation

@JIceberg
Copy link
Copy Markdown
Member

Better OpMode

Let's be real: OpMode is mediocre. With this, you can program in the basic init(), loop() style of OpMode without the drawbacks. The FTCLibOpMode has two GamepadEx objects and updates the button values each iteration so the user does not have to (it's taken care of in the backend). You can take a look at the sample OpModeSample.

What kind of change does this PR introduce?

  • Feature

Did this PR introduce a breaking change?

  • No

Please make sure your PR satisfies the requirements of the contributing page

@JIceberg JIceberg added feature New feature or request utils A feature or issue regarding an FTCLib utility labels Dec 21, 2020
@JIceberg JIceberg requested review from a team and litehed December 21, 2020 04:44
@JIceberg JIceberg self-assigned this Dec 21, 2020
@JIceberg JIceberg requested review from Jaiming724, JarnaChao09 and Lunerwalker2 and removed request for a team December 21, 2020 04:44
litehed
litehed previously approved these changes Dec 21, 2020
Copy link
Copy Markdown
Member

@litehed litehed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and I agree that this is definitely an improvement from OpMode. However, I am a bit confused as to why this is the only OpMode that takes care of the gamepad in the backend. Why wouldn't CommandOpMode do the same in that regard?

@JIceberg
Copy link
Copy Markdown
Member Author

Looks good, and I agree that this is definitely an improvement from OpMode. However, I am a bit confused as to why this is the only OpMode that takes care of the gamepad in the backend. Why wouldn't CommandOpMode do the same in that regard?

The CommandOpMode doesn't need to update the button values. Those calls strictly refer to the button readers map. Refer to #142.

Comment thread core/src/main/java/com/arcrobotics/ftclib/util/FTCLibOpMode.java Outdated
Comment thread core/src/main/java/com/arcrobotics/ftclib/util/FTCLibOpMode.java Outdated
waitForStart();

while (!isStopRequested() && opModeIsActive()) {
hubs.forEach(LynxModule::clearBulkCache);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to document this! Otherwise people are going to run clearBulkCache themselves.

Comment thread core/src/main/java/com/arcrobotics/ftclib/util/FTCLibOpMode.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request utils A feature or issue regarding an FTCLib utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants