Skip to content

Commit

Permalink
Added sme mathutil thing
Browse files Browse the repository at this point in the history
  • Loading branch information
EnguerranSorin committed Dec 5, 2023
1 parent ca2a88e commit b4da06a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/frc/robot/Subsystems/ElevatorSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.ctre.phoenix.motorcontrol.TalonFXControlMode;
import com.ctre.phoenix.motorcontrol.can.TalonFX;

import edu.wpi.first.math.MathUtil;
import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
Expand Down Expand Up @@ -61,8 +62,8 @@ public void periodic() {
// This method will be called once per scheduler run
double ticks = leftMotor.getSelectedSensorPosition();
motorPower = controller.calculate(ticksToInches(ticks), targetHeight);
leftMotor.set(TalonFXControlMode.PercentOutput, motorPower);
rightMotor.set(TalonFXControlMode.PercentOutput, motorPower);
leftMotor.set(TalonFXControlMode.PercentOutput, MathUtil.clamp(motorPower, -0.75, 0.75));
rightMotor.set(TalonFXControlMode.PercentOutput, MathUtil.clamp(motorPower, -0.75, 0.75));
currentHeight = ticksToInches(-leftMotor.getSelectedSensorPosition());
}

Expand Down

0 comments on commit b4da06a

Please sign in to comment.