Skip to content

Add isValidSetpoint() - #97

Closed
kcooney wants to merge 1 commit into
mainfrom
kcooney/is-valid-setpoint
Closed

Add isValidSetpoint()#97
kcooney wants to merge 1 commit into
mainfrom
kcooney/is-valid-setpoint

Conversation

@kcooney

@kcooney kcooney commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

This is a proposed extension point for the problem that motivated the changes in #93.

  • Define a documented extension point (isValidateSetpoint()) that allows subclasses
    to determine that a provided setpoint is invalid
  • Update setSetpoint() to document that it will do nothing if isValidateSetpoint()
    returns false

Note: I went with this change, instead of making setSetpoint() non-final, because
if subclasses could override setSetpoint() they could do almost anything (including
passing a different setpoint to super). These changes provide an API to allow the
actual need (discarding values that are determined at runtime to be invalid).

@kcooney
kcooney force-pushed the kcooney/is-valid-setpoint branch 3 times, most recently from e0f23ef to a03a26e Compare December 30, 2025 23:41
@kcooney
kcooney force-pushed the kcooney/revert-93 branch 2 times, most recently from 181c7e1 to 63f7396 Compare January 3, 2026 02:15
@kcooney
kcooney force-pushed the kcooney/is-valid-setpoint branch from a03a26e to f01e9ea Compare January 3, 2026 02:15
kcooney added a commit that referenced this pull request Jan 3, 2026
The change is no longer needed by the 2025 offseason robot code.

For a possible alternative, see #97
@kcooney
kcooney force-pushed the kcooney/is-valid-setpoint branch 2 times, most recently from c9cb46f to 2037fbd Compare January 4, 2026 05:28
@kcooney
kcooney changed the base branch from kcooney/revert-93 to main January 4, 2026 21:23
@kcooney
kcooney force-pushed the kcooney/is-valid-setpoint branch from 2037fbd to 93c599d Compare January 4, 2026 22:03
@kcooney
kcooney requested a review from spderman3333 January 4, 2026 22:14
@spderman3333

Copy link
Copy Markdown
Member

I'm not sure if this is really necessary, as couldn't this be implemented in the subclass.

@kcooney

kcooney commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

I'm not sure if this is really necessary, as couldn't this be implemented in the subclass.

@spderman3333 we reverted #93 since Le Prawn wasn't extending MotorSubsystem anymore.

@kcooney
kcooney force-pushed the kcooney/is-valid-setpoint branch from 93c599d to f76b6d4 Compare January 8, 2026 06:20
@kcooney kcooney changed the title Add isValidateSetpoint() Add isValidSetpoint() Jan 8, 2026
@kcooney
kcooney force-pushed the kcooney/is-valid-setpoint branch from f76b6d4 to a69e462 Compare January 8, 2026 06:24
@kcooney kcooney closed this Jan 14, 2026
@kcooney
kcooney deleted the kcooney/is-valid-setpoint branch January 15, 2026 02:22
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

Successfully merging this pull request may close these issues.

2 participants