diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 499918f..167c055 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -12,7 +12,7 @@ jobs: permissions: actions: read contents: write - security-events: write + security-events: write strategy: fail-fast: false @@ -83,5 +83,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: https://sonarcloud.io PACKAGE_FETCH_ACTOR: ${{ github.actor }} PACKAGE_FETCH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/main/java/poplib/subsytems/pivot/TalonPivot.java b/src/main/java/poplib/subsytems/pivot/TalonPivot.java index 2b24d9a..0c25eb3 100644 --- a/src/main/java/poplib/subsytems/pivot/TalonPivot.java +++ b/src/main/java/poplib/subsytems/pivot/TalonPivot.java @@ -1,12 +1,7 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - package poplib.subsytems.pivot; import com.ctre.phoenix6.controls.PositionDutyCycle; import com.ctre.phoenix6.hardware.TalonFX; - import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import poplib.control.FFConfig; import poplib.motor.FollowerConfig; @@ -35,7 +30,8 @@ public TalonPivot(MotorConfig leadConfig, FollowerConfig followerConfig, double position = new PositionDutyCycle(0.0); position.withSlot(leadMotor.getClosedLoopSlot().getValue()); - resetToAbsolutePosition(); + leadMotor.setPosition(0.0); + } public boolean atSetpoint(double error, double setpoint) { @@ -46,15 +42,20 @@ public double getError(double setpoint) { return Math.abs(leadMotor.getPosition().getValueAsDouble() - setpoint); } + public void updatePID() { + leadMotor.setControl(position.withPosition(super.setpoint.get()).withFeedForward(super.ff.getKg())); + } + @Override public void log() { super.log(); - SmartDashboard.putNumber("Lead Position 2 " + getName(), leadMotor.getPosition().getValueAsDouble()); + SmartDashboard.putNumber("Lead Position " + getName(), leadMotor.getPosition().getValueAsDouble()); } @Override public void periodic() { pid.updatePID(leadMotor); + leadMotor.setControl(position.withPosition(super.setpoint.get()).withFeedForward(super.ff.getKg())); leadMotor.setControl(position.withPosition(super.setpoint.get()).withFeedForward(super.ff.calculate( Math.toRadians(leadMotor.getPosition().getValueAsDouble()), 0.0 @@ -65,4 +66,4 @@ public void periodic() { public void resetToAbsolutePosition() { leadMotor.setPosition(getAbsolutePosition()); } -} \ No newline at end of file +}