Skip to content

Commit

Permalink
NOT FUNCTIONAL! Update to hanger
Browse files Browse the repository at this point in the history
Do not use this code yet, it is a placeholder.
  • Loading branch information
Zr6573 committed Feb 2, 2024
1 parent f1de270 commit 7ba38f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public static class DriverConstants {
// max angular velocity for drivetrain, in radians per second
public static final double[] maxSpeedOptionsRotation = {0.1, 0.75, 1};
}

public static class HangerContstants {
public static final double HANGER_PID_P = 0;
public static final double HANGER_PID_I = 0;
public static final double HANGER_PID_D = 0;
}

public static class RobotMovementConstants {
public static final double maxSpeed = 1;
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/frc/robot/subsystems/Hanger.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.revrobotics.CANSparkLowLevel.MotorType;

import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj2.command.SubsystemBase;


Expand All @@ -15,26 +16,23 @@ public class Hanger extends SubsystemBase {
private final CANcoder hangerEncoder;
private final PIDController hangerPIDController;
private final StatusSignal<Double> hangerPosition;

int hangerMotorID;
int hangerEncoderID;
int p;
int i;
int d;
private final Joystick joystick;

public Hanger(int hangerMotorID, int hangerEncoderID) {
public Hanger(int hangerMotorID, int hangerEncoderID, int HANGER_PID_P, int HANGER_PID_I, int HANGER_PID_D) {

hangerMotor = new CANSparkMax(hangerMotorID, MotorType.kBrushless);
hangerEncoder = new CANcoder(hangerEncoderID);

hangerPIDController = new PIDController(p, i, d);
hangerPIDController = new PIDController(HANGER_PID_P, HANGER_PID_I, HANGER_PID_D);

hangerPosition = hangerEncoder.getAbsolutePosition();

joystick = new Joystick(OPERATOR_JOYSTICK_PORT);
}

@Override
public void periodic() {

whileTrue()
}

}

0 comments on commit 7ba38f1

Please sign in to comment.