Skip to content

Commit

Permalink
got rid of follower pid
Browse files Browse the repository at this point in the history
  • Loading branch information
sofiebudman committed Mar 3, 2024
1 parent b1b5d42 commit 69a70a9
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/main/java/org/carlmontrobotics/subsystems/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public class Arm extends SubsystemBase {
// rel offset = starting absolute offset
private final ArmFeedforward armFeed = new ArmFeedforward(kS, kG, kV, kA);
private final SparkPIDController armPIDMaster = armMotorMaster.getPIDController();
private final SparkPIDController armPIDFollower = armMotorFollower.getPIDController();
private static TrapezoidProfile.State setPoint;

private TrapezoidProfile armProfile = new TrapezoidProfile(TRAP_CONSTRAINTS);
Expand All @@ -90,9 +89,7 @@ public Arm() {
armPIDMaster.setP(kP);
armPIDMaster.setI(kI);
armPIDMaster.setD(kD);
armPIDFollower.setP(kP);
armPIDFollower.setI(kI);
armPIDFollower.setD(kD);


armFollowEncoder.setPosition(armMasterEncoder.getPosition());

Expand All @@ -103,10 +100,8 @@ public Arm() {
armPIDMaster.setPositionPIDWrappingMinInput(LOWER_ANGLE_LIMIT);
armPIDMaster.setPositionPIDWrappingMaxInput(UPPER_ANGLE_LIMIT);
//two PIDs?
armPIDFollower.setFeedbackDevice(armMotorFollower.getEncoder());
// armPIDFollower.setPositionPIDWrappingEnabled(true);
// armPIDFollower.setPositionPIDWrappingMinInput(LOWER_ANGLE_LIMIT - Math.PI); //Wierd math, im not sure it this works but basically
// armPIDFollower.setPositionPIDWrappingMaxInput(UPPER_ANGLE_LIMIT - Math.PI);// since absolute is between -180 and 180 and relative is between 0 and 360(correct me if im wrong) so if we subract 180, then its the same



SmartDashboard.putData("Arm", this);

Expand Down Expand Up @@ -170,7 +165,7 @@ private void driveArm(){
armFeedVolts = armFeed.calculate(getCurrentArmGoal().position, 0);
}
armPIDMaster.setReference(setPoint.position, CANSparkBase.ControlType.kVelocity, 0, armFeedVolts);
armPIDFollower.setReference(setPoint.position, CANSparkBase.ControlType.kVelocity, 0, armFeedVolts);

}

public void setArmTarget(double targetPos) {
Expand Down

0 comments on commit 69a70a9

Please sign in to comment.