Skip to content

Commit

Permalink
Not much
Browse files Browse the repository at this point in the history
Finished the Current Angle and incorporated it in to shuffleboard
  • Loading branch information
nolandatall committed Dec 6, 2023
1 parent cb1781d commit cd6e81b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/frc/robot/subsystems/WristSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ public class WristSubsystem extends SubsystemBase {

private double targetAngle;
private double motorPower;
private double currentAngle;


//creates the WristSubsystem
public WristSubsystem() {
motor = new TalonFX(16);
motorPower = 0;
targetAngle = 0; //sets the "targetAngle" variable to 0 by default
currentAngle = 0; //sets the current height that you are at to 0 by defualt


//creates the new PID :) WOOHOOOO
Expand All @@ -40,6 +42,7 @@ public WristSubsystem() {
//
WristTab.addNumber("Current Motor Power", () -> motorPower);
WristTab.addNumber("Target Angle", () -> this.targetAngle);
WristTab.addNumber("Current Angle", () -> this.currentAngle);
}


Expand All @@ -59,7 +62,8 @@ public void setTargetAngle(double targetAngle) {
//periodic every 20ms it does this stuff...
@Override
public void periodic() {
motorPower = pidController.calculate(motorPower); //calculates the motor power based on the PID?
currentAngle = this.ticksToInches(motor.getSelectedSensorPosition());
motorPower = pidController.calculate(currentAngle); //calculates the motor power based on the PID?
motor.set(TalonFXControlMode.PercentOutput, motorPower);
// ^ basically makes it so whatever the motor power is it actually moves the motor :0

Expand Down

0 comments on commit cd6e81b

Please sign in to comment.