Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
WIP prepare for shooter pivot.
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenheroux committed Feb 24, 2024
1 parent f1854c0 commit 6291725
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 16 deletions.
12 changes: 12 additions & 0 deletions simgui.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,27 @@
"transitory": {
"Shuffleboard": {
"Arm": {
"Derivatives": {
"open": true
},
"Feedforward": {
"open": true
},
"Goal": {
"open": true
},
"Position": {
"open": true
},
"Setpoint": {
"open": true
},
"Velocities": {
"open": true
},
"Voltages": {
"open": true
},
"open": true
},
"Climber": {
Expand Down
26 changes: 14 additions & 12 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,20 @@ private void configureBindings() {
driverController.y().onTrue(odometry.tare());
driverController.x().whileTrue(swerve.cross());

operatorController
.leftTrigger()
.whileTrue(
Commands.parallel(arm.to(ArmState.INTAKE), intake.out())
.andThen(Commands.parallel(intake.intake(), shooter.intake()))).onFalse(Commands.runOnce(() -> {
intake.setPivotGoal(PivotMotorConstants.MAXIMUM_ANGLE);
arm.setGoal(ArmState.STOW);
}));

operatorController
.rightTrigger()
.whileTrue(Commands.parallel(arm.to(ArmState.SHOOT)).andThen(shooter.shoot())).onFalse(Commands.runOnce(() -> arm.setGoal(ArmState.STOW)));
// operatorController
// .leftTrigger()
// .whileTrue(
// Commands.parallel(arm.to(ArmState.INTAKE), intake.out())
// .andThen(Commands.parallel(intake.intake(), shooter.intake()))).onFalse(Commands.runOnce(() -> {
// intake.setPivotGoal(PivotMotorConstants.MAXIMUM_ANGLE);
// arm.setGoal(ArmState.STOW);
// }));

// operatorController
// .rightTrigger()
// .whileTrue(arm.to(ArmState.SHOOT).andThen(shooter.shoot())).onFalse(Commands.runOnce(() -> arm.setGoal(ArmState.STOW)));

operatorController.a().whileTrue(arm.driveWrist(operatorController::getLeftY));
}

/**
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/frc/robot/arm/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import edu.wpi.first.wpilibj2.command.Commands;
import frc.lib.Subsystem;
import frc.lib.Telemetry;
import frc.robot.RobotConstants;
import frc.robot.RobotMechanisms;
import frc.robot.arm.WristMotorIO.WristMotorIOValues;
import frc.robot.arm.ShoulderMotorIO.ShoulderMotorIOValues;
import java.util.function.DoubleSupplier;

/** Subsystem class for the arm subsystem. */
public class Arm extends Subsystem {
Expand Down Expand Up @@ -67,7 +67,7 @@ public void periodic() {
shoulderMotor.update(shoulderMotorValues);
wristMotor.update(wristMotorValues);

setSetpoint(getSetpoint().nextSetpoint(goal));
setSetpoint(setpoint.nextSetpoint(goal));

RobotMechanisms.getInstance().setArmState(getPosition());
}
Expand Down Expand Up @@ -167,4 +167,8 @@ private void setSetpoint(ArmState setpoint) {
public Command to(ArmState goal) {
return runOnce(() -> setGoal(goal)).andThen(Commands.waitUntil(this::atGoal));
}

public Command driveWrist(DoubleSupplier joystick) {
return run(() -> wristMotor.setVoltage(-joystick.getAsDouble() * 4));
}
}
3 changes: 1 addition & 2 deletions src/main/java/frc/robot/arm/WristMotorIOSparkMax.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ public void setSetpoint(double positionRotations, double velocityRotationsPerSec

@Override
public void setVoltage(double volts) {
// TODO disabled for working on wrist
// sparkMax.setVoltage(volts);
sparkMax.setVoltage(volts);
}

@Override
Expand Down

0 comments on commit 6291725

Please sign in to comment.