Skip to content

Commit

Permalink
Added feedforward to pivot
Browse files Browse the repository at this point in the history
  • Loading branch information
audreypj committed Sep 18, 2024
1 parent 72fe070 commit 6df6f1b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/frc/robot/subsystems/PivotSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public PivotSubsystem() {
pivotMotor.setInverted(true);
pivotMotor.clearStickyFaults();
pivotMotor.set(0);
pivotMotor.setPosition(0);

pivotMotor.setNeutralMode(NeutralModeValue.Brake);

Expand Down Expand Up @@ -153,6 +154,11 @@ public double getAngularError() {
return targetDegrees - getCurrentAngle();
}

public void setPower(double power){
this.power = power;
}


@Override
public void periodic() {

Expand All @@ -170,6 +176,6 @@ public void periodic() {

pidVoltageOutput = MathUtil.clamp(pidOutput + getFeedForward(), -10, 10);

pivotMotor.setVoltage(pidVoltageOutput);
pivotMotor.set(getFeedForward()+power);
}
}

0 comments on commit 6df6f1b

Please sign in to comment.