Skip to content

Commit

Permalink
added phoenix v5 vendor dep for talons
Browse files Browse the repository at this point in the history
  • Loading branch information
penguin212 committed Jan 27, 2024
1 parent 451f950 commit 725ed03
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 7 deletions.
10 changes: 9 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,21 @@ private void configureBindings() {
}));

bButton.onTrue(new InstantCommand(() -> {
feederSubsystem.setFeederMotorSpeed(feederSubsystem.FEEDER_MOTOR_SPEED);
feederSubsystem.setFeederMotorSpeed(.7);
}));

bButton.onFalse(new InstantCommand(() -> {
feederSubsystem.setFeederMotorSpeed(0);
}));

xButton.onTrue(new InstantCommand(() -> {
feederSubsystem.setFeederMotorSpeed(-.7);
}));

xButton.onFalse(new InstantCommand(() -> {
feederSubsystem.setFeederMotorSpeed(0);
}));

pivotSubsystem.setDefaultCommand(new InstantCommand(() -> {
pivotSubsystem.setPivotMotorSpeed(.3 * (mechController.getRightTriggerAxis() - mechController.getLeftTriggerAxis()));
}, pivotSubsystem));
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/frc/robot/subsystems/FeederSubsystem.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package frc.robot.subsystems;

import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix.motorcontrol.TalonSRXControlMode;
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
import com.revrobotics.ColorSensorV3;

import edu.wpi.first.wpilibj.I2C;
Expand All @@ -14,22 +16,24 @@ public class FeederSubsystem extends SubsystemBase{
public final int TOLERANCE = 10; //represents the value when half note is in front of sensor

//motors
private final TalonFX feederMotor;
private final TalonSRX feederMotor;

//devices
private final ColorSensorV3 shooterSensor; //distance sensor

public FeederSubsystem(){
//motors
feederMotor = new TalonFX(15);
feederMotor = new TalonSRX(15);
feederMotor.setInverted(true);

//sensors
shooterSensor = new ColorSensorV3(I2C.Port.kMXP);
}

public void setFeederMotorSpeed(double speed){
feederMotor.setVoltage(speed * 12);
System.out.println("feeding motor speed is: " + feederMotor.get());
feederMotor.set(TalonSRXControlMode.PercentOutput,speed);
// feederMotor.setVoltage(speed * 12);
System.out.println("feeding motor speed is: " + feederMotor.getBusVoltage());

}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/PivotSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ public void periodic(){
//(check if encoder prints zero when run)
if(limitSwitch != null && limitSwitch.get()){ //false = limit switch is pressed
rotationEncoder.setPosition(0);
System.out.println(rotationEncoder.getPosition()); //should print 0
// System.out.println(rotationEncoder.getPosition()); //should print 0
}

if(autoAim){
setAngle(getAutoAimAngle(getDistance()));
}

System.out.println("current pos" + rotationEncoder.getPosition());
// System.out.println("current pos" + rotationEncoder.getPosition());

// if(currentState == ShooterState.FIRING && (shooterSensor.getRed() < TOLERANCE)){ //when there is no note
// setShooterState(ShooterState.NO_NOTE);
Expand Down
151 changes: 151 additions & 0 deletions vendordeps/Phoenix5.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}

0 comments on commit 725ed03

Please sign in to comment.