diff --git a/ctre_sim/CANCoder vers. H - 01 - 0 - ext.dat b/ctre_sim/CANCoder vers. H - 01 - 0 - ext.dat new file mode 100644 index 0000000..60376a0 Binary files /dev/null and b/ctre_sim/CANCoder vers. H - 01 - 0 - ext.dat differ diff --git a/ctre_sim/CANCoder vers. H - 02 - 0 - ext.dat b/ctre_sim/CANCoder vers. H - 02 - 0 - ext.dat new file mode 100644 index 0000000..e1fd303 Binary files /dev/null and b/ctre_sim/CANCoder vers. H - 02 - 0 - ext.dat differ diff --git a/ctre_sim/CANCoder vers. H - 03 - 0 - ext.dat b/ctre_sim/CANCoder vers. H - 03 - 0 - ext.dat new file mode 100644 index 0000000..c328171 Binary files /dev/null and b/ctre_sim/CANCoder vers. H - 03 - 0 - ext.dat differ diff --git a/ctre_sim/CANCoder vers. H - 04 - 0 - ext.dat b/ctre_sim/CANCoder vers. H - 04 - 0 - ext.dat new file mode 100644 index 0000000..c8ec72c Binary files /dev/null and b/ctre_sim/CANCoder vers. H - 04 - 0 - ext.dat differ diff --git a/networktables.json b/networktables.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/networktables.json @@ -0,0 +1 @@ +[] diff --git a/simgui-ds.json b/simgui-ds.json new file mode 100644 index 0000000..73cc713 --- /dev/null +++ b/simgui-ds.json @@ -0,0 +1,92 @@ +{ + "keyboardJoysticks": [ + { + "axisConfig": [ + { + "decKey": 65, + "incKey": 68 + }, + { + "decKey": 87, + "incKey": 83 + }, + { + "decKey": 69, + "decayRate": 0.0, + "incKey": 82, + "keyRate": 0.009999999776482582 + } + ], + "axisCount": 3, + "buttonCount": 4, + "buttonKeys": [ + 90, + 88, + 67, + 86 + ], + "povConfig": [ + { + "key0": 328, + "key135": 323, + "key180": 322, + "key225": 321, + "key270": 324, + "key315": 327, + "key45": 329, + "key90": 326 + } + ], + "povCount": 1 + }, + { + "axisConfig": [ + { + "decKey": 74, + "incKey": 76 + }, + { + "decKey": 73, + "incKey": 75 + } + ], + "axisCount": 2, + "buttonCount": 4, + "buttonKeys": [ + 77, + 44, + 46, + 47 + ], + "povCount": 0 + }, + { + "axisConfig": [ + { + "decKey": 263, + "incKey": 262 + }, + { + "decKey": 265, + "incKey": 264 + } + ], + "axisCount": 2, + "buttonCount": 6, + "buttonKeys": [ + 260, + 268, + 266, + 261, + 269, + 267 + ], + "povCount": 0 + }, + { + "axisCount": 0, + "buttonCount": 0, + "povCount": 0 + } + ] +} diff --git a/simgui.json b/simgui.json new file mode 100644 index 0000000..a05f627 --- /dev/null +++ b/simgui.json @@ -0,0 +1,11 @@ +{ + "NTProvider": { + "types": { + "/FMSInfo": "FMSInfo", + "/SmartDashboard/SendableChooser[1]": "String Chooser" + } + }, + "NetworkTables Info": { + "visible": true + } +} diff --git a/src/main/java/com/stuypulse/robot/constants/Ports.java b/src/main/java/com/stuypulse/robot/constants/Ports.java index 1582115..50ea6a2 100644 --- a/src/main/java/com/stuypulse/robot/constants/Ports.java +++ b/src/main/java/com/stuypulse/robot/constants/Ports.java @@ -17,10 +17,10 @@ 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; + int TOP_RIGHT_LIMIT = 9; + int TOP_LEFT_LIMIT = 8; + int BOTTOM_RIGHT_LIMIT = 7; + int BOTTOM_LEFT_LIMIT = 6; } public interface Amper { @@ -29,6 +29,7 @@ public interface Amper { int ALIGNED_BUMP_SWITCH = 3; int LIFT_BOTTOM_LIMIT = 4; + int LIFT_TOP_LIMIT = 5; int AMP_IR = 2; } diff --git a/src/main/java/com/stuypulse/robot/subsystems/AmperTest.java b/src/main/java/com/stuypulse/robot/subsystems/AmperTest.java index 61e2e6a..6c60731 100644 --- a/src/main/java/com/stuypulse/robot/subsystems/AmperTest.java +++ b/src/main/java/com/stuypulse/robot/subsystems/AmperTest.java @@ -6,6 +6,7 @@ import com.stuypulse.robot.constants.Ports; import com.stuypulse.robot.constants.Settings; +import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.SubsystemBase; @@ -16,7 +17,9 @@ public class AmperTest extends SubsystemBase { private final RelativeEncoder liftEncoder; private final RelativeEncoder scoreEncoder; - + private final DigitalInput minSwitch; + private final DigitalInput maxSwitch; + private final DigitalInput ampIRSensor; public AmperTest(){ scoreMotor = new CANSparkMax(Ports.Amper.SCORE, MotorType.kBrushless); @@ -28,6 +31,10 @@ public AmperTest(){ liftEncoder.setPositionConversionFactor(Settings.AmperTest.Lift.Encoder.POSITION_CONVERSION); liftEncoder.setVelocityConversionFactor(Settings.AmperTest.Lift.Encoder.VELOCITY_CONVERSION); + + minSwitch = new DigitalInput(Ports.Amper.LIFT_BOTTOM_LIMIT); + maxSwitch = new DigitalInput(Ports.Amper.LIFT_TOP_LIMIT); + ampIRSensor = new DigitalInput(Ports.Amper.AMP_IR); } public void setAmperVoltage(double voltage){ @@ -46,12 +53,24 @@ public void stop(){ public double getScorePosition() { return scoreEncoder.getPosition(); } + public double getLiftPosition() { return liftEncoder.getPosition(); } + public double getLiftVelocity() { return liftEncoder.getVelocity(); } + + public boolean liftAtBottom() { + return !minSwitch.get(); + } + + public boolean liftAtTop() { + return !maxSwitch.get(); + } + + @Override public void periodic() { SmartDashboard.putNumber("Amper/Intake Speed", scoreMotor.get()); @@ -60,5 +79,8 @@ public void periodic() { SmartDashboard.putNumber("Amper/Lift Current", liftMotor.getOutputCurrent()); SmartDashboard.putNumber("Amper/Lift Position", liftEncoder.getPosition()); SmartDashboard.putNumber("Amper/Score Position", scoreEncoder.getPosition()); + SmartDashboard.putBoolean("Amper/Lift at Bottom", liftAtBottom()); + SmartDashboard.putBoolean("Amper/Lift at Top", liftAtTop()); + SmartDashboard.putBoolean("Amper/IR has note", !ampIRSensor.get()); } } diff --git a/src/main/java/com/stuypulse/robot/subsystems/ClimberTest.java b/src/main/java/com/stuypulse/robot/subsystems/ClimberTest.java index 6240a4c..bc99d91 100644 --- a/src/main/java/com/stuypulse/robot/subsystems/ClimberTest.java +++ b/src/main/java/com/stuypulse/robot/subsystems/ClimberTest.java @@ -3,6 +3,7 @@ import com.revrobotics.CANSparkMax; import com.revrobotics.RelativeEncoder; import com.revrobotics.CANSparkLowLevel.MotorType; +import com.stuypulse.robot.constants.Motors; import com.stuypulse.robot.constants.Ports; import com.stuypulse.robot.constants.Settings; @@ -28,6 +29,9 @@ public ClimberTest(){ rightEncoder.setVelocityConversionFactor(Settings.ClimberTest.Encoder.VELOCITY_CONVERSION); leftEncoder.setVelocityConversionFactor(Settings.ClimberTest.Encoder.VELOCITY_CONVERSION); + // Motors.Climber.LEFT_MOTOR.configure(leftMotor); + // Motors.Climber.RIGHT_MOTOR.configure(rightMotor); + } public void setLeftVoltage(double voltage){ leftMotor.set(voltage); diff --git a/src/main/java/com/stuypulse/robot/subsystems/swervetests/SwerveTest.java b/src/main/java/com/stuypulse/robot/subsystems/swervetests/SwerveTest.java index 135d280..849884b 100644 --- a/src/main/java/com/stuypulse/robot/subsystems/swervetests/SwerveTest.java +++ b/src/main/java/com/stuypulse/robot/subsystems/swervetests/SwerveTest.java @@ -8,23 +8,24 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; public class SwerveTest extends SubsystemBase{ -private final SwerveModuleTest[] modules; + private final SwerveModuleTest[] modules; -SendableChooser moduleChooser = new SendableChooser(); -public SwerveTest(SwerveModuleTest... modules) { + SendableChooser moduleChooser = new SendableChooser(); - new SwerveModuleTest("FrontRight", 10, 11, 1); - new SwerveModuleTest("FrontLeft", 12, 13, 2); - new SwerveModuleTest("BackLeft", 14, 15, 3); - new SwerveModuleTest("BackRight", 16, 17, 4); - - this.modules = modules; + public SwerveTest(SwerveModuleTest... modules) { + + new SwerveModuleTest("FrontRight", 10, 11, 1); + new SwerveModuleTest("FrontLeft", 12, 13, 2); + new SwerveModuleTest("BackLeft", 14, 15, 3); + new SwerveModuleTest("BackRight", 16, 17, 4); + + this.modules = modules; - for (var module : modules){ - moduleChooser.addOption(module.getID(), module); - } + for (var module : modules){ + moduleChooser.addOption(module.getID(), module); + } - SmartDashboard.putData(moduleChooser); + SmartDashboard.putData(moduleChooser); } public void setDriveVoltage(double voltage){ diff --git a/src/main/java/com/stuypulse/robot/subsystems/swervetests/module/SwerveModuleTest.java b/src/main/java/com/stuypulse/robot/subsystems/swervetests/module/SwerveModuleTest.java index 93c0bf0..927fc11 100644 --- a/src/main/java/com/stuypulse/robot/subsystems/swervetests/module/SwerveModuleTest.java +++ b/src/main/java/com/stuypulse/robot/subsystems/swervetests/module/SwerveModuleTest.java @@ -4,6 +4,7 @@ import com.revrobotics.CANSparkFlex; import com.revrobotics.CANSparkMax; import com.revrobotics.RelativeEncoder; +import com.stuypulse.robot.constants.Motors; import com.revrobotics.CANSparkLowLevel.MotorType; @@ -23,6 +24,9 @@ public SwerveModuleTest(String id, int driveID, int turnID, int encoderID) { turnEncoder = new CANcoder(encoderID); this.id = id; + + // Motors.Swerve.DRIVE_CONFIG.configure(driveMotor); + // Motors.Swerve.TURN_CONFIG.configure(turnMotor); } public void setTurnMotor(double voltage){