|
| 1 | +// Copyright (c) 2025 FRC 6423 - Ward Melville Iron Patriots |
| 2 | +// https://github.com/wmironpatriots |
| 3 | +// |
| 4 | +// Open Source Software; you can modify and/or share it under the terms of |
| 5 | +// MIT license file in the root directory of this project |
| 6 | + |
| 7 | +package org.frc6423.robot.subsystems.superstructure; |
| 8 | + |
| 9 | +import edu.wpi.first.wpilibj2.command.Command; |
| 10 | +import java.util.function.DoubleSupplier; |
| 11 | +import org.frc6423.lib.subsystems.Roller; |
| 12 | +import org.frc6423.lib.subsystems.RollerIO; |
| 13 | +import org.frc6423.lib.subsystems.RollerIONeo; |
| 14 | +import org.frc6423.lib.subsystems.RollerIONone; |
| 15 | +import org.frc6423.robot.Robot; |
| 16 | + |
| 17 | +/** {@link Roller} subsystem representing the rollers on the chute */ |
| 18 | +public class Chute extends Roller { |
| 19 | + /** CONSTANTS */ |
| 20 | + public static final double MINIMUM_STALL_CURRENT_AMPS = 30.0; |
| 21 | + |
| 22 | + /** |
| 23 | + * @return fake {@link Chute} subsystem |
| 24 | + */ |
| 25 | + public static Chute none() { |
| 26 | + return new Chute(new RollerIONone()); |
| 27 | + } |
| 28 | + |
| 29 | + /** |
| 30 | + * Factory for creating a {@link Arm} subsystem |
| 31 | + * |
| 32 | + * @return {@link Arm} Subsystem |
| 33 | + */ |
| 34 | + public static Chute create() { |
| 35 | + if (Robot.isReal()) { |
| 36 | + return new Chute(new RollerIONeo()); |
| 37 | + } else { |
| 38 | + return new Chute(new RollerIONone()); |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + private Chute(RollerIO hardware) { |
| 43 | + super("ArmRoller", hardware); |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * @return true if roller motor is stalling |
| 48 | + */ |
| 49 | + public boolean isStalling() { |
| 50 | + return super.isStalling(MINIMUM_STALL_CURRENT_AMPS); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * Run roller at specified volts |
| 55 | + * |
| 56 | + * @param volts desired volts |
| 57 | + * @return {@link Command} |
| 58 | + */ |
| 59 | + public Command runVolts(DoubleSupplier volts) { |
| 60 | + return super.runVolts(volts); |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * Run roller at specified volts |
| 65 | + * |
| 66 | + * @param volts desired volts |
| 67 | + * @return {@link Command} |
| 68 | + */ |
| 69 | + public Command runVolts(double volts) { |
| 70 | + return super.runVolts(volts); |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * Run roller at specified speed |
| 75 | + * |
| 76 | + * @param speedRpm desired speed in revs per minute |
| 77 | + * @return {@link Command} |
| 78 | + */ |
| 79 | + public Command runSpeed(DoubleSupplier speedRpm) { |
| 80 | + return super.runSpeed(speedRpm); |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * Run roller at specified speed |
| 85 | + * |
| 86 | + * @param speedRpm desired speed in revs per minute |
| 87 | + * @return {@link Command} |
| 88 | + */ |
| 89 | + public Command runSpeed(double speedRpm) { |
| 90 | + return super.runSpeed(speedRpm); |
| 91 | + } |
| 92 | + |
| 93 | + /** |
| 94 | + * Hold roller at current speed |
| 95 | + * |
| 96 | + * @return {@link Command} |
| 97 | + */ |
| 98 | + public Command holdSpeed() { |
| 99 | + return super.holdSpeed(); |
| 100 | + } |
| 101 | +} |
0 commit comments