Skip to content

Commit

Permalink
set custom angle command
Browse files Browse the repository at this point in the history
  • Loading branch information
siyoyoCode committed Feb 2, 2024
1 parent 71418ac commit 17abb8b
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package frc.robot.commands.shooter.pivot;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.shooter.ShooterPivotSubsystem;

public class ShooterPivotSetAngle extends Command{
ShooterPivotSubsystem pivotSubsystem;
double angle;

public ShooterPivotSetAngle(ShooterPivotSubsystem pivotSubsystem, double angle){
this.pivotSubsystem = pivotSubsystem;
addRequirements(pivotSubsystem);
this.angle = angle;
}

@Override
public void initialize() {
pivotSubsystem.setAutoAimBoolean(false);
pivotSubsystem.setAngle(angle);
}

@Override
public boolean isFinished() {
if(Math.abs(pivotSubsystem.getPosition()) - angle < pivotSubsystem.ERRORTOLERANCE){
return true;
}

return false;
}
}

0 comments on commit 17abb8b

Please sign in to comment.