Skip to content

Commit

Permalink
qdded some idk its about eauqtion or smt
Browse files Browse the repository at this point in the history
  • Loading branch information
EnguerranSorin committed Dec 6, 2023
1 parent 5239b8e commit 158f419
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ public static class Intake {
}

public static class Elevator{
public static final double GEAR_RATIO = 0.1008;
public static final double ELEVATOR_GEAR_RATIO = 0.1008;

private static final double CARRIAGE_RATIO = 2;

private static final double ELEVATOR_SPROCKET_DIAMETER_INCHES = 1.432;

private static final double FALCON_CPR = 2048;

/**number of ticks per motor revolution */
public static final double TICKS = 2048;
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/frc/robot/Subsystems/ElevatorSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
import frc.robot.Constants.Elevator;

// private PIDController controller;
Expand Down Expand Up @@ -57,10 +58,14 @@ public ElevatorSubsystem() {


public static double inchesToTicks(double height) {
return height * ((Elevator.GEAR_RATIO * Elevator.TICKS) / (Elevator.GEAR_CIRCUMFERENCE));
return Elevator.CARRIAGE_RATIO
* (Elevator.ELEVATOR_SPROCKET_DIAMETER_INCHES * Math.PI)
* ((ticks / Elevator.FALCON_CPR) * Elevator.ELEVATOR_GEAR_RATIO);
}
public static double ticksToInches(double ticks) {
return (ticks * Elevator.GEAR_CIRCUMFERENCE) / (Elevator.TICKS * Elevator.GEAR_RATIO);
return Elevator.CARRIAGE_RATIO
* (Elevator.ELEVATOR_SPROCKET_DIAMETER_INCHES * Math.PI)
* ((ticks / Elevator.FALCON_CPR) * Elevator.ELEVATOR_GEAR_RATIO);
}
public void setTargetHeight(double targetHeight){
this.targetHeight = targetHeight;
Expand Down

0 comments on commit 158f419

Please sign in to comment.