From 050d8b8fbc1b31c3cc1b721cddd464cadf4a7bfd Mon Sep 17 00:00:00 2001 From: Cassidy Mark Date: Wed, 17 Jan 2024 18:32:58 -0800 Subject: [PATCH 1/9] Importing some phoenix stuff --- .../src/main/java/com/team2813/subsystems/Intake.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Robot2024/src/main/java/com/team2813/subsystems/Intake.java diff --git a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java new file mode 100644 index 0000000..2b51b48 --- /dev/null +++ b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java @@ -0,0 +1,8 @@ +package com.team2813.subsystems; + +import com.ctre.phoenix.motorcontrol.NeutralMode; +import com.ctre.phoenix.motorcontrol.TalonFXInvertType; + +import static com.team2813.Constants.*; +public class Intake { +} From ee806d522f538bf6025827889678eaceb616d3f6 Mon Sep 17 00:00:00 2001 From: Cassidy Mark Date: Thu, 18 Jan 2024 17:37:48 -0800 Subject: [PATCH 2/9] Changed version in build.gradle Co-Authored-By: cuttestkittensrule --- Robot2024/lib/build.gradle | 5 +++++ Robot2024/src/main/java/com/team2813/subsystems/Intake.java | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Robot2024/lib/build.gradle b/Robot2024/lib/build.gradle index edaa57c..7aad779 100644 --- a/Robot2024/lib/build.gradle +++ b/Robot2024/lib/build.gradle @@ -13,6 +13,11 @@ plugins { id 'maven-publish' } +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + tasks.withType(JavaCompile) { // Configure string concat to always inline compile options.compilerArgs.add '-XDstringConcat=inline' diff --git a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java index 2b51b48..7aff726 100644 --- a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java +++ b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java @@ -3,6 +3,10 @@ import com.ctre.phoenix.motorcontrol.NeutralMode; import com.ctre.phoenix.motorcontrol.TalonFXInvertType; +//import com.team2813.lib2813.control.motors; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; + import static com.team2813.Constants.*; -public class Intake { +public class Intake extends SubsystemBase { } From 680dda1980d2d4027ffaaeccd3f3358f5fafa753 Mon Sep 17 00:00:00 2001 From: Cassidy Mark Date: Thu, 18 Jan 2024 17:49:15 -0800 Subject: [PATCH 3/9] More set up stuff Had to copy over the IDs too. --- .../src/main/java/com/team2813/Constants.java | 8 + .../java/com/team2813/subsystems/Intake.java | 6 +- Robot2024/vendordeps/Phoenix5.json | 151 ++++++++ Robot2024/vendordeps/Phoenix6.json | 339 ++++++++++++++++++ 4 files changed, 503 insertions(+), 1 deletion(-) create mode 100644 Robot2024/vendordeps/Phoenix5.json create mode 100644 Robot2024/vendordeps/Phoenix6.json diff --git a/Robot2024/src/main/java/com/team2813/Constants.java b/Robot2024/src/main/java/com/team2813/Constants.java index 0bc2990..e8c58bb 100644 --- a/Robot2024/src/main/java/com/team2813/Constants.java +++ b/Robot2024/src/main/java/com/team2813/Constants.java @@ -16,4 +16,12 @@ public final class Constants { public static class OperatorConstants { public static final int kDriverControllerPort = 0; } + //Mechanism CAN IDs + public static final int INTAKE = 14; + public static final int LEFT_MAGAZINE = 15; + public static final int SHOOTER = 16; + public static final int SHOOTER_PIVOT= 17; + public static final int CLIMBER = 18; + public static final int RIGHT_MAGAZINE = 19; + public static final int INTAKE_PIVOT = 20; } diff --git a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java index 7aff726..c544aa1 100644 --- a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java +++ b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java @@ -3,10 +3,14 @@ import com.ctre.phoenix.motorcontrol.NeutralMode; import com.ctre.phoenix.motorcontrol.TalonFXInvertType; -//import com.team2813.lib2813.control.motors; +import com.team2813.lib2813.control.motors.TalonFXWrapper; import edu.wpi.first.wpilibj2.command.SubsystemBase; import static com.team2813.Constants.*; public class Intake extends SubsystemBase { + private final TalonFXWrapper intakeMotor = new TalonFXWrapper(INTAKE, TalonFXInvertType.Clockwise); + private final TalonFXWrapper pivotMotor = new TalonFXWrapper(INTAKE_PIVOT, TalonFXInvertType.CounterClockwise); } + + diff --git a/Robot2024/vendordeps/Phoenix5.json b/Robot2024/vendordeps/Phoenix5.json new file mode 100644 index 0000000..88a68dd --- /dev/null +++ b/Robot2024/vendordeps/Phoenix5.json @@ -0,0 +1,151 @@ +{ + "fileName": "Phoenix5.json", + "name": "CTRE-Phoenix (v5)", + "version": "5.33.0", + "frcYear": 2024, + "uuid": "ab676553-b602-441f-a38d-f1296eff6537", + "mavenUrls": [ + "https://maven.ctr-electronics.com/release/" + ], + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2024-latest.json", + "requires": [ + { + "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", + "errorMessage": "Phoenix 5 requires low-level libraries from Phoenix 6. Please add the Phoenix 6 vendordep before adding Phoenix 5.", + "offlineFileName": "Phoenix6.json", + "onlineUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2024-latest.json" + } + ], + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-java", + "version": "5.33.0" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-java", + "version": "5.33.0" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.33.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.33.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-cpp", + "version": "5.33.0", + "libName": "CTRE_Phoenix_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-cpp", + "version": "5.33.0", + "libName": "CTRE_Phoenix", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.33.0", + "libName": "CTRE_PhoenixCCI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "5.33.0", + "libName": "CTRE_Phoenix_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "api-cpp-sim", + "version": "5.33.0", + "libName": "CTRE_PhoenixSim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.33.0", + "libName": "CTRE_PhoenixCCISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ] +} \ No newline at end of file diff --git a/Robot2024/vendordeps/Phoenix6.json b/Robot2024/vendordeps/Phoenix6.json new file mode 100644 index 0000000..69a4079 --- /dev/null +++ b/Robot2024/vendordeps/Phoenix6.json @@ -0,0 +1,339 @@ +{ + "fileName": "Phoenix6.json", + "name": "CTRE-Phoenix (v6)", + "version": "24.1.0", + "frcYear": 2024, + "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", + "mavenUrls": [ + "https://maven.ctr-electronics.com/release/" + ], + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2024-latest.json", + "conflictsWith": [ + { + "uuid": "3fcf3402-e646-4fa6-971e-18afe8173b1a", + "errorMessage": "The combined Phoenix-6-And-5 vendordep is no longer supported. Please remove the vendordep and instead add both the latest Phoenix 6 vendordep and Phoenix 5 vendordep.", + "offlineFileName": "Phoenix6And5.json" + } + ], + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-java", + "version": "24.1.0" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "24.1.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "24.1.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "24.1.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonFX", + "version": "24.1.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "24.1.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "24.1.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "24.1.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "24.1.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "24.1.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "24.1.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-cpp", + "version": "24.1.0", + "libName": "CTRE_Phoenix6_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "24.1.0", + "libName": "CTRE_PhoenixTools", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "24.1.0", + "libName": "CTRE_Phoenix6_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "24.1.0", + "libName": "CTRE_PhoenixTools_Sim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "24.1.0", + "libName": "CTRE_SimTalonSRX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonFX", + "version": "24.1.0", + "libName": "CTRE_SimTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "24.1.0", + "libName": "CTRE_SimVictorSPX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "24.1.0", + "libName": "CTRE_SimPigeonIMU", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "24.1.0", + "libName": "CTRE_SimCANCoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "24.1.0", + "libName": "CTRE_SimProTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "24.1.0", + "libName": "CTRE_SimProCANcoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "24.1.0", + "libName": "CTRE_SimProPigeon2", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ] +} \ No newline at end of file From 38cd88c062407f3978206c135d3915dd3e759890 Mon Sep 17 00:00:00 2001 From: Cassidy Mark Date: Thu, 18 Jan 2024 17:56:37 -0800 Subject: [PATCH 4/9] More set up --- Robot2024/src/main/java/com/team2813/subsystems/Intake.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java index c544aa1..3939a3e 100644 --- a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java +++ b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java @@ -4,6 +4,7 @@ import com.ctre.phoenix.motorcontrol.TalonFXInvertType; import com.team2813.lib2813.control.motors.TalonFXWrapper; +import com.team2813.lib2813.control.ControlMode; import edu.wpi.first.wpilibj2.command.SubsystemBase; @@ -11,6 +12,10 @@ public class Intake extends SubsystemBase { private final TalonFXWrapper intakeMotor = new TalonFXWrapper(INTAKE, TalonFXInvertType.Clockwise); private final TalonFXWrapper pivotMotor = new TalonFXWrapper(INTAKE_PIVOT, TalonFXInvertType.CounterClockwise); + + public Intake() { + + } } From e45d88a060463b329cbf2237af6a0bd5354742c9 Mon Sep 17 00:00:00 2001 From: Cassidy Mark Date: Thu, 18 Jan 2024 18:03:17 -0800 Subject: [PATCH 5/9] Update directions --- Robot2024/src/main/java/com/team2813/subsystems/Intake.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java index 3939a3e..0429a46 100644 --- a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java +++ b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java @@ -10,7 +10,7 @@ import static com.team2813.Constants.*; public class Intake extends SubsystemBase { - private final TalonFXWrapper intakeMotor = new TalonFXWrapper(INTAKE, TalonFXInvertType.Clockwise); + private final TalonFXWrapper intakeMotor = new TalonFXWrapper(INTAKE, TalonFXInvertType.CounterClockwise); private final TalonFXWrapper pivotMotor = new TalonFXWrapper(INTAKE_PIVOT, TalonFXInvertType.CounterClockwise); public Intake() { From 90474b6b3eabbc99bbd08178e81e0feadddd4dbc Mon Sep 17 00:00:00 2001 From: Cassidy Mark Date: Mon, 22 Jan 2024 14:49:31 -0800 Subject: [PATCH 6/9] Intake and outtake Co-Authored-By: atlanticbomber <151278181+atlanticbomber@users.noreply.github.com> --- .../src/main/java/com/team2813/subsystems/Intake.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java index 0429a46..aa65187 100644 --- a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java +++ b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java @@ -16,6 +16,17 @@ public class Intake extends SubsystemBase { public Intake() { } + + public void intake() { + intakeMotor.set(ControlMode.DUTY_CYCLE, 0.5); + } + + public void outtake() { + intakeMotor.set(ControlMode.DUTY_CYCLE, -0.5); + } + + + } From 0f64317c869d39961f2e1c74ccd9fe35ac4fdb31 Mon Sep 17 00:00:00 2001 From: Cassidy Mark Date: Mon, 22 Jan 2024 16:01:42 -0800 Subject: [PATCH 7/9] Intake code but with Neos --- .../src/main/java/com/team2813/Constants.java | 15 ++++++++------- .../main/java/com/team2813/subsystems/Intake.java | 8 +++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Robot2024/src/main/java/com/team2813/Constants.java b/Robot2024/src/main/java/com/team2813/Constants.java index 751a6aa..f83cb1c 100644 --- a/Robot2024/src/main/java/com/team2813/Constants.java +++ b/Robot2024/src/main/java/com/team2813/Constants.java @@ -50,12 +50,13 @@ public static class DriverConstants { // pigeon public static final int PIGEON_ID = 13; - //Mechanism CAN IDs - public static final int INTAKE = 14; - public static final int LEFT_MAGAZINE = 15; - public static final int SHOOTER = 16; - public static final int SHOOTER_PIVOT= 17; - public static final int CLIMBER = 18; - public static final int RIGHT_MAGAZINE = 19; + //Mechanism CAN IDs + public static final int INTAKE = 14; + public static final int LEFT_MAGAZINE = 15; + public static final int SHOOTER = 16; + public static final int SHOOTER_PIVOT= 17; + public static final int CLIMBER = 18; + public static final int RIGHT_MAGAZINE = 19; + public static final int INTAKE_PIVOT = 20; } diff --git a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java index aa65187..d9d0d2c 100644 --- a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java +++ b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java @@ -3,7 +3,9 @@ import com.ctre.phoenix.motorcontrol.NeutralMode; import com.ctre.phoenix.motorcontrol.TalonFXInvertType; +import com.revrobotics.CANSparkLowLevel; import com.team2813.lib2813.control.motors.TalonFXWrapper; +//import com.team2813.lib2813.control.motors.SparkMaxWrapper; import com.team2813.lib2813.control.ControlMode; import edu.wpi.first.wpilibj2.command.SubsystemBase; @@ -12,14 +14,14 @@ public class Intake extends SubsystemBase { private final TalonFXWrapper intakeMotor = new TalonFXWrapper(INTAKE, TalonFXInvertType.CounterClockwise); private final TalonFXWrapper pivotMotor = new TalonFXWrapper(INTAKE_PIVOT, TalonFXInvertType.CounterClockwise); + //private final SparkMaxWrapper intakeMotor = new SparkMaxWrapper(INTAKE, CANSparkLowLevel.MotorType.kBrushless, true); + //private final SparkMaxWrapper pivotMotor = new SparkMaxWrapper(INTAKE_PIVOT, CANSparkLowLevel.MotorType.kBrushless, true); public Intake() { } - public void intake() { - intakeMotor.set(ControlMode.DUTY_CYCLE, 0.5); - } + public void intake() { intakeMotor.set(ControlMode.DUTY_CYCLE, 0.5);} public void outtake() { intakeMotor.set(ControlMode.DUTY_CYCLE, -0.5); From c8cc3f931f08f35da8154a42ad03e0fdd412dc4c Mon Sep 17 00:00:00 2001 From: Cassidy Mark Date: Tue, 23 Jan 2024 17:28:25 -0800 Subject: [PATCH 8/9] Added pivot up and down Co-Authored-By: piyou1 <119463363+piyou1@users.noreply.github.com> --- .../src/main/java/com/team2813/Constants.java | 2 +- .../java/com/team2813/subsystems/Intake.java | 37 +++++++++++++++---- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/Robot2024/src/main/java/com/team2813/Constants.java b/Robot2024/src/main/java/com/team2813/Constants.java index 05bd6c9..6255e3f 100644 --- a/Robot2024/src/main/java/com/team2813/Constants.java +++ b/Robot2024/src/main/java/com/team2813/Constants.java @@ -49,7 +49,7 @@ public static class DriverConstants { // pigeon public static final int PIGEON_ID = 13; - + //Mechanism CAN IDs public static final int INTAKE = 14; public static final int KICKER = 15; diff --git a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java index d9d0d2c..0c9100e 100644 --- a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java +++ b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java @@ -1,11 +1,13 @@ package com.team2813.subsystems; -import com.ctre.phoenix.motorcontrol.NeutralMode; import com.ctre.phoenix.motorcontrol.TalonFXInvertType; - +import com.ctre.phoenix.sensors.CANCoder; import com.revrobotics.CANSparkLowLevel; + import com.team2813.lib2813.control.motors.TalonFXWrapper; -//import com.team2813.lib2813.control.motors.SparkMaxWrapper; +import com.team2813.lib2813.control.motors.SparkMaxWrapper; +import com.team2813.lib2813.control.Encoder; +import com.team2813.lib2813.control.PIDMotor; import com.team2813.lib2813.control.ControlMode; import edu.wpi.first.wpilibj2.command.SubsystemBase; @@ -14,19 +16,38 @@ public class Intake extends SubsystemBase { private final TalonFXWrapper intakeMotor = new TalonFXWrapper(INTAKE, TalonFXInvertType.CounterClockwise); private final TalonFXWrapper pivotMotor = new TalonFXWrapper(INTAKE_PIVOT, TalonFXInvertType.CounterClockwise); + //private final CANCoder encoder = new CANCoder(PIVOT_ENCODER); + //private final SparkMaxWrapper intakeMotor = new SparkMaxWrapper(INTAKE, CANSparkLowLevel.MotorType.kBrushless, true); //private final SparkMaxWrapper pivotMotor = new SparkMaxWrapper(INTAKE_PIVOT, CANSparkLowLevel.MotorType.kBrushless, true); - public Intake() { + private static final double INTAKE_SPEED = 0.25; + private static final double OUTTAKE_SPEED = -0.25; - } + private static final double PIVOT_UP_SPEED = .10; + private static final double PIVOT_DOWN_SPEED = -.10; - public void intake() { intakeMotor.set(ControlMode.DUTY_CYCLE, 0.5);} - public void outtake() { - intakeMotor.set(ControlMode.DUTY_CYCLE, -0.5); + public Intake() { + //encoder.configSensorDirection(true); } + public void intake() { intakeMotor.set(ControlMode.DUTY_CYCLE, INTAKE_SPEED); } + + public void outtake() { intakeMotor.set(ControlMode.DUTY_CYCLE, OUTTAKE_SPEED); } + + public void stopIntakeMotor() { intakeMotor.set(ControlMode.DUTY_CYCLE, 0); } + + public void pivotUp() { pivotMotor.set(ControlMode.DUTY_CYCLE, PIVOT_UP_SPEED); } + + public void pivotDown() { pivotMotor.set(ControlMode.DUTY_CYCLE, PIVOT_DOWN_SPEED); } + + public void stopPivotMotor() { pivotMotor.set(ControlMode.DUTY_CYCLE, 0); } + + /*private double getMeasurement() { + return encoder.getPosition(); + }*/ + } From 6fc5701075578a32dafb7feed03b94c88730bcc7 Mon Sep 17 00:00:00 2001 From: Cassidy Mark Date: Tue, 23 Jan 2024 17:37:52 -0800 Subject: [PATCH 9/9] Adding encoder stuff --- .../main/java/com/team2813/subsystems/Intake.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java index 0c9100e..40800b4 100644 --- a/Robot2024/src/main/java/com/team2813/subsystems/Intake.java +++ b/Robot2024/src/main/java/com/team2813/subsystems/Intake.java @@ -6,17 +6,17 @@ import com.team2813.lib2813.control.motors.TalonFXWrapper; import com.team2813.lib2813.control.motors.SparkMaxWrapper; -import com.team2813.lib2813.control.Encoder; -import com.team2813.lib2813.control.PIDMotor; import com.team2813.lib2813.control.ControlMode; +import com.team2813.lib2813.util.ConfigUtils; +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.SubsystemBase; import static com.team2813.Constants.*; public class Intake extends SubsystemBase { private final TalonFXWrapper intakeMotor = new TalonFXWrapper(INTAKE, TalonFXInvertType.CounterClockwise); private final TalonFXWrapper pivotMotor = new TalonFXWrapper(INTAKE_PIVOT, TalonFXInvertType.CounterClockwise); - //private final CANCoder encoder = new CANCoder(PIVOT_ENCODER); + private final CANCoder encoder = new CANCoder(INTAKE_ENCODER); //private final SparkMaxWrapper intakeMotor = new SparkMaxWrapper(INTAKE, CANSparkLowLevel.MotorType.kBrushless, true); //private final SparkMaxWrapper pivotMotor = new SparkMaxWrapper(INTAKE_PIVOT, CANSparkLowLevel.MotorType.kBrushless, true); @@ -44,9 +44,9 @@ public Intake() { public void stopPivotMotor() { pivotMotor.set(ControlMode.DUTY_CYCLE, 0); } - /*private double getMeasurement() { - return encoder.getPosition(); - }*/ + public double getMeasurement() { return encoder.getPosition(); } + + public void zeroSensors() { ConfigUtils.ctreConfig(() -> encoder.setPosition(0)); }