From c91b602801466d630e039f675ae7cae834b649b0 Mon Sep 17 00:00:00 2001 From: hahafoot Date: Wed, 31 Jan 2024 18:17:55 -0500 Subject: [PATCH] Made tests for everyhting excpet swerrve :3 Co-authored-by: naveed1117 Co-authored-by: Lapcas --- .../com/stuypulse/robot/constants/Motors.java | 29 +++++++++ .../com/stuypulse/robot/constants/Ports.java | 64 ++++++++++++++++++- .../stuypulse/robot/subsystems/AmperTest.java | 32 ++++++++++ .../robot/subsystems/ClimberTest.java | 35 ++++++++++ .../robot/subsystems/ConveyerTest.java | 35 ++++++++++ .../robot/subsystems/IntakeTest.java | 21 ++++++ .../robot/subsystems/ShooterTest.java | 32 ++++++++++ .../robot/subsystems/SwerveTest.java | 5 ++ 8 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/stuypulse/robot/subsystems/AmperTest.java create mode 100644 src/main/java/com/stuypulse/robot/subsystems/ClimberTest.java create mode 100644 src/main/java/com/stuypulse/robot/subsystems/ConveyerTest.java create mode 100644 src/main/java/com/stuypulse/robot/subsystems/IntakeTest.java create mode 100644 src/main/java/com/stuypulse/robot/subsystems/ShooterTest.java create mode 100644 src/main/java/com/stuypulse/robot/subsystems/SwerveTest.java diff --git a/src/main/java/com/stuypulse/robot/constants/Motors.java b/src/main/java/com/stuypulse/robot/constants/Motors.java index d27a433..62da038 100644 --- a/src/main/java/com/stuypulse/robot/constants/Motors.java +++ b/src/main/java/com/stuypulse/robot/constants/Motors.java @@ -23,13 +23,42 @@ public interface Motors { /** Classes to store all of the values a motor needs */ + public interface Amper { + CANSparkMaxConfig LIFT_MOTOR = new CANSparkMaxConfig(false, IdleMode.kBrake); + CANSparkMaxConfig SCORE_MOTOR = new CANSparkMaxConfig(false, IdleMode.kBrake); + } + + public interface Swerve { + public CANSparkMaxConfig DRIVE_CONFIG = new CANSparkMaxConfig(false, IdleMode.kBrake); + public CANSparkMaxConfig TURN_CONFIG = new CANSparkMaxConfig(false, IdleMode.kBrake); + } + + public interface Intake { + CANSparkMaxConfig MOTOR_CONFIG = new CANSparkMaxConfig(false, IdleMode.kBrake); + } + + public interface Shooter { + CANSparkMaxConfig LEFT_SHOOTER = new CANSparkMaxConfig(false,IdleMode.kCoast); + CANSparkMaxConfig RIGHT_SHOOTER = new CANSparkMaxConfig(false,IdleMode.kCoast); + } + + public interface Conveyor { + CANSparkMaxConfig GANDALF_MOTOR = new CANSparkMaxConfig(false, IdleMode.kBrake); + CANSparkMaxConfig SHOOTER_FEEDER_MOTOR = new CANSparkMaxConfig(false, IdleMode.kBrake); + } + public interface Climber { + CANSparkMaxConfig LEFT_MOTOR = new CANSparkMaxConfig(false, IdleMode.kBrake); + CANSparkMaxConfig RIGHT_MOTOR = new CANSparkMaxConfig(false, IdleMode.kBrake); + } public static class TalonSRXConfig { public final boolean INVERTED; public final NeutralMode NEUTRAL_MODE; public final int PEAK_CURRENT_LIMIT_AMPS; public final double OPEN_LOOP_RAMP_RATE; + + public TalonSRXConfig( boolean inverted, NeutralMode neutralMode, diff --git a/src/main/java/com/stuypulse/robot/constants/Ports.java b/src/main/java/com/stuypulse/robot/constants/Ports.java index 1a2106d..1582115 100644 --- a/src/main/java/com/stuypulse/robot/constants/Ports.java +++ b/src/main/java/com/stuypulse/robot/constants/Ports.java @@ -12,4 +12,66 @@ public interface Gamepad { int OPERATOR = 1; int DEBUGGER = 2; } -} + + public interface Climber { + int LEFT_MOTOR = 60; + int RIGHT_MOTOR = 61; + + int TOP_RIGHT_LIMIT = 8; + int TOP_LEFT_LIMIT = 7; + int BOTTOM_RIGHT_LIMIT = 6; + int BOTTOM_LEFT_LIMIT = 5; + } + + public interface Amper { + int SCORE = 31; + int LIFT = 30; + + int ALIGNED_BUMP_SWITCH = 3; + int LIFT_BOTTOM_LIMIT = 4; + int AMP_IR = 2; + } + + public interface Swerve { + public interface FrontRight { + int DRIVE = 10; + int TURN = 11; + int ENCODER = 1; + } + + public interface FrontLeft { + int DRIVE = 12; + int TURN = 13; + int ENCODER = 2; + } + + public interface BackLeft{ + int DRIVE = 14; + int TURN = 15; + int ENCODER = 3; + } + + public interface BackRight { + int DRIVE = 16; + int TURN = 17; + int ENCODER = 4; + } + } + + public interface Intake { + int MOTOR = 40; + int IR_SENSOR = 1; + } + + public interface Shooter { + int LEFT_MOTOR = 20; + int RIGHT_MOTOR = 21; + } + + public interface Conveyor { + int GANDALF = 50; + int FEEDER = 51; + + int IR_SENSOR = 0; + } +} \ No newline at end of file diff --git a/src/main/java/com/stuypulse/robot/subsystems/AmperTest.java b/src/main/java/com/stuypulse/robot/subsystems/AmperTest.java new file mode 100644 index 0000000..6897053 --- /dev/null +++ b/src/main/java/com/stuypulse/robot/subsystems/AmperTest.java @@ -0,0 +1,32 @@ +package com.stuypulse.robot.subsystems; + +import com.revrobotics.CANSparkMax; +import com.revrobotics.RelativeEncoder; +import com.revrobotics.CANSparkLowLevel.MotorType; +import com.stuypulse.robot.constants.Ports; + + +public class AmperTest { + private final CANSparkMax scoreMotor; + private final CANSparkMax liftMotor; + private final RelativeEncoder liftEncoder; + + public AmperTest(){ + scoreMotor = new CANSparkMax(Ports.Amper.SCORE, MotorType.kBrushless); + liftMotor = new CANSparkMax(Ports.Amper.LIFT, MotorType.kBrushless); + liftEncoder = liftMotor.getEncoder(); + } + + public void setAmperVoltage(double voltage){ + scoreMotor.set(voltage); + } + + public void setLiftVoltage(double voltage){ + liftMotor.set(voltage); + } + + public void stop(){ + scoreMotor.set(0); + liftMotor.set(0); + } +} diff --git a/src/main/java/com/stuypulse/robot/subsystems/ClimberTest.java b/src/main/java/com/stuypulse/robot/subsystems/ClimberTest.java new file mode 100644 index 0000000..567e376 --- /dev/null +++ b/src/main/java/com/stuypulse/robot/subsystems/ClimberTest.java @@ -0,0 +1,35 @@ +package com.stuypulse.robot.subsystems; + +import com.revrobotics.CANSparkMax; +import com.revrobotics.RelativeEncoder; +import com.revrobotics.CANSparkLowLevel.MotorType; +import com.stuypulse.robot.constants.Ports; + +public class ClimberTest{ + private final CANSparkMax leftMotor; + private final CANSparkMax rightMotor; + private final RelativeEncoder rightEncoder; + private final RelativeEncoder leftEncoder; + + public ClimberTest(){ + leftMotor = new CANSparkMax(Ports.Climber.LEFT_MOTOR, MotorType.kBrushless); + rightMotor = new CANSparkMax(Ports.Climber.RIGHT_MOTOR, MotorType.kBrushless); + + rightEncoder = rightMotor.getEncoder(); + leftEncoder = leftMotor.getEncoder(); + } + public void setLeftVoltage(double voltage){ + leftMotor.set(voltage); + } + public void setRightVoltage(double voltage){ + rightMotor.set(voltage); + } + + public void stop() { + leftMotor.set(0); + rightMotor.set(0); + } + +} + + diff --git a/src/main/java/com/stuypulse/robot/subsystems/ConveyerTest.java b/src/main/java/com/stuypulse/robot/subsystems/ConveyerTest.java new file mode 100644 index 0000000..f379e9d --- /dev/null +++ b/src/main/java/com/stuypulse/robot/subsystems/ConveyerTest.java @@ -0,0 +1,35 @@ +package com.stuypulse.robot.subsystems; + +import com.revrobotics.CANSparkMax; +import com.revrobotics.RelativeEncoder; +import com.revrobotics.CANSparkLowLevel.MotorType; +import com.stuypulse.robot.constants.Ports; + +public class ConveyerTest { + private final CANSparkMax gandalfMotor; + private final CANSparkMax shooterFeederMotor; + private final RelativeEncoder gandalfEncoder; + private final RelativeEncoder shooterFeederEncoder; + + public ConveyerTest(){ + gandalfMotor = new CANSparkMax(Ports.Conveyor.GANDALF, MotorType.kBrushless); + shooterFeederMotor = new CANSparkMax(Ports.Conveyor.FEEDER, MotorType.kBrushless); + + gandalfEncoder = gandalfMotor.getEncoder(); + shooterFeederEncoder = shooterFeederMotor.getEncoder(); + } + + public void setGandalfVoltage(double voltage){ + gandalfMotor.set(voltage); + } + + public void setShooterFeederVoltage(double voltage){ + shooterFeederMotor.set(voltage); + } + + public void stop(){ + gandalfMotor.set(0); + shooterFeederMotor.set(0); + } + +} \ No newline at end of file diff --git a/src/main/java/com/stuypulse/robot/subsystems/IntakeTest.java b/src/main/java/com/stuypulse/robot/subsystems/IntakeTest.java new file mode 100644 index 0000000..352641a --- /dev/null +++ b/src/main/java/com/stuypulse/robot/subsystems/IntakeTest.java @@ -0,0 +1,21 @@ +package com.stuypulse.robot.subsystems; + +import com.revrobotics.CANSparkMax; +import com.revrobotics.CANSparkLowLevel.MotorType; +import com.stuypulse.robot.constants.Ports; + +public class IntakeTest { + private final CANSparkMax motor; + + public IntakeTest() { + motor = new CANSparkMax(Ports.Intake.MOTOR, MotorType.kBrushless); + } + public void setIntakeVoltage(double voltage) { + motor.set(voltage); + } + + public void stop() { + motor.set(0); + } + +} \ No newline at end of file diff --git a/src/main/java/com/stuypulse/robot/subsystems/ShooterTest.java b/src/main/java/com/stuypulse/robot/subsystems/ShooterTest.java new file mode 100644 index 0000000..87b0984 --- /dev/null +++ b/src/main/java/com/stuypulse/robot/subsystems/ShooterTest.java @@ -0,0 +1,32 @@ +package com.stuypulse.robot.subsystems; + +import com.stuypulse.robot.constants.Ports; +import com.stuypulse.stuylib.network.SmartNumber; +import com.revrobotics.CANSparkMax; +import com.revrobotics.RelativeEncoder; +import com.revrobotics.CANSparkLowLevel.MotorType; + +public class ShooterTest { + private final CANSparkMax leftMotor; + private final CANSparkMax rightMotor; + + private final RelativeEncoder leftEncoder; + private final RelativeEncoder rightEncoder; + public ShooterTest() { + leftMotor = new CANSparkMax(Ports.Shooter.LEFT_MOTOR, MotorType.kBrushless); + rightMotor = new CANSparkMax(Ports.Shooter.RIGHT_MOTOR, MotorType.kBrushless); + } + + public void setRightVoltage(double voltage) { + rightMotor.set(voltage); + } + + public void setLeftVoltage(double voltage) { + leftMotor.set(voltage); + } + + public void stop() { + leftMotor.set(0); + rightMotor.set(0); + } +} \ No newline at end of file diff --git a/src/main/java/com/stuypulse/robot/subsystems/SwerveTest.java b/src/main/java/com/stuypulse/robot/subsystems/SwerveTest.java new file mode 100644 index 0000000..2ae6df0 --- /dev/null +++ b/src/main/java/com/stuypulse/robot/subsystems/SwerveTest.java @@ -0,0 +1,5 @@ +package com.stuypulse.robot.subsystems; + +public class SwerveTest { +//TODO modules then uh absolute encoders to test zero angles then ummmmmmm set voltage ^w^ +} \ No newline at end of file