Skip to content

Add Timed Action Util#171

Open
JIceberg wants to merge 7 commits intodevfrom
feat-timed-action
Open

Add Timed Action Util#171
JIceberg wants to merge 7 commits intodevfrom
feat-timed-action

Conversation

@JIceberg
Copy link
Copy Markdown
Member

@JIceberg JIceberg commented Jan 8, 2021

@JIceberg JIceberg added utils A feature or issue regarding an FTCLib utility new concept Adds an entirely new concept to FTCLib labels Jan 8, 2021
@JIceberg JIceberg linked an issue Jan 8, 2021 that may be closed by this pull request
@JIceberg JIceberg requested review from a team, Jaiming724, litehed and puravdatta-sudo and removed request for a team May 25, 2021 01:09
Copy link
Copy Markdown
Member

@puravdatta-sudo puravdatta-sudo 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.

@abidingabi
Copy link
Copy Markdown
Contributor

abidingabi commented May 25, 2021

What the symmetric parameter does is not explained; it definitely should be.

@JIceberg JIceberg added the not-in-scope This issue or PR is not within the scope of what FTCLib hopes to bring to FTC label May 25, 2021
* @param onEnd the action to run after the time period is up
* @param milliseconds the wait time
*/
public TimedAction(Runnable onRun, Runnable onEnd, double milliseconds) {
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.

Add a constructor that just has onRun and milisecond since I do not think many people will require both.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A lot of people use both for things like a flicker. Having just an onRun will not really do anything for them, I guess either? That's just the same as changing it. The goal here is to perform some action for milliseconds milliseconds and then perform some onEnd action.

flickerServo = new SimpleServo(hardwareMap, "flicker", 0, 270);
// for this example, 35 degrees is the resting position and 80 degrees is the flick out position
flicker = new TimedAction(
() -> flickerServo.turnToAngle(80),
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.

Replace one of the lambda with an anonymous class and explain how both of them work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new concept Adds an entirely new concept to FTCLib not-in-scope This issue or PR is not within the scope of what FTCLib hopes to bring to FTC utils A feature or issue regarding an FTCLib utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Easy Non-Blocking Replacement For Sleep/Wait

4 participants