mirror of
https://github.com/Team4388/2022NoWayHome.git
synced 2026-06-09 08:48:07 -06:00
added limit switch and soft limit
-ryan
This commit is contained in:
@@ -8,16 +8,35 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import frc4388.robot.Constants.ClimberConstants;
|
||||
import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
|
||||
import com.ctre.phoenix.motorcontrol.LimitSwitchSource;
|
||||
|
||||
public class Climber extends SubsystemBase {
|
||||
private WPI_TalonFX elbow;
|
||||
|
||||
/** Creates a new Climber */
|
||||
public Climber(WPI_TalonFX elbow) { this.elbow = elbow; }
|
||||
|
||||
public void setEncoders(double value) { this.elbow.setSelectedSensorPosition(value); }
|
||||
public double getCurrent() { return this.elbow.getSupplyCurrent(); }
|
||||
public void setMotors(double elbowOutput) { this.elbow.set(elbowOutput * ClimberConstants.INPUT_MULTIPLIER); }
|
||||
public Climber(WPI_TalonFX elbow) {
|
||||
this.elbow = elbow;
|
||||
elbow.configReverseLimitSwitchSource(LimitSwitchSource.FeedbackConnector, LimitSwitchNormal.NormallyOpen);
|
||||
elbow.overrideLimitSwitchesEnable(true);
|
||||
|
||||
elbow.configForwardSoftLimitThreshold(ClimberConstants.ELBOW_FORWARD_SOFT_LIMIT);
|
||||
elbow.configForwardSoftLimitEnable(true);
|
||||
}
|
||||
|
||||
public void setEncoders(double value) {
|
||||
this.elbow.setSelectedSensorPosition(value);
|
||||
}
|
||||
|
||||
public double getCurrent() {
|
||||
return this.elbow.getSupplyCurrent();
|
||||
}
|
||||
|
||||
public void setMotors(double elbowOutput) {
|
||||
this.elbow.set(elbowOutput * ClimberConstants.INPUT_MULTIPLIER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void periodic() {}
|
||||
public void periodic() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user