Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…Code2024 into sofie-arm
  • Loading branch information
aaron345678 committed Mar 3, 2024
2 parents e00d3c1 + 3ecde74 commit f55615e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/org/carlmontrobotics/subsystems/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class Arm extends SubsystemBase {
private static double kDt = 0.02;

//PID, feedforward, trap profile
private final ArmFeedforward armFeed = new ArmFeedforward(kS, kV, kA);
private final ArmFeedforward armFeed = new ArmFeedforward(kS, kG, kV, kA);
private final SparkPIDController armPID1 = armMotorMaster.getPIDController();
private final SparkPIDController armPID2 = armMotorFollower.getPIDController();
private TrapezoidProfile armProfile = new TrapezoidProfile(TRAP_CONSTRAINTS);
Expand Down Expand Up @@ -95,6 +95,8 @@ public Arm() {
SmartDashboard.putData("Arm", this);

//armProfileTimer.start(); <-- don't neeed timer anymore

goalState = getCurrentArmState();

setArmTarget(goalState.position);
}
Expand Down Expand Up @@ -234,7 +236,8 @@ public TrapezoidProfile.State getCurrentArmGoal() {


public boolean armAtSetpoint() {
return armProfile.isFinished(armProfileTimer.get());
return Math.abs(getArmPos() - goalState.position) < POS_TOLERANCE_RAD &&
Math.abs(getArmVel() - goalState.velocity) < VEL_TOLERANCE_RAD_P_SEC;
}


Expand Down

0 comments on commit f55615e

Please sign in to comment.