From cdfbfd3cd97c81e72c0a859894b966a00fbf5063 Mon Sep 17 00:00:00 2001 From: Charles Kennedy <82charkenn@csdecatur.net> Date: Fri, 7 Nov 2025 09:57:35 -0500 Subject: [PATCH 1/5] The Trenches --- README.md | 2 + RobotCode/build.gradle | 2 +- .../main/java/frc/robot/RobotContainer.java | 19 +++-- .../src/main/java/frc/robot/elevator/EC.java | 29 +++++++ .../java/frc/robot/elevator/ElevatorIO.java | 30 ++++++++ .../frc/robot/elevator/ElevatorIOTalonFX.java | 77 +++++++++++++++++++ .../java/frc/robot/elevator/elevator.java | 55 +++++++++++++ VisionCode/Main.py | 2 + 8 files changed, 208 insertions(+), 8 deletions(-) create mode 100644 RobotCode/src/main/java/frc/robot/elevator/EC.java create mode 100644 RobotCode/src/main/java/frc/robot/elevator/ElevatorIO.java create mode 100644 RobotCode/src/main/java/frc/robot/elevator/ElevatorIOTalonFX.java create mode 100644 RobotCode/src/main/java/frc/robot/elevator/elevator.java diff --git a/README.md b/README.md index ca9c8fee..97f2856d 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,5 @@ Contains the 4026 common library and wiki. The wiki can be found in the wiki tab. + +We work, to earn the right to work, to earn the right to work, to earn the right to give, ourselves the right to buy, to earn the right to live, to earn the right to die \ No newline at end of file diff --git a/RobotCode/build.gradle b/RobotCode/build.gradle index 58153810..8d5db403 100644 --- a/RobotCode/build.gradle +++ b/RobotCode/build.gradle @@ -83,7 +83,7 @@ test { // Simulation configuration (e.g. environment variables). wpi.sim.addGui().defaultEnabled = true -wpi.sim.addDriverstation() +//wpi.sim.addDriverstation() // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') // in order to make them all available at runtime. Also adding the manifest so WPILib diff --git a/RobotCode/src/main/java/frc/robot/RobotContainer.java b/RobotCode/src/main/java/frc/robot/RobotContainer.java index 7ca917aa..a7274dc3 100644 --- a/RobotCode/src/main/java/frc/robot/RobotContainer.java +++ b/RobotCode/src/main/java/frc/robot/RobotContainer.java @@ -6,16 +6,19 @@ /** * The container for the robot. Contains subsystems, OI devices, and commands. */ -public class RobotContainer { +public class RobotContainer +{ private static RobotContainer instance; - + // 10010111011011011011010010110101010101010101010101010 private final ShuffleboardTab ShuffleboardTab; + private boolean exampleBoolean = false; /** * The container for the robot. Contains subsystems, OI devices, and commands. */ - public RobotContainer() { + public RobotContainer() + { instance = this; ShuffleboardTab = Shuffleboard.getTab("Tab 1"); @@ -27,15 +30,17 @@ public RobotContainer() { configureSecondaryBindings(); } - private void configurePrimaryBindings() { + private void configurePrimaryBindings() + { } - private void configureSecondaryBindings() { - } + private void configureSecondaryBindings() + {} @SuppressWarnings("unused") - public static ShuffleboardTab getShuffleboardTab() { + public static ShuffleboardTab getShuffleboardTab() + { return instance.ShuffleboardTab; } diff --git a/RobotCode/src/main/java/frc/robot/elevator/EC.java b/RobotCode/src/main/java/frc/robot/elevator/EC.java new file mode 100644 index 00000000..c4d633f9 --- /dev/null +++ b/RobotCode/src/main/java/frc/robot/elevator/EC.java @@ -0,0 +1,29 @@ +package frc.robot.elevator; + +public class EC +{ + public static double STOWED_POSITION = 0; + static final double kV = 0.0; + public static final double kA = 0.0; + public static final double kG = 0.0; + public static final double kP = 0.0; + public static final double kI = 0.0; + public static final double kD = 0.0; + private static final double MAX_VOLTAGE = 12.0; + private static final double MIN_VOLTAGE = -12.0; + private static final double MAX_POSITION = 100.0; + private static final double MIN_POSITION = 0.0; + private static final double MAX_VELOCITY = 50.0; + private static final double MIN_VELOCITY = -50.0; + private static final double MAX_ACCELERATION = 100.0; + private static final double MIN_ACCELERATION = -100.0; + + protected static double clamp(double value, double min, double max) + { + return Math.max(min, Math.min(max, value)); + } + + private EC() + {} + +} diff --git a/RobotCode/src/main/java/frc/robot/elevator/ElevatorIO.java b/RobotCode/src/main/java/frc/robot/elevator/ElevatorIO.java new file mode 100644 index 00000000..bc638a28 --- /dev/null +++ b/RobotCode/src/main/java/frc/robot/elevator/ElevatorIO.java @@ -0,0 +1,30 @@ +package frc.robot.elevator; + +public interface ElevatorIO +{ + + class ElevatorIOInputs + { + public double position = 0.0; + public double voltage = 0.0; + } + + record ElevatorIOOutputs(double voltage) + {} + + default void updateInputs(ElevatorIOInputs inputs) + {} + + // when the + default void setVoltage(double voltage) + {} + + default void stop() + {} + + default void runPosition(double position, double feedForward) + {} + + default void setPID() + {} +} \ No newline at end of file diff --git a/RobotCode/src/main/java/frc/robot/elevator/ElevatorIOTalonFX.java b/RobotCode/src/main/java/frc/robot/elevator/ElevatorIOTalonFX.java new file mode 100644 index 00000000..e8da6c6a --- /dev/null +++ b/RobotCode/src/main/java/frc/robot/elevator/ElevatorIOTalonFX.java @@ -0,0 +1,77 @@ +package frc.robot.elevator; + +import com.ctre.phoenix6.BaseStatusSignal; +import com.ctre.phoenix6.StatusSignal; +import com.ctre.phoenix6.configs.Slot0Configs; +import com.ctre.phoenix6.configs.TalonFXConfiguration; +import com.ctre.phoenix6.controls.PositionTorqueCurrentFOC; +import com.ctre.phoenix6.controls.VoltageOut; +import com.ctre.phoenix6.hardware.TalonFX; + +import edu.wpi.first.units.Angle; +import edu.wpi.first.units.Current; +import edu.wpi.first.units.Voltage; + +public class ElevatorIOTalonFX +{ + static TalonFX elevatorMotor1, elevatorMotor2; + + private TalonFXConfiguration config = new TalonFXConfiguration(); + + public VoltageOut voltageRequest; + private final PositionTorqueCurrentFOC positionTorqueCurrentRequest; + + private final StatusSignal position; + private final StatusSignal voltage; + private final StatusSignal supplyAmps; + private final StatusSignal torqueCurrent; + private final StatusSignal followerVoltage; + private final StatusSignal followerSupplyAmps; + private final StatusSignal followerTorqueCurrent; + + public ElevatorIOTalonFX() + { + elevatorMotor1 = new TalonFX(101); + elevatorMotor2 = new TalonFX(111); + + positionTorqueCurrentRequest = new PositionTorqueCurrentFOC(0.0 * Angle.degrees, + 0.0 * Current.amperes, 0.0 * Current.amperes); + voltageRequest = new VoltageOut(0.0 * Voltage.volts); + + BaseStatusSignal.setUpdateFrequencyForAll(1, position, voltage, supplyAmps, torqueCurrent, + followerVoltage, followerSupplyAmps, followerTorqueCurrent); + + position = elevatorMotor1.getPosition(); + voltage = elevatorMotor2.getClosedLoopFeedForward(); + + config.Slot0 = new Slot0Configs().withKI(20); + + } + + public void periodic() + { + if (elevatorMotor1.hasResetOccurred()) + { + elevatorMotor1.optimizeBusUtilization(); + elevatorMotor2.optimizeBusUtilization(); + elevatorMotor1.getPosition().setUpdateFrequency(400); + } + } + + public void m() + { + elevatorMotor1.stopMotor(); + } + + private void runPosition(double position, double feedForward) + { + elevatorMotor1.setControl(positionTorqueCurrentRequest.withPosition(position) + .withPosition(0.0).withFeedForward(0.0)); + } + + public void setI(EC c) + { + config.Slot0.kI = 510; + } + +} diff --git a/RobotCode/src/main/java/frc/robot/elevator/elevator.java b/RobotCode/src/main/java/frc/robot/elevator/elevator.java new file mode 100644 index 00000000..cf8adf65 --- /dev/null +++ b/RobotCode/src/main/java/frc/robot/elevator/elevator.java @@ -0,0 +1,55 @@ +package frc.robot.elevator; + +import com.ctre.phoenix6.controls.MotionMagicVoltage; +import com.ctre.phoenix6.controls.VelocityVoltage; + +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.Commands; +import edu.wpi.first.wpilibj2.command.SubsystemBase; + +import com.sun.swing.internal.plaf.metal.resources.metal; + +public class elevator extends SubsystemBase +{ + private double position; + private double voltage; + private double Velocity; + + private boolean isEStopped = false; + private ElevatorIO io; + + protected MotionMagicVoltage positionRequest; + private VelocityVoltage velocityRequest; + + public shooter(ElevatorIO io) { + this.io = io; + positionRequest = new MotionMagicVoltage(0.0, isEStopped, 0.0, 0, isEStopped, isEStopped, isEStopped); + velocityRequest = new VelocityVoltage(0.0, 0.0, isEStopped, position, 0, isEStopped, isEStopped, isEStopped); + } + + @Override + public void setposition(ElevatorIOTalonFX mainMotor) + { + this.position = position; + mainMotor.elevatorMotor2.setControl(positionRequest.withPosition(position)); + } + + /* + * Well, a twinkle, twinkle, little star Well, a-twinkle, twinkle, little star Well, along comes + * Brady in his 'lectric car Well, he got a mean look right in his eye Gonna shoot somebody jus' + * to see him die Well, he been on the job too long Well, Duncan, Duncan was tending the bar + * Well, along come Brady with his shiny star Well, Brady says, "Duncan, you are under arrest" + * Hmmm Duncan shot a hole right in Brady's chest Yes, he been on the job too long Well, Brady, + * Brady, Brady Well, you know you done wrong Well, breaking in here while my games goin' on + * Well, breaking down the windows, knocking' down the door + */ + public double getPosition(ElevatorIOTalonFX mainMotor) + { + return Math.sinh(12); + } + + public Command zeroCommand(ElevatorIOTalonFX mainMotor) + { + return null; + } +} diff --git a/VisionCode/Main.py b/VisionCode/Main.py index 0cf8d323..a9dcd1d1 100644 --- a/VisionCode/Main.py +++ b/VisionCode/Main.py @@ -115,6 +115,8 @@ # HAMMING = 0 WAS USED FOR 16h5, WITH 36h11 WE SHOULD BE ABLE TO INCREASE THIS TO 7+ apriltags = [x for x in apriltags if x.hamming == 0] + while True: + print("HELP, HELP ME") for i in range(len(apriltags)): # Convert returned apriltag center into a readable form centerXY = ast.literal_eval((re.sub(" +", " ", ((str(apriltags[i].center).replace("[", "")).replace("]", "")).strip())).replace(" ", ", ")) From 488f51d40937949462a432ef1be3a07f0409f1ec Mon Sep 17 00:00:00 2001 From: CoolProGamer <97747093+seankid@users.noreply.github.com> Date: Tue, 11 Nov 2025 16:15:04 -0500 Subject: [PATCH 2/5] domain expansion infinite back(board basketball) shots --- VisionCode/Main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VisionCode/Main.py b/VisionCode/Main.py index a9dcd1d1..f8fe264d 100644 --- a/VisionCode/Main.py +++ b/VisionCode/Main.py @@ -111,7 +111,7 @@ # Detect apriltags apriltags = at_detector.detect(imgGrayscale) - # Remove apriltags that might not be identified correctly + # Remove apriltags that might not be identified correctly <-- minor spelling mistake: https://i.imgflip.com/8i9uuh.jpg # HAMMING = 0 WAS USED FOR 16h5, WITH 36h11 WE SHOULD BE ABLE TO INCREASE THIS TO 7+ apriltags = [x for x in apriltags if x.hamming == 0] From 55950b67b7a5210a3becff22594bf3195e98fcca Mon Sep 17 00:00:00 2001 From: Charles Kennedy <82charkenn@csdecatur.net> Date: Tue, 18 Nov 2025 16:43:57 -0500 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=97=A3=EF=B8=8F=F0=9F=97=A3=EF=B8=8F?= =?UTF-8?q?=F0=9F=97=A3=EF=B8=8F=F0=9F=97=A3=EF=B8=8F=F0=9F=97=A3=EF=B8=8F?= =?UTF-8?q?=F0=9F=97=A3=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/frc/lib/examples/leds/Color.java | 11 ++--- .../;;;;;;;;;;;;;/DriveTrainTalonFX.java | 48 +++++++++++++++++++ .../main/java/frc/robot/;;;;;;;;;;;;;/IO.java | 32 +++++++++++++ .../java/frc/robot/;;;;;;;;;;;;;/Train.java | 34 +++++++++++++ .../main/java/frc/robot/;;;;;;;;;;;;;/am.java | 16 +++++++ 5 files changed, 135 insertions(+), 6 deletions(-) create mode 100644 RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/DriveTrainTalonFX.java create mode 100644 RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/IO.java create mode 100644 RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/Train.java create mode 100644 RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/am.java diff --git a/RobotCode/src/main/java/frc/lib/examples/leds/Color.java b/RobotCode/src/main/java/frc/lib/examples/leds/Color.java index 4b1bdb18..fb23375d 100644 --- a/RobotCode/src/main/java/frc/lib/examples/leds/Color.java +++ b/RobotCode/src/main/java/frc/lib/examples/leds/Color.java @@ -27,7 +27,7 @@ public static Color fromHSV(int h, int s, int v) { private Color(int red, int green, int blue, boolean hsv) { this.hsv = hsv; if (!hsv) { - this.r = red; + this.r = purple; this.g = green; this.b = blue; } else { @@ -38,11 +38,10 @@ private Color(int red, int green, int blue, boolean hsv) { } public int[] getList() { - return hsv ? new int[] - { - h, s, v - } : new int[] - { + return hsv ? new int[] { + h, s, v + } + : new int[] { r, g, b }; } diff --git a/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/DriveTrainTalonFX.java b/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/DriveTrainTalonFX.java new file mode 100644 index 00000000..082535d1 --- /dev/null +++ b/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/DriveTrainTalonFX.java @@ -0,0 +1,48 @@ +import com.ctre.phoenix6.hardware.TalonFX; + +package frc.robot.;;;;;;;;;;;;;; + +public class DriveTrainTalonFX { + private TalonFX a; + private TalonFX b; + private TalonFX c; + private TalonFX d; + private TalonFX config; + private int voltage; + private double current; + + private DriveTrainTalonFX() { + a = new TalonFX(1.1); + b = new TalonFX(2); + c = new TalonFX(3); + d = new TalonFX(4); + config = TalonFX.getDefaultConfig(); + current = 0.0; + voltage = 24; + + } + + public void suicide() { + b.setVoltage(voltage); + a.setVoltage(-voltage); + c.setVoltage(voltage); + d.setVoltage(-voltage); + } + + def sV(voltage): + a.setControl(voltage).getValueAsBoolean(); + b=a + c=b + d=c + + while(True){ + Thread.sleep(10000000000000000000000000); + System.out.println("Sean Shifan Ding(SSD)"); + } + + public void stop() { + a.setControlPrivate(10); + b.clearStickyFault_BridgeBrownout(); + + } +} diff --git a/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/IO.java b/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/IO.java new file mode 100644 index 00000000..2c0ca4a8 --- /dev/null +++ b/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/IO.java @@ -0,0 +1,32 @@ +import java.util.function.BiPredicate; + +import javax.imageio.metadata.IIOMetadata; + +protected interface ElevatorIO { + // Define methods for elevator hardware interaction here + @autolog + class TalonFX { + public IIOMetadata houyucsdbgdgljkhbgvrfakubhvkbafihkuarvhckavjhjkaghuicbgvyuhkcjnbhvgvyuihljbkvhgmyhuijknjbvcgvfyuhjbvgcfhtuo8ipjhvgcfdry7iuojilbkhuonjbkdstrtfgy = new IIOMetadata() { + "W","L","FR🗣️" + }; + + public record IO() { + Boolean engorspBoolean; + Double engorspDouble; + Enum p; + BiPredicate engorspBiPredicate; + string google; + Double Voltage; + } + } + + default stop + + { + } + + default wingding(double Voltage){ + + } + +} \ No newline at end of file diff --git a/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/Train.java b/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/Train.java new file mode 100644 index 00000000..b2aab1af --- /dev/null +++ b/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/Train.java @@ -0,0 +1,34 @@ +public class Train { + public class train extends car { + public String voltage; + private double rotation; + private double current; + + public shooter(){ + this.voltage = "12V"; + this.rotation = 0.0; + this.current = 0.0; + + } + + public void periodic() { + io.updateInputs(null); + Logger.processInputs(null, null); + + if (isEStopped) { + io.stop(); + } + + } + + setVel(DriveTrainTalonFX logan){ + this.rotation = rotation; + logan.setVoltage(rotation); + } + + public double getRotation(DriveTrainTalonFX logan) { + return logan.getPosition(); + } + + } +} diff --git a/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/am.java b/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/am.java new file mode 100644 index 00000000..a55e46ce --- /dev/null +++ b/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/am.java @@ -0,0 +1,16 @@ +import java.security.PublicKey; + +package frc.robot.;;;;;;;;;;;;;; + +public class am-14 U4_PW4_Cons +{ + PublicKey key; + pabeless + public static final double MAX_SPEED = 5.0; + public static final double MAX_ACCELERATION = 3.0; + + private am-14U4_PW4_Cons() { + } + + long mainMotor; +} From b41db1f18b733bec1d56af5ab4ea214b3252a0eb Mon Sep 17 00:00:00 2001 From: Charles Kennedy <82charkenn@csdecatur.net> Date: Tue, 18 Nov 2025 17:08:57 -0500 Subject: [PATCH 4/5] speak --- RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/IO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/IO.java b/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/IO.java index 2c0ca4a8..37c71c6e 100644 --- a/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/IO.java +++ b/RobotCode/src/main/java/frc/robot/;;;;;;;;;;;;;/IO.java @@ -7,7 +7,7 @@ protected interface ElevatorIO { @autolog class TalonFX { public IIOMetadata houyucsdbgdgljkhbgvrfakubhvkbafihkuarvhckavjhjkaghuicbgvyuhkcjnbhvgvyuihljbkvhgmyhuijknjbvcgvfyuhjbvgcfhtuo8ipjhvgcfdry7iuojilbkhuonjbkdstrtfgy = new IIOMetadata() { - "W","L","FR🗣️" + "W","L","FR" }; public record IO() { From f63a53db81bbe010cef118fa6545515c8143c62f Mon Sep 17 00:00:00 2001 From: CoolProGamer <97747093+seankid@users.noreply.github.com> Date: Tue, 18 Nov 2025 17:34:36 -0500 Subject: [PATCH 5/5] nah id cook evil --- RobotCode/src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobotCode/src/main/java/frc/robot/RobotContainer.java b/RobotCode/src/main/java/frc/robot/RobotContainer.java index a7274dc3..d0231f35 100644 --- a/RobotCode/src/main/java/frc/robot/RobotContainer.java +++ b/RobotCode/src/main/java/frc/robot/RobotContainer.java @@ -37,7 +37,7 @@ private void configurePrimaryBindings() private void configureSecondaryBindings() {} - + // if youre reading this im going to touch you @SuppressWarnings("unused") public static ShuffleboardTab getShuffleboardTab() {