Skip to content

Commit

Permalink
End of Tippecanoe Comp
Browse files Browse the repository at this point in the history
  • Loading branch information
rar1741programmer committed Mar 26, 2023
1 parent 44b5bb6 commit 49a30c4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 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 @@ -121,7 +121,7 @@ public static class Wrist {
public static final double k_minAngle = Units.degreesToRadians(-360.0);
public static final double k_maxAngle = Units.degreesToRadians(360.0);

public static final double k_offset = 0.311455;
public static final double k_offset = 0.144028;
}

public static enum Preset {
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,16 @@ public void teleopPeriodic() {
m_operatorController.getArmVerticalChange(0.5));
}

if (m_operatorController.getRawButtonPressed(6)) {
if (m_operatorController.getWantsWristRotate()) {
m_arm.rotateWrist();
}

if (m_operatorController.getWantsWristCorrectionClockwise()) {
m_arm.rotateWrist(1);
} else if (m_operatorController.getWantsWristCorrectionCounterClockwise()) {
m_arm.rotateWrist(-1);
}

if (m_operatorController.getWantsDefaultState()) {
m_arm.generateTrajectoryToPose(Constants.Arm.Preset.HOME.getPose());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,16 @@ public boolean getWantsMidCubeScore() {
public boolean getWantsElbowChange() {
return this.getRawButton(7);
}

public boolean getWantsWristRotate() {
return this.getRawButtonPressed(6);
}

public boolean getWantsWristCorrectionClockwise() {
return this.getFilteredAxis(3) > 0.5;
}

public boolean getWantsWristCorrectionCounterClockwise() {
return this.getFilteredAxis(2) > 0.5;
}
}
4 changes: 4 additions & 0 deletions src/main/java/frc/robot/subsystems/arm/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ public void rotateWrist() {
m_periodicIO.wristAngle -= 90;
}

public void rotateWrist(double change) {
m_periodicIO.wristAngle += change;
}

public void setWristAngle(double wristAngle) {
m_periodicIO.wristAngle = wristAngle;
}
Expand Down

0 comments on commit 49a30c4

Please sign in to comment.