Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Merge pull request #73 from chopshop-166/wheel-testing-h
Browse files Browse the repository at this point in the history
Drive wheel testing function
  • Loading branch information
msoucy authored Oct 27, 2023
2 parents 3fb64db + 1fc1dd2 commit 3066c6d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/ArmPresets.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public enum ArmPresets {
76.3),

// Human Player Station = HPS
HPS_PICKUP(0, 77,
72),
HPS_PICKUP(0, 76.3,
71.3),

ARM_STOWED(1, 2, 1),

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/frc/robot/Auto.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ public CommandBase prepareToScoreCone() {
armRotate.moveTo(ArmPresets.HIGH_SCORE));
}

public CommandBase testDriveDriver() {
return sequence(
drive.moveForDirectional(0, 1, 5),
drive.moveForDirectional(1, 0, 5),
drive.moveForDirectional(0, -1, 5),
drive.moveForDirectional(-1, 0, 5));
}

public CommandBase stowArmCloseIntake() {
return sequence(
armExtend.moveTo(ArmPresets.ARM_STOWED),
Expand Down
20 changes: 16 additions & 4 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ public CommandBase rumbleAndIntakeSpinningOff() {
public CommandBase pickUpGamePiece = sequence(
new ConditionalCommand(
sequence(
armRotate.moveTo(ArmPresets.CONE_PICKUP), armExtend.moveTo(ArmPresets.CONE_PICKUP)),
armRotate.moveTo(ArmPresets.CONE_PICKUP), armExtend.moveTo(ArmPresets.CONE_PICKUP),
intake.toggle()),
sequence(
armRotate.moveTo(ArmPresets.CUBE_PICKUP), armExtend.moveTo(
ArmPresets.CUBE_PICKUP),
intake.coneRelease()),
intake.coneRelease(), intake.toggle()),
() -> {
return gamePieceSub.get() == "Cone";
}));
Expand Down Expand Up @@ -225,8 +226,19 @@ public void configureButtonBindings() {
driveController.x().whileTrue(drive.rotateToAngle(Rotation2d.fromDegrees(180), () -> 0, () -> 0));
driveController.a().whileTrue(drive.rotateToAngle(Rotation2d.fromDegrees(0), () -> 0, () -> 0));

(new Trigger(() -> driveController.getRightTriggerAxis() > 0.5))
.onTrue(balanceArm.pushDown()).onFalse(balanceArm.pushUp());
driveController.povDown().onTrue(drive.moveForDirectional(0, 1, 5));
driveController.povRight().onTrue(drive.moveForDirectional(1, 0, 5));
driveController.povUp().onTrue(drive.moveForDirectional(0, -1, 5));
driveController.povLeft().onTrue(drive.moveForDirectional(-1, 0, 5));
/*
* public CommandBase testDriveDriver() {
* return sequence(
* moveForDirectional(0, 1, 5),
* moveForDirectional(1, 0, 5),
* moveForDirectional(0, -1, 5),
* moveForDirectional(-1, 0, 5));
* }
*/
// Arm

// COPILOT CONTROLLER
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/maps/FrostBiteMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public ArmRotateMap getArmRotateMap() {
absEncoder.setDutyCycleRange(1.0 / 1025.0, 1024.0 / 1025.0);
absEncoder.setDistancePerRotation(-360);
// Adjust this to move the encoder zero point to the retracted position
absEncoder.setPositionOffset(91.89780758483522 - 7);
absEncoder.setPositionOffset(54.8);

CSFusedEncoder fusedEncoder = new CSFusedEncoder(encoder, absEncoder);

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/frc/robot/subsystems/Drive.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.chopshop166.chopshoplib.commands.FunctionalWaitCommand;
import com.chopshop166.chopshoplib.commands.SmartSubsystemBase;

import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Rotation3d;
Expand Down Expand Up @@ -395,6 +394,12 @@ public CommandBase balance() {

}

public CommandBase moveForDirectional(double xSpeed, double ySpeed, double seconds) {
return race(
driveRaw(() -> xSpeed, () -> ySpeed, () -> 0),
new FunctionalWaitCommand(() -> seconds)).andThen(safeStateCmd());
}

public CommandBase resetGyroCommand() {
return cmd().onInitialize(() -> {
resetGyro();
Expand Down

0 comments on commit 3066c6d

Please sign in to comment.