Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
penguin212 committed Feb 25, 2024
1 parent bb44341 commit ec2a5cb
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static class IntakeConstants {
public static final double encodermiddle = 1;
public static final double rollersclockwise = 1;
public static final double rollerscounterclockwise = 1;
public static final double sensorreached = .3;
public static final double sensorreached = .2;
public static final double pivotclockwise = 1;
public static final double pivotcounterclockwise = -1;
public static final double pastsensortime = 3;
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,17 @@ public RobotContainer() {
}

private void configureBindings() {

// xButton.onTrue(new InstantCommand(() -> intakePivotSubsystem.setPosition(.3), intakePivotSubsystem));

// rightBumper.onTrue(new InstantCommand(() -> intakePivotSubsystem.setPosition(0), intakePivotSubsystem));

// leftBumper.onTrue(new InstantCommand(() -> intakePivotSubsystem.setPosition(.85), intakePivotSubsystem));

aButton.onTrue(new InstantCommand(() -> intakePivotSubsystem.setPosition(.85), intakePivotSubsystem).alongWith(
new IntakeRollerIntakeCommand(intakeRollerSubsystem, ledSubsystem)));
new IntakeRollerIntakeCommand(intakeRollerSubsystem, ledSubsystem)).andThen(
new IntakeRollerFeedCommand(intakeRollerSubsystem).withTimeout(.2)
));

bButton.onTrue(new IdleCommand(intakePivotSubsystem, intakeRollerSubsystem,
elevatorSubsystem,
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/commands/IdleCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public IdleCommand(IntakePivotSubsystem intakePivotSubsystem,
// );

addCommands(new InstantCommand(() -> intakeRollersSubsystem.setAllRollSpeed(0, 0), intakeRollersSubsystem),
new ElevatorToGroundCommand(elevatorSubsystem),
// new ElevatorToGroundCommand(elevatorSubsystem),
new ShooterFlywheelStopCommand(shooterFlywheelSubsystem),
new InstantCommand(() -> intakePivotSubsystem.setPosition(0), intakePivotSubsystem),
new InstantCommand(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ShootModeSequence(
ShooterPivotSubsystem shooterPivotSubsystem,
LEDSubsystem ledSubsystem) {
addCommands(new ShooterFlywheelReadyCommand(shooterFlywheelSubsystem).alongWith(
new ElevatorToGroundCommand(elevatorSubsystem),
// new ElevatorToGroundCommand(elevatorSubsystem),
new ShooterPivotSetAngleCommand(shooterPivotSubsystem, Units.degreesToRadians(20)) // STUB FOR AUTOAIM
));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/subsystems/climb/ClimbArm.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void update() {
resetEncoder();

if (extensionEncoder.getPosition() == 0 && !zeroLimitSwitch.get())
System.out.println(this.toString() + "encoder uncalibrated!");
// System.out.println(this.toString() + "encoder uncalibrated!");

if (isAtExtension())
winchMotor.set(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ public class IntakePivotSubsystem extends SubsystemBase {
private final TalonFX pivotMotor;
// private final DigitalInput extendedlimitswitch;
// private final DigitalInput retractedlimitswitch;
private final Encoder intakeencoder;
// private final Encoder intakeencoder;
private PositionVoltage request = new PositionVoltage(0).withSlot(0);
private final double P = 1;
private final double I = 0;
private final double D = 0;
private final double CONVERSION_FACTOR = 0.2142; // TODO tune
private final double OFFSET = 0.9495;
private final double OFFSET = 0;// 0.9495;


/**
* Subsystem for controlling the pivot on the intake.
*/
public IntakePivotSubsystem() {
pivotMotor = new TalonFX(PIVOT_MOTOR_ID);
intakeencoder = new Encoder(1, 2);
// intakeencoder = new Encoder(1, 2);
// extendedlimitswitch = new DigitalInput(extendedlimitswitchID);
// retractedlimitswitch = new DigitalInput(retractedlimitswitchID);
Slot0Configs slot0Configs = new Slot0Configs();
Expand All @@ -37,6 +37,7 @@ public IntakePivotSubsystem() {
slot0Configs.kD = D;

pivotMotor.getConfigurator().apply(slot0Configs);
pivotMotor.setPosition(0);
}

/**
Expand All @@ -53,14 +54,14 @@ public void setPosition(double position) {
* resets encoder to zero.
*/
public void resetEncoder() {
intakeencoder.reset();
// pivotMotor.reset();
}

/**
* returns the encoder position.
*/
public double encoderPosition() {
return intakeencoder.get();
return pivotMotor.get();
}

/**
Expand Down Expand Up @@ -96,6 +97,6 @@ public void movePivot(double speed) {

@Override
public void periodic() {
System.out.println(pivotMotor.getClosedLoopReference());
// System.out.println(pivotMotor.getPosition().getValueAsDouble() * CONVERSION_FACTOR);
}
}
2 changes: 0 additions & 2 deletions src/main/java/frc/robot/subsystems/leds/LEDSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ public void periodic() {

OpacityColor noteColor = pieceSeen ? crossFadeWithTime(NOTE_COLOR, TRANSPARENT_COLOR, 1) : NOTE_COLOR;

System.out.println(notePosition);

switch (notePosition) {
case NONE:
noteLayer.fillColor(pieceSeen ? noteColor : new OpacityColor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void periodic() {
if (timer.advanceIfElapsed(.2)) {
//printCurrentAngle();
//System.out.println(Util.twoDecimals(Units.radiansToDegrees(getAutoAimAngle())));
System.out.println(rotationEncoder.getPosition());
// System.out.println(rotationEncoder.getPosition());
}

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

0 comments on commit ec2a5cb

Please sign in to comment.