Skip to content

Commit

Permalink
Finished Even Sillier Nick Stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-McCann40 committed Jan 18, 2025
1 parent 23e45b2 commit 0396fa2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/main/java/frc/robot/subsystems/EndEffecter/EndEffecter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package frc.robot.subsystems.EndEffecter;

import java.util.function.DoubleSupplier;

import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
Expand Down Expand Up @@ -32,28 +34,26 @@ public EndEffecter(EndEffecterIO io) {
this.io = io;
}

public Command pivot(LevelAngle levelAngles) {
return null;
}

public Command manualpivot(double desiredspeed) {
return null;
}

public Command scoreL1() {
return Commands.run(() -> pivot(levelAngles.L1) , this).withName("Set wrist to L1 Scoring position");
public Command scoreL1(DoubleSupplier robotDistance) {
return Commands.run(() -> io.setAngle(calculateAngleForDist(robotDistance.getAsDouble(), LevelAngle.L1)), this).withName("Set wrist to L1 Scoring position");
}

public Command scoreL2AndL3() {
return null;
public Command scoreL2AndL3(DoubleSupplier robotDistance) {
return Commands.run(() -> io.setAngle(calculateAngleForDist(robotDistance.getAsDouble(), LevelAngle.L23)), this).withName("Set wrist to L1 Scoring position");
}

public Command scoreL4() {
return null;
public Command scoreL4(DoubleSupplier robotDistance) {
return Commands.run(() -> io.setAngle(calculateAngleForDist(robotDistance.getAsDouble(), LevelAngle.L4)), this).withName("Set wrist to L1 Scoring position");
}

private double calculateAngleForDist(double robotDist, LevelAngle desiredLevel){

double angleForDist = ((desiredLevel.farAngle-desiredLevel.closeAngle) / (desiredLevel.farDist-desiredLevel.closeDist))*(robotDist - desiredLevel.closeDist) + desiredLevel.closeAngle;
return angleForDist;
}

}

0 comments on commit 0396fa2

Please sign in to comment.