Skip to content

Made methods non final, so we can override them - #93

Merged
spderman3333 merged 4 commits into
mainfrom
stefan/modify_MotorSubsystem
Oct 31, 2025
Merged

Made methods non final, so we can override them#93
spderman3333 merged 4 commits into
mainfrom
stefan/modify_MotorSubsystem

Conversation

@spderman3333

@spderman3333 spderman3333 commented Oct 28, 2025

Copy link
Copy Markdown
Member

We need them overridable for the arm code.
Mainly because we need to implement a way to move to an arm position based on what position we are currently.

if (given_position in current_position.safe_positions_to_move_to) { 
  move(given_position)
} else { dont_move() }

This could theoretically be achieved with a helper method checking the safety of a given position, but I would rather the setSetpoint() do this for the assurance that someone doesn't call setSetpoint() directly, skipping the safety check.

@spderman3333 spderman3333 self-assigned this Oct 28, 2025
Comment thread lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java Outdated
Comment thread lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java Outdated
@kcooney

kcooney commented Oct 30, 2025

Copy link
Copy Markdown
Contributor

We need them overridable for the arm code. Mainly because we need to implement a way to move to an arm position based on what position we are currently.

That sounds like a good use for delegation instead of inheritance. See https://github.com/Prospect-Robotics/offseason-robot-2025/pull/37 (it's a work in progress, but the idea is we would have a class that would have a reference to Elevator and Arm, and put the logic to handle them both there).

The safe positions are a function of two motors, so I don't quite see how changing this class helps you. I'm probably missing something (we didn't have too much time to chat today).

Given how little time we have, I suggest you copy this class into offseason-robot-2025 and make your changes there. I can work independently with @anonymes-axolotole on our approach, and we can compare what we built at the end of lab on Friday

@spderman3333
spderman3333 requested a review from kcooney October 31, 2025 04:35
@spderman3333
spderman3333 merged commit a820ca2 into main Oct 31, 2025
1 of 3 checks passed
@spderman3333
spderman3333 deleted the stefan/modify_MotorSubsystem branch October 31, 2025 05:12
kcooney added a commit that referenced this pull request Nov 7, 2025
@kcooney kcooney mentioned this pull request Nov 7, 2025
kcooney added a commit that referenced this pull request Dec 30, 2025
kcooney added a commit that referenced this pull request Jan 3, 2026
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
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.

3 participants