Code clean up, compleatly remove phoenix5

This commit is contained in:
C4llSiqn
2024-10-26 11:39:50 -06:00
parent eaf60aa475
commit c27f2a7c6a
11 changed files with 30 additions and 290 deletions
+3 -2
View File
@@ -49,7 +49,6 @@ public final class Constants {
} }
public static final class IDs { public static final class IDs {
public static final int RIGHT_FRONT_WHEEL_ID = 2; public static final int RIGHT_FRONT_WHEEL_ID = 2;
public static final int RIGHT_FRONT_STEER_ID = 3; public static final int RIGHT_FRONT_STEER_ID = 3;
public static final int RIGHT_FRONT_ENCODER_ID = 10; public static final int RIGHT_FRONT_ENCODER_ID = 10;
@@ -65,6 +64,8 @@ public final class Constants {
public static final int RIGHT_BACK_WHEEL_ID = 8; public static final int RIGHT_BACK_WHEEL_ID = 8;
public static final int RIGHT_BACK_STEER_ID = 9; public static final int RIGHT_BACK_STEER_ID = 9;
public static final int RIGHT_BACK_ENCODER_ID = 13; public static final int RIGHT_BACK_ENCODER_ID = 13;
public static final int DRIVE_PIGEON_ID = 14;
} }
public static final class PIDConstants { public static final class PIDConstants {
@@ -138,7 +139,7 @@ public final class Constants {
} }
public static final class DriveConstants { public static final class DriveConstants {
public static final int DRIVE_PIGEON_ID = 14;
public static final int SMARTDASHBOARD_UPDATE_FRAME = 2; public static final int SMARTDASHBOARD_UPDATE_FRAME = 2;
} }
-2
View File
@@ -7,8 +7,6 @@
package frc4388.robot; package frc4388.robot;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.wpilibj.TimedRobot; import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler; import edu.wpi.first.wpilibj2.command.CommandScheduler;
@@ -22,7 +22,6 @@ import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.InstantCommand; import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
// Autos // Autos
import frc4388.robot.commands.Intake.ArmIntakeIn; import frc4388.robot.commands.Intake.ArmIntakeIn;
@@ -36,7 +35,6 @@ import frc4388.robot.subsystems.Intake;
import frc4388.robot.subsystems.Limelight; import frc4388.robot.subsystems.Limelight;
import frc4388.robot.subsystems.Shooter; import frc4388.robot.subsystems.Shooter;
// import frc4388.robot.subsystems.LED; // import frc4388.robot.subsystems.LED;
// import frc4388.robot.subsystems.Limelight;
import frc4388.robot.subsystems.SwerveDrive; import frc4388.robot.subsystems.SwerveDrive;
// Utilites // Utilites
@@ -91,17 +89,11 @@ public class RobotContainer {
new InstantCommand(() -> m_robotShooter.idle()) new InstantCommand(() -> m_robotShooter.idle())
); );
private SequentialCommandGroup i = new SequentialCommandGroup( private SequentialCommandGroup intakeNotePullInIdle = new SequentialCommandGroup(
intakeToShootStuff, intakeToShoot, intakeToShootStuff, intakeToShoot,
new InstantCommand(() -> m_robotShooter.idle()) new InstantCommand(() -> m_robotShooter.idle())
); );
private SequentialCommandGroup ejectToShoot = new SequentialCommandGroup(
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
new WaitCommand(0.75),
new InstantCommand(() -> m_robotIntake.handoff(), m_robotIntake)
);
private SequentialCommandGroup turnOffShoot = new SequentialCommandGroup( private SequentialCommandGroup turnOffShoot = new SequentialCommandGroup(
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter) new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter)
// new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake) // new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake)
@@ -113,11 +105,6 @@ public class RobotContainer {
new InstantCommand(() -> m_robotIntake.stopIntakeMotors(), m_robotIntake) new InstantCommand(() -> m_robotIntake.stopIntakeMotors(), m_robotIntake)
); );
private SequentialCommandGroup ampShoot = new SequentialCommandGroup(
new InstantCommand(() -> m_robotIntake.ampPosition()),
new InstantCommand(() -> m_robotIntake.ampOuttake(0.1)) //TODO: Find Actual Speed
);
// ! /* Autos */ // ! /* Autos */
private String lastAutoName = "four_note_taxi_kracken.auto"; private String lastAutoName = "four_note_taxi_kracken.auto";
private ConfigurableString autoplaybackName = new ConfigurableString("Auto Playback Name", lastAutoName); private ConfigurableString autoplaybackName = new ConfigurableString("Auto Playback Name", lastAutoName);
@@ -126,7 +113,7 @@ public class RobotContainer {
new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()}, new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()},
true, false); true, false);
private neoJoystickPlayback amp_shoot = new neoJoystickPlayback(m_robotSwerveDrive, "Amp_shoot.auto", private neoJoystickPlayback ampShoot = new neoJoystickPlayback(m_robotSwerveDrive, "Amp_shoot.auto",
new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()}, new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()},
false, true); false, true);
@@ -237,7 +224,7 @@ public class RobotContainer {
DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.RIGHT_BUMPER_BUTTON) DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.RIGHT_BUMPER_BUTTON)
.onTrue(i) .onTrue(intakeNotePullInIdle)
.onFalse(new InstantCommand(() -> m_robotIntake.PIDIn())); .onFalse(new InstantCommand(() -> m_robotIntake.PIDIn()));
// Spins up shooter, no wind down // Spins up shooter, no wind down
@@ -259,7 +246,7 @@ public class RobotContainer {
// .onTrue(new InstantCommand(() -> m_robotIntake.ampOuttake(0.5))); // .onTrue(new InstantCommand(() -> m_robotIntake.ampOuttake(0.5)));
new Trigger(() -> getDeadbandedOperatorController().getPOV() != -1) new Trigger(() -> getDeadbandedOperatorController().getPOV() != -1)
.onTrue(amp_shoot) .onTrue(ampShoot)
.onFalse(new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter, m_robotSwerveDrive)); .onFalse(new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter, m_robotSwerveDrive));
// ? /* Programer Buttons (Controller 3)*/ // ? /* Programer Buttons (Controller 3)*/
+4 -86
View File
@@ -7,17 +7,12 @@
package frc4388.robot; package frc4388.robot;
import com.ctre.phoenix.motorcontrol.NeutralMode;
// import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
// import com.ctre.phoenix.sensors.CANCoder;
// import com.ctre.phoenix.sensors.WPI_Pigeon2;
import com.ctre.phoenix6.configs.TalonFXConfiguration;
import com.ctre.phoenix6.hardware.TalonFX; import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.hardware.CANcoder; import com.ctre.phoenix6.hardware.CANcoder;
import com.ctre.phoenix6.hardware.Pigeon2; import com.ctre.phoenix6.hardware.Pigeon2;
import edu.wpi.first.wpilibj.motorcontrol.Spark; // import edu.wpi.first.wpilibj.motorcontrol.Spark;
import frc4388.robot.Constants.LEDConstants; // import frc4388.robot.Constants.LEDConstants;
import frc4388.robot.Constants.SwerveDriveConstants; import frc4388.robot.Constants.SwerveDriveConstants;
import frc4388.robot.Constants.ShooterConstants; import frc4388.robot.Constants.ShooterConstants;
import frc4388.robot.Constants.ClimbConstants; import frc4388.robot.Constants.ClimbConstants;
@@ -30,9 +25,8 @@ import frc4388.utility.RobotGyro;
* testing and modularization. * testing and modularization.
*/ */
public class RobotMap { public class RobotMap {
private Pigeon2 m_pigeon2 = new Pigeon2(14); private Pigeon2 m_pigeon2 = new Pigeon2(SwerveDriveConstants.IDs.DRIVE_PIGEON_ID);
public RobotGyro gyro = new RobotGyro(m_pigeon2); public RobotGyro gyro = new RobotGyro(m_pigeon2);
// public RobotGyro gyro = null;
public SwerveModule leftFront; public SwerveModule leftFront;
public SwerveModule rightFront; public SwerveModule rightFront;
@@ -47,11 +41,6 @@ public class RobotMap {
/* LED Subsystem */ /* LED Subsystem */
// public final Spark LEDController = new Spark(LEDConstants.LED_SPARK_ID); // public final Spark LEDController = new Spark(LEDConstants.LED_SPARK_ID);
// public final TalonFX rightFrontWheel = new TalonFX(SwerveDriveConstants.IDs.RIGHT_FRONT_WHEEL_ID);
// public final TalonFX rightFrontSteer = new TalonFX(SwerveDriveConstants.IDs.RIGHT_FRONT_STEER_ID);
// public final CANcoder rightFrontEncoder = new CANcoder(SwerveDriveConstants.IDs.RIGHT_FRONT_ENCODER_ID);
/* Swreve Drive Subsystem */ /* Swreve Drive Subsystem */
public final TalonFX leftFrontWheel = new TalonFX(SwerveDriveConstants.IDs.LEFT_FRONT_WHEEL_ID); public final TalonFX leftFrontWheel = new TalonFX(SwerveDriveConstants.IDs.LEFT_FRONT_WHEEL_ID);
public final TalonFX leftFrontSteer = new TalonFX(SwerveDriveConstants.IDs.LEFT_FRONT_STEER_ID); public final TalonFX leftFrontSteer = new TalonFX(SwerveDriveConstants.IDs.LEFT_FRONT_STEER_ID);
@@ -85,84 +74,13 @@ public class RobotMap {
} }
void configureIntakeMotorControllers() { void configureIntakeMotorControllers() {
// intakeMotor.getConfigurator().apply(new TalonFXConfiguration());
// pivotMotor.getConfigurator().apply(new TalonFXConfiguration());
} }
void configureDriveMotorControllers() { void configureDriveMotorControllers() {
// config factory default // initialize SwerveModules
// leftFrontWheel.configFactoryDefault();
// leftFrontSteer.configFactoryDefault();
// rightFrontWheel.configFactoryDefault();
// rightFrontSteer.configFactoryDefault();
// leftBackWheel.configFactoryDefault();
// leftBackSteer.configFactoryDefault();
// rightBackWheel.configFactoryDefault();
// rightBackSteer.configFactoryDefault();
// // config open loop ramp
// leftFrontWheel.configOpenloopRamp(SwerveDriveConstants.Configurations.OPEN_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// leftFrontSteer.configOpenloopRamp(SwerveDriveConstants.Configurations.OPEN_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// rightFrontWheel.configOpenloopRamp(SwerveDriveConstants.Configurations.OPEN_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// rightFrontSteer.configOpenloopRamp(SwerveDriveConstants.Configurations.OPEN_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// leftBackWheel.configOpenloopRamp(SwerveDriveConstants.Configurations.OPEN_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// leftBackSteer.configOpenloopRamp(SwerveDriveConstants.Configurations.OPEN_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// rightBackWheel.configOpenloopRamp(SwerveDriveConstants.Configurations.OPEN_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// rightBackSteer.configOpenloopRamp(SwerveDriveConstants.Configurations.OPEN_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// // config closed loop ramp
// leftFrontWheel.configClosedloopRamp(SwerveDriveConstants.Configurations.CLOSED_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// leftFrontSteer.configClosedloopRamp(SwerveDriveConstants.Configurations.CLOSED_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// rightFrontWheel.configClosedloopRamp(SwerveDriveConstants.Configurations.CLOSED_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// rightFrontSteer.configClosedloopRamp(SwerveDriveConstants.Configurations.CLOSED_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// leftBackWheel.configClosedloopRamp(SwerveDriveConstants.Configurations.CLOSED_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// leftBackSteer.configClosedloopRamp(SwerveDriveConstants.Configurations.CLOSED_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// rightBackWheel.configClosedloopRamp(SwerveDriveConstants.Configurations.CLOSED_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// rightBackSteer.configClosedloopRamp(SwerveDriveConstants.Configurations.CLOSED_LOOP_RAMP_RATE, SwerveDriveConstants.TIMEOUT_MS);
// // config neutral deadband
// leftFrontSteer.configNeutralDeadband(SwerveDriveConstants.Configurations.NEUTRAL_DEADBAND, SwerveDriveConstants.TIMEOUT_MS);
// leftFrontWheel.configNeutralDeadband(SwerveDriveConstants.Configurations.NEUTRAL_DEADBAND, SwerveDriveConstants.TIMEOUT_MS);
// rightFrontWheel.configNeutralDeadband(SwerveDriveConstants.Configurations.NEUTRAL_DEADBAND, SwerveDriveConstants.TIMEOUT_MS);
// rightFrontSteer.configNeutralDeadband(SwerveDriveConstants.Configurations.NEUTRAL_DEADBAND, SwerveDriveConstants.TIMEOUT_MS);
// leftBackWheel.configNeutralDeadband(SwerveDriveConstants.Configurations.NEUTRAL_DEADBAND, SwerveDriveConstants.TIMEOUT_MS);
// leftBackSteer.configNeutralDeadband(SwerveDriveConstants.Configurations.NEUTRAL_DEADBAND, SwerveDriveConstants.TIMEOUT_MS);
// rightBackWheel.configNeutralDeadband(SwerveDriveConstants.Configurations.NEUTRAL_DEADBAND, SwerveDriveConstants.TIMEOUT_MS);
// rightBackSteer.configNeutralDeadband(SwerveDriveConstants.Configurations.NEUTRAL_DEADBAND, SwerveDriveConstants.TIMEOUT_MS);
// // set neutral mode
// leftFrontWheel.setNeutralMode(NeutralMode.Brake);
// rightFrontWheel.setNeutralMode(NeutralMode.Brake);
// leftBackWheel.setNeutralMode(NeutralMode.Brake);
// rightBackWheel.setNeutralMode(NeutralMode.Brake);
// leftFrontSteer.setNeutralMode(NeutralMode.Brake);
// rightFrontSteer.setNeutralMode(NeutralMode.Brake);
// leftBackSteer.setNeutralMode(NeutralMode.Brake);
// rightBackSteer.setNeutralMode(NeutralMode.Brake);
// // initialize SwerveModules
this.rightFront = new SwerveModule(rightFrontWheel, rightFrontSteer, rightFrontEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.FRONT_RIGHT_ROT_OFFSET); this.rightFront = new SwerveModule(rightFrontWheel, rightFrontSteer, rightFrontEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.FRONT_RIGHT_ROT_OFFSET);
this.leftFront = new SwerveModule(leftFrontWheel, leftFrontSteer, leftFrontEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.FRONT_LEFT_ROT_OFFSET); this.leftFront = new SwerveModule(leftFrontWheel, leftFrontSteer, leftFrontEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.FRONT_LEFT_ROT_OFFSET);
this.leftBack = new SwerveModule(leftBackWheel, leftBackSteer, leftBackEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.BACK_LEFT_ROT_OFFSET); this.leftBack = new SwerveModule(leftBackWheel, leftBackSteer, leftBackEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.BACK_LEFT_ROT_OFFSET);
this.rightBack = new SwerveModule(rightBackWheel, rightBackSteer, rightBackEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.BACK_RIGHT_ROT_OFFSET); this.rightBack = new SwerveModule(rightBackWheel, rightBackSteer, rightBackEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.BACK_RIGHT_ROT_OFFSET);
// this.leftFront = new SwerveModule(leftFrontWheel, leftFrontSteer, leftFrontEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.FRONT_LEFT_ROT_OFFSET);
// this.rightFront = new SwerveModule(rightFrontWheel, rightFrontSteer, rightFrontEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.FRONT_RIGHT_ROT_OFFSET);
// this.leftBack = new SwerveModule(leftBackWheel, leftBackSteer, leftBackEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.BACK_LEFT_ROT_OFFSET);
// this.rightBack = new SwerveModule(rightBackWheel, rightBackSteer, rightBackEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.BACK_RIGHT_ROT_OFFSET);
} }
} }
@@ -9,11 +9,11 @@ import java.io.FileNotFoundException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Scanner; import java.util.Scanner;
import edu.wpi.first.math.geometry.Translation2d; import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.wpilibj2.command.CommandBase; import edu.wpi.first.wpilibj2.command.Command;
import frc4388.robot.subsystems.SwerveDrive; import frc4388.robot.subsystems.SwerveDrive;
import frc4388.utility.UtilityStructs.TimedOutput; import frc4388.utility.UtilityStructs.TimedOutput;
public class JoystickPlayback extends CommandBase { public class JoystickPlayback extends Command {
private final SwerveDrive swerve; private final SwerveDrive swerve;
private String filename; private String filename;
private int mult = 1; private int mult = 1;
@@ -11,11 +11,11 @@ import java.util.ArrayList;
import java.util.function.Supplier; import java.util.function.Supplier;
import edu.wpi.first.math.geometry.Translation2d; import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.wpilibj2.command.CommandBase; import edu.wpi.first.wpilibj2.command.Command;
import frc4388.robot.subsystems.SwerveDrive; import frc4388.robot.subsystems.SwerveDrive;
import frc4388.utility.UtilityStructs.TimedOutput; import frc4388.utility.UtilityStructs.TimedOutput;
public class JoystickRecorder extends CommandBase { public class JoystickRecorder extends Command {
public final SwerveDrive swerve; public final SwerveDrive swerve;
public final Supplier<Double> leftX; public final Supplier<Double> leftX;
@@ -12,11 +12,7 @@ import com.ctre.phoenix6.signals.NeutralModeValue;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants;
import frc4388.robot.Constants.ClimbConstants; import frc4388.robot.Constants.ClimbConstants;
import frc4388.robot.Constants.IntakeConstants;
//! 6.5C Scoring Criteria for Stage
public class Climber extends SubsystemBase { public class Climber extends SubsystemBase {
/** Creates a new Climber. */ /** Creates a new Climber. */
@@ -40,14 +36,13 @@ public class Climber extends SubsystemBase {
//PositionVoltage request = new PositionVoltage(0); //PositionVoltage request = new PositionVoltage(0);
//climbMotor.setControl(request.withPosition(-520)); //climbMotor.setControl(request.withPosition(-520));
climbMotor.set(Constants.ClimbConstants.CLIMB_OUT_SPEED); climbMotor.set(ClimbConstants.CLIMB_OUT_SPEED);
} }
public void climbIn() { public void climbIn() {
//PositionVoltage request = new PositionVoltage(-520); //PositionVoltage request = new PositionVoltage(-520);
//climbMotor.setControl(request.withPosition(0)); //climbMotor.setControl(request.withPosition(0));
climbMotor.set(Constants.ClimbConstants.CLIMB_IN_SPEED); climbMotor.set(ClimbConstants.CLIMB_IN_SPEED);
;
} }
public void stopClimb() { public void stopClimb() {
@@ -7,7 +7,8 @@
package frc4388.robot.subsystems; package frc4388.robot.subsystems;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX; import com.ctre.phoenix6.controls.Follower;
import com.ctre.phoenix6.hardware.TalonFX;
import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
@@ -26,23 +27,25 @@ public class DiffDrive extends SubsystemBase {
private RobotTime m_robotTime = RobotTime.getInstance(); private RobotTime m_robotTime = RobotTime.getInstance();
private WPI_TalonFX m_leftFrontMotor; private TalonFX m_leftFrontMotor;
private WPI_TalonFX m_rightFrontMotor; private TalonFX m_rightFrontMotor;
private WPI_TalonFX m_leftBackMotor; private TalonFX m_leftBackMotor;
private WPI_TalonFX m_rightBackMotor; private TalonFX m_rightBackMotor;
private DifferentialDrive m_driveTrain; private DifferentialDrive m_driveTrain;
private RobotGyro m_gyro; private RobotGyro m_gyro;
/** /**
* Add your docs here. * Add your docs here.
*/ */
public DiffDrive(WPI_TalonFX leftFrontMotor, WPI_TalonFX rightFrontMotor, WPI_TalonFX leftBackMotor, public DiffDrive(TalonFX leftFrontMotor, TalonFX rightFrontMotor, TalonFX leftBackMotor,
WPI_TalonFX rightBackMotor, DifferentialDrive driveTrain, RobotGyro gyro) { TalonFX rightBackMotor, DifferentialDrive driveTrain, RobotGyro gyro) {
m_leftFrontMotor = leftFrontMotor; m_leftFrontMotor = leftFrontMotor;
m_rightFrontMotor = rightFrontMotor; m_rightFrontMotor = rightFrontMotor;
m_leftBackMotor = leftBackMotor; m_leftBackMotor = leftBackMotor;
m_rightBackMotor = rightBackMotor; m_rightBackMotor = rightBackMotor;
m_leftBackMotor .setControl(new Follower(m_leftFrontMotor.getDeviceID(), false));
m_rightBackMotor.setControl(new Follower(m_rightBackMotor.getDeviceID(), false));
m_driveTrain = driveTrain; m_driveTrain = driveTrain;
m_gyro = gyro; m_gyro = gyro;
} }
@@ -4,16 +4,6 @@
package frc4388.robot.subsystems; package frc4388.robot.subsystems;
// import javax.swing.text.StyleContext.SmallAttributeSet;
// import com.ctre.phoenix.ErrorCode;
import com.ctre.phoenix.motorcontrol.FeedbackDevice;
import com.ctre.phoenix.motorcontrol.RemoteSensorSource;
// import com.ctre.phoenix.motorcontrol.TalonFXControlMode;
// import com.ctre.phoenix.motorcontrol.can.TalonFXConfiguration;
// import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
// import com.ctre.phoenix.sensors.CANCoder;
// import com.ctre.phoenix.sensors.SensorInitializationStrategy;
import com.ctre.phoenix6.StatusSignal; import com.ctre.phoenix6.StatusSignal;
import com.ctre.phoenix6.Utils; import com.ctre.phoenix6.Utils;
import com.ctre.phoenix6.configs.CANcoderConfiguration; import com.ctre.phoenix6.configs.CANcoderConfiguration;
@@ -43,7 +33,6 @@ import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.SwerveDriveConstants; import frc4388.robot.Constants.SwerveDriveConstants;
import frc4388.utility.Gains; import frc4388.utility.Gains;
// import frc4388.utility.configurable.ConfigurableDouble;
public class SwerveModule extends SubsystemBase { public class SwerveModule extends SubsystemBase {
private TalonFX driveMotor; private TalonFX driveMotor;
@@ -76,9 +65,9 @@ public class SwerveModule extends SubsystemBase {
.withDutyCycleNeutralDeadband(SwerveDriveConstants.Configurations.NEUTRAL_DEADBAND) .withDutyCycleNeutralDeadband(SwerveDriveConstants.Configurations.NEUTRAL_DEADBAND)
).withCurrentLimits( ).withCurrentLimits(
new CurrentLimitsConfigs() new CurrentLimitsConfigs()
.withStatorCurrentLimit(110) .withStatorCurrentLimit(100)
.withStatorCurrentLimitEnable(true) .withStatorCurrentLimitEnable(true)
.withSupplyCurrentLimit(110) .withSupplyCurrentLimit(100)
.withSupplyCurrentLimitEnable(true) .withSupplyCurrentLimitEnable(true)
); );
-151
View File
@@ -1,151 +0,0 @@
{
"fileName": "Phoenix5.json",
"name": "CTRE-Phoenix (v5)",
"version": "5.33.1",
"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.1"
},
{
"groupId": "com.ctre.phoenix",
"artifactId": "wpiapi-java",
"version": "5.33.1"
}
],
"jniDependencies": [
{
"groupId": "com.ctre.phoenix",
"artifactId": "cci",
"version": "5.33.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxathena"
],
"simMode": "hwsim"
},
{
"groupId": "com.ctre.phoenix.sim",
"artifactId": "cci-sim",
"version": "5.33.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
}
],
"cppDependencies": [
{
"groupId": "com.ctre.phoenix",
"artifactId": "wpiapi-cpp",
"version": "5.33.1",
"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.1",
"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.1",
"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.1",
"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.1",
"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.1",
"libName": "CTRE_PhoenixCCISim",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"osxuniversal"
],
"simMode": "swsim"
}
]
}