[cmd3] Make Mechanism an interface (#8303)

Since there is no longer a requirement for Subsystems/Mechanisms to be
registered to the command scheduler via a register() call, Mechanism can
be changed to an interface instead to allow for more flexible
inheritance structures.

Specifically, this would allow compatibility with CTRE swerve (which
previously required implementing Subsystem so that it could extend
CTRE's base class).
This commit is contained in:
Daniel Chen
2026-05-18 20:30:12 -04:00
committed by GitHub
parent fa24446ce3
commit e35ca772fd
16 changed files with 123 additions and 116 deletions

View File

@@ -11,7 +11,7 @@ import org.wpilib.hardware.motor.PWMSparkMax;
import org.wpilib.hardware.rotation.Encoder;
import org.wpilib.util.sendable.SendableRegistry;
public class DriveSubsystem extends Mechanism {
public class DriveSubsystem implements Mechanism {
// The motors on the left side of the drive.
private final PWMSparkMax leftLeader = new PWMSparkMax(DriveConstants.kLeftMotor1Port);
private final PWMSparkMax leftFollower = new PWMSparkMax(DriveConstants.kLeftMotor2Port);

View File

@@ -14,7 +14,7 @@ import org.wpilib.hardware.pneumatic.DoubleSolenoid;
import org.wpilib.hardware.pneumatic.PneumaticsModuleType;
/** A hatch mechanism actuated by a single {@link org.wpilib.hardware.pneumatic.DoubleSolenoid}. */
public class HatchSubsystem extends Mechanism {
public class HatchSubsystem implements Mechanism {
private final DoubleSolenoid hatchSolenoid =
new DoubleSolenoid(
0,