Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor existing WPILib commands to support suppliers #5302

Closed
AngleSideAngle opened this issue Apr 30, 2023 · 2 comments
Closed

Refactor existing WPILib commands to support suppliers #5302

AngleSideAngle opened this issue Apr 30, 2023 · 2 comments

Comments

@AngleSideAngle
Copy link
Contributor

Is your feature request related to a problem? Please describe.
It seems the best way to handle state at runtime with command factories is with suppliers being fed into commands. However, TrapezoidProfileCommand, for example, doesn't support this. This means it has to be wrapped in a DeferredCommand, leading to a lot of annoying complexity.

Describe the solution you'd like
I think the simplest solution to this issue is to replace state with suppliers in the various classes that need it. To continue supporting existing functionality, they could have alternate constructors that set the supplier to supply the arguments.

Also see #5150 for deferred commands, and the pitfall surrounding using ProxyCommand for this.

@Gold856
Copy link
Contributor

Gold856 commented Jul 30, 2023

What other commands need to be refactored to use suppliers? #5457 already did that for TrapezoidProfileCommand.

@AngleSideAngle
Copy link
Contributor Author

I forget exactly what my thought process was when I created this issue, but trapezoid profile command seems like the only command that needs it.

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

No branches or pull requests

2 participants