3/13's changes

This commit is contained in:
Abhishrek05
2024-03-13 14:15:53 -06:00
parent 91fbfb7af3
commit 230b1511d9
4 changed files with 22 additions and 20 deletions
+3 -3
View File
@@ -67,7 +67,7 @@ public final class Constants {
public static final class PIDConstants { public static final class PIDConstants {
public static final int SWERVE_SLOT_IDX = 0; public static final int SWERVE_SLOT_IDX = 0;
public static final int SWERVE_PID_LOOP_IDX = 1; public static final int SWERVE_PID_LOOP_IDX = 1;
public static final Gains SWERVE_GAINS = new Gains(1.2, 0.0, 0.2, 0.0, 0, 0.0); public static final Gains SWERVE_GAINS = new Gains(1.2, 0.0, 0.1, 0.2, 0, 0.0);
} }
public static final class AutoConstants { public static final class AutoConstants {
@@ -191,8 +191,8 @@ public final class Constants {
public static final class ClimbConstants { public static final class ClimbConstants {
public static final int CLIMB_MOTOR_ID = 19; public static final int CLIMB_MOTOR_ID = 19;
public static final double CLIMB_OUT_SPEED = 0.3; public static final double CLIMB_IN_SPEED = -1.0;
public static final double CLIMB_IN_SPEED = -0.3; public static final double CLIMB_OUT_SPEED = 0.87;
} }
public static final class OIConstants { public static final class OIConstants {
@@ -327,14 +327,6 @@ public class RobotContainer {
new JoystickButton(getDeadbandedDriverController(), XboxController.A_BUTTON) new JoystickButton(getDeadbandedDriverController(), XboxController.A_BUTTON)
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroFlip(), m_robotSwerveDrive)); .onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroFlip(), m_robotSwerveDrive));
new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.RIGHT_TRIGGER_AXIS) > 0.5)
.onTrue(new InstantCommand(() -> m_robotClimber.climbOut()))
.onFalse(new InstantCommand(() -> m_robotClimber.stopClimb()));
new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.LEFT_TRIGGER_AXIS) > 0.5)
.onTrue(new InstantCommand(() -> m_robotClimber.climbIn()))
.onFalse(new InstantCommand(() -> m_robotClimber.stopClimb()));
new Trigger(() -> getDeadbandedDriverController().getPOV() == 0) new Trigger(() -> getDeadbandedDriverController().getPOV() == 0)
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroRightBlue())); .onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroRightBlue()));
@@ -430,8 +422,12 @@ public class RobotContainer {
.onTrue(emergencyRetract); .onTrue(emergencyRetract);
new Trigger(() -> getDeadbandedOperatorController().getRawAxis(XboxController.RIGHT_TRIGGER_AXIS) > 0.5) new Trigger(() -> getDeadbandedOperatorController().getRawAxis(XboxController.RIGHT_TRIGGER_AXIS) > 0.5)
.onTrue(new InstantCommand(() -> m_robotShooter.idle())) .onTrue(new InstantCommand(() -> m_robotClimber.climbOut()))
.onFalse(new InstantCommand(() -> m_robotShooter.stop())); .onFalse(new InstantCommand(() -> m_robotClimber.stopClimb()));
new Trigger(() -> getDeadbandedOperatorController().getRawAxis(XboxController.LEFT_TRIGGER_AXIS) > 0.5)
.onTrue(new InstantCommand(() -> m_robotClimber.climbIn()))
.onFalse(new InstantCommand(() -> m_robotClimber.stopClimb()));
new Trigger(() -> getDeadbandedOperatorController().getPOV() == 0) new Trigger(() -> getDeadbandedOperatorController().getPOV() == 0)
.onTrue(new InstantCommand(() -> m_robotClimber.climbOut())) .onTrue(new InstantCommand(() -> m_robotClimber.climbOut()))
+1 -1
View File
@@ -149,7 +149,7 @@ public class RobotMap {
rightFrontSteer.setNeutralMode(NeutralMode.Brake); rightFrontSteer.setNeutralMode(NeutralMode.Brake);
leftBackSteer.setNeutralMode(NeutralMode.Brake); leftBackSteer.setNeutralMode(NeutralMode.Brake);
rightBackSteer.setNeutralMode(NeutralMode.Brake); rightBackSteer.setNeutralMode(NeutralMode.Brake);
// initialize SwerveModules // initialize SwerveModules
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.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);
@@ -7,10 +7,12 @@ package frc4388.robot.subsystems;
import com.ctre.phoenix6.configs.Slot0Configs; import com.ctre.phoenix6.configs.Slot0Configs;
import com.ctre.phoenix6.controls.PositionVoltage; import com.ctre.phoenix6.controls.PositionVoltage;
import com.ctre.phoenix6.hardware.TalonFX; import com.ctre.phoenix6.hardware.TalonFX;
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;
import frc4388.robot.Constants.ClimbConstants; import frc4388.robot.Constants.ClimbConstants;
import frc4388.robot.Constants.IntakeConstants;
//! 6.5C Scoring Criteria for Stage //! 6.5C Scoring Criteria for Stage
@@ -21,6 +23,7 @@ public class Climber extends SubsystemBase {
public Climber(TalonFX climbMotor) { public Climber(TalonFX climbMotor) {
this.climbMotor = climbMotor; this.climbMotor = climbMotor;
this.climbMotor.setInverted(true); this.climbMotor.setInverted(true);
var slot0Configs = new Slot0Configs(); var slot0Configs = new Slot0Configs();
slot0Configs.kP = 0.7; // An error of 0.5 rotations results in 12 V output slot0Configs.kP = 0.7; // An error of 0.5 rotations results in 12 V output
slot0Configs.kI = 0.0; // no output for integrated error slot0Configs.kI = 0.0; // no output for integrated error
@@ -30,15 +33,17 @@ public class Climber extends SubsystemBase {
} }
public void climbOut() { public void climbOut() {
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_IN_SPEED);
climbMotor.set(Constants.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(Constants.ClimbConstants.CLIMB_IN_SPEED);
;
} }
public void stopClimb() { public void stopClimb() {
@@ -48,5 +53,6 @@ public class Climber extends SubsystemBase {
@Override @Override
public void periodic() { public void periodic() {
// This method will be called once per scheduler run // This method will be called once per scheduler run
SmartDashboard.putNumber("climber pos", climbMotor.getPosition().getValue());
} }
} }