Skip to content

Commit

Permalink
Made tests for everyhting excpet swerrve :3
Browse files Browse the repository at this point in the history
Co-authored-by: naveed1117 <[email protected]>
Co-authored-by: Lapcas <[email protected]>
  • Loading branch information
3 people committed Jan 31, 2024
1 parent 955b2a3 commit c91b602
Show file tree
Hide file tree
Showing 8 changed files with 252 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/main/java/com/stuypulse/robot/constants/Motors.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
64 changes: 63 additions & 1 deletion src/main/java/com/stuypulse/robot/constants/Ports.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
32 changes: 32 additions & 0 deletions src/main/java/com/stuypulse/robot/subsystems/AmperTest.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
35 changes: 35 additions & 0 deletions src/main/java/com/stuypulse/robot/subsystems/ClimberTest.java
Original file line number Diff line number Diff line change
@@ -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);
}

}


35 changes: 35 additions & 0 deletions src/main/java/com/stuypulse/robot/subsystems/ConveyerTest.java
Original file line number Diff line number Diff line change
@@ -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);
}

}
21 changes: 21 additions & 0 deletions src/main/java/com/stuypulse/robot/subsystems/IntakeTest.java
Original file line number Diff line number Diff line change
@@ -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);
}

}
32 changes: 32 additions & 0 deletions src/main/java/com/stuypulse/robot/subsystems/ShooterTest.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
5 changes: 5 additions & 0 deletions src/main/java/com/stuypulse/robot/subsystems/SwerveTest.java
Original file line number Diff line number Diff line change
@@ -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^
}

0 comments on commit c91b602

Please sign in to comment.