From 065285cdd1f9c0d22144e43630d4604928848f9b Mon Sep 17 00:00:00 2001 From: theblindbandet Date: Sat, 15 Jan 2022 13:25:32 -0500 Subject: [PATCH 01/11] Add basic shooter class I don't actually really know what the actual specs of the shooter are. This was mostly made as a tutorial to git for the rest of the SPEC team. --- src/main/java/frc/robot/Shooter.java | 39 +++++ vendordeps/Phoenix.json | 214 +++++++++++++++++++++++++++ 2 files changed, 253 insertions(+) create mode 100644 src/main/java/frc/robot/Shooter.java create mode 100644 vendordeps/Phoenix.json diff --git a/src/main/java/frc/robot/Shooter.java b/src/main/java/frc/robot/Shooter.java new file mode 100644 index 0000000..992ebfa --- /dev/null +++ b/src/main/java/frc/robot/Shooter.java @@ -0,0 +1,39 @@ +package frc.robot; + +import com.ctre.phoenix.motorcontrol.ControlMode; +import com.ctre.phoenix.motorcontrol.NeutralMode; +import com.ctre.phoenix.motorcontrol.can.TalonFX; + +import frc.robot.logging.Loggable; +import frc.robot.logging.Logger; + +public class Shooter implements Loggable { + TalonFX shooterMotor; + public Shooter(TalonFX s) { + this.shooterMotor = s; + + this.shooterMotor.setNeutralMode(NeutralMode.Coast); + } + + public void setSpeed(double speed) { + this.shooterMotor.set(ControlMode.Velocity, speed); + } + + public void setPower(double power) { + this.shooterMotor.set(ControlMode.PercentOutput, power); + } + + public double getSpeed() { + return this.shooterMotor.getSelectedSensorVelocity(); + } + + @Override + public void setupLogging(Logger logger) { + logger.addAttribute("Shooter/speed"); + } + + @Override + public void log(Logger logger) { + logger.log("Shooter/speed", this.getSpeed()); + } +} diff --git a/vendordeps/Phoenix.json b/vendordeps/Phoenix.json new file mode 100644 index 0000000..87f03cb --- /dev/null +++ b/vendordeps/Phoenix.json @@ -0,0 +1,214 @@ +{ + "fileName": "Phoenix.json", + "name": "CTRE-Phoenix", + "version": "5.19.4", + "uuid": "ab676553-b602-441f-a38d-f1296eff6537", + "mavenUrls": [ + "https://devsite.ctr-electronics.com/maven/release/" + ], + "jsonUrl": "https://devsite.ctr-electronics.com/maven/release/com/ctre/phoenix/Phoenix-latest.json", + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-java", + "version": "5.19.4" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-java", + "version": "5.19.4" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.19.4", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "linuxathena" + ] + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.19.4", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "simTalonSRX", + "version": "5.19.4", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "simVictorSPX", + "version": "5.19.4", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-cpp", + "version": "5.19.4", + "libName": "CTRE_Phoenix_WPI", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-cpp", + "version": "5.19.4", + "libName": "CTRE_Phoenix", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.19.4", + "libName": "CTRE_PhoenixCCI", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena" + ] + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.19.4", + "libName": "CTRE_PhoenixCCISim", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "diagnostics", + "version": "5.19.4", + "libName": "CTRE_PhoenixDiagnostics", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "canutils", + "version": "5.19.4", + "libName": "CTRE_PhoenixCanutils", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "platform-sim", + "version": "5.19.4", + "libName": "CTRE_PhoenixPlatform", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "core", + "version": "5.19.4", + "libName": "CTRE_PhoenixCore", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "simTalonSRX", + "version": "5.19.4", + "libName": "CTRE_SimTalonSRX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "simVictorSPX", + "version": "5.19.4", + "libName": "CTRE_SimVictorSPX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxx86-64" + ] + } + ] +} \ No newline at end of file From d4a02b53b1c8b3441022d9c7f785bd4778ab571d Mon Sep 17 00:00:00 2001 From: kryllyxofficial01 Date: Mon, 17 Jan 2022 19:25:16 -0500 Subject: [PATCH 02/11] modified build --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index ec372dc..61c1c8c 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2022.1.1" + id "edu.wpi.first.GradleRIO" version "2022.2.1" } sourceCompatibility = JavaVersion.VERSION_11 From 3143bae35e2fe83cd4e72da327d880821e4f9bbb Mon Sep 17 00:00:00 2001 From: kryllyxofficial01 Date: Mon, 17 Jan 2022 19:30:14 -0500 Subject: [PATCH 03/11] updated settings --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6c45b19..0bf97ff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "java.configuration.updateBuildConfiguration": "interactive", + "java.configuration.updateBuildConfiguration": "disabled", "java.server.launchMode": "Standard", "files.exclude": { "**/.git": true, From 7b908b006e96ac6e234f6a12e5cc573eafd265cc Mon Sep 17 00:00:00 2001 From: - <> Date: Mon, 24 Jan 2022 19:26:12 -0500 Subject: [PATCH 04/11] ... --- .vscode/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 0bf97ff..d0011f7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ + { "java.configuration.updateBuildConfiguration": "disabled", "java.server.launchMode": "Standard", From 58c0640eab6a8a39fd8806270049cb858ea9fcfb Mon Sep 17 00:00:00 2001 From: kryllyxofficial01 Date: Sat, 29 Jan 2022 14:50:10 -0500 Subject: [PATCH 05/11] ... --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 97586a0..d66eeee 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # RA22_RobotCode -Red Alert's 2022 Robot Code +Red Alert's 2022 Robot Code \ No newline at end of file From d6a928bed66b42cde1a879cef604a10e97995761 Mon Sep 17 00:00:00 2001 From: - <> Date: Sat, 19 Feb 2022 09:20:00 -0500 Subject: [PATCH 06/11] change wpilib version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 61c1c8c..233cb25 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2022.2.1" + id "edu.wpi.first.GradleRIO" version "2022.3.1" } sourceCompatibility = JavaVersion.VERSION_11 From 10d67ceb7ccd9da55cecd16e50071073af0b7df7 Mon Sep 17 00:00:00 2001 From: - <> Date: Sat, 19 Feb 2022 09:52:12 -0500 Subject: [PATCH 07/11] change wpilib version --- build.gradle | 3 --- 1 file changed, 3 deletions(-) diff --git a/build.gradle b/build.gradle index 7b281d0..b3e805a 100644 --- a/build.gradle +++ b/build.gradle @@ -3,10 +3,7 @@ import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO plugins { id "java" id "edu.wpi.first.GradleRIO" version "2022.3.1" -<<<<<<< HEAD -======= id "jacoco" ->>>>>>> 42c25a79a204a17d51e941b2de70aab595873f71 } sourceCompatibility = JavaVersion.VERSION_11 From 27c7c7ebf7f6f43c19349f0360f054238dfebd13 Mon Sep 17 00:00:00 2001 From: kryllyxofficial01 Date: Mon, 28 Feb 2022 19:42:44 -0500 Subject: [PATCH 08/11] change wpilib version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b3e805a..104b058 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2022.3.1" + id "edu.wpi.first.GradleRIO" version "2022.4.1" id "jacoco" } From 15d4349ea7a88b2542cb06fa5e4081c0a9fe8839 Mon Sep 17 00:00:00 2001 From: GingerJake Date: Sat, 12 Mar 2022 14:21:03 -0500 Subject: [PATCH 09/11] Make class simpler to construct --- src/main/java/frc/robot/Shooter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/Shooter.java b/src/main/java/frc/robot/Shooter.java index 992ebfa..bb49f89 100644 --- a/src/main/java/frc/robot/Shooter.java +++ b/src/main/java/frc/robot/Shooter.java @@ -9,8 +9,8 @@ public class Shooter implements Loggable { TalonFX shooterMotor; - public Shooter(TalonFX s) { - this.shooterMotor = s; + public Shooter(int shooterID) { + this.shooterMotor = new TalonFX(shooterID); this.shooterMotor.setNeutralMode(NeutralMode.Coast); } From 630e8aa93b69ce3b60de9f69c9b76c354592552b Mon Sep 17 00:00:00 2001 From: GingerJake Date: Sat, 12 Mar 2022 14:21:37 -0500 Subject: [PATCH 10/11] Add Shooter initialization --- src/main/java/frc/robot/Robot.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java index 46bb8e8..1b78d65 100644 --- a/src/main/java/frc/robot/Robot.java +++ b/src/main/java/frc/robot/Robot.java @@ -29,12 +29,14 @@ public class Robot extends TimedRobot { DriveModule rightModule; LoggableController driver; LoggableController operator; + Shooter shooter; LoggablePowerDistribution pdp; LoggableCompressor compressor; boolean drivetrainEnabled = true; boolean tankDriveEnabled = true; + boolean shooterEnabled = true; private static final double DEADBAND_LIMIT = 0.01; private static final double SPEED_CAP = 0.6; @@ -78,6 +80,13 @@ public void robotInit() { } else { System.out.println("Drivetrain initialization disabled."); } + if (this.shooterEnabled) { + System.out.println("Initializing shooter..."); + shooter = new Shooter(6); + logger.addLoggable(shooter); + } else { + System.out.println("Shooter initialization disabled."); + } System.out.print("Initializing compressor..."); compressor = new LoggableCompressor(PneumaticsModuleType.REVPH); From 1a46ce6cdceb17903850b9dba8b872245dbb194a Mon Sep 17 00:00:00 2001 From: NotMePipe Date: Tue, 22 Mar 2022 19:33:37 -0400 Subject: [PATCH 11/11] Add Shooter TeleOp functionality (setSpeed broken) --- src/main/java/frc/robot/Robot.java | 3 +++ src/main/java/frc/robot/Shooter.java | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java index 1b78d65..0fbfb8c 100644 --- a/src/main/java/frc/robot/Robot.java +++ b/src/main/java/frc/robot/Robot.java @@ -143,6 +143,9 @@ public void teleopPeriodic() { leftModule.updateCurrent(); rightModule.updateCurrent(); } + if (this.shooterEnabled) { + shooter.setSpeed(driver.getRightTriggerAxis()); + } logger.log(); logger.writeLine(); diff --git a/src/main/java/frc/robot/Shooter.java b/src/main/java/frc/robot/Shooter.java index bb49f89..c3811a8 100644 --- a/src/main/java/frc/robot/Shooter.java +++ b/src/main/java/frc/robot/Shooter.java @@ -3,7 +3,6 @@ import com.ctre.phoenix.motorcontrol.ControlMode; import com.ctre.phoenix.motorcontrol.NeutralMode; import com.ctre.phoenix.motorcontrol.can.TalonFX; - import frc.robot.logging.Loggable; import frc.robot.logging.Logger; @@ -16,15 +15,15 @@ public Shooter(int shooterID) { } public void setSpeed(double speed) { - this.shooterMotor.set(ControlMode.Velocity, speed); + shooterMotor.set(ControlMode.Velocity, speed); } public void setPower(double power) { - this.shooterMotor.set(ControlMode.PercentOutput, power); + shooterMotor.set(ControlMode.PercentOutput, power); } public double getSpeed() { - return this.shooterMotor.getSelectedSensorVelocity(); + return shooterMotor.getSelectedSensorVelocity(); } @Override