Skip to content

Commit

Permalink
Merge pull request #29 from chopshop-166/elevatorFill
Browse files Browse the repository at this point in the history
changed elevatorMaxHeight to the hard limit max and removed extra imports
  • Loading branch information
msoucy authored Jan 31, 2025
2 parents 79fc652 + 4ea4698 commit c87cb41
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import edu.wpi.first.networktables.DoubleSubscriber;
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.wpilibj.util.Color;
import frc.robot.maps.subsystems.ElevatorMap;
import frc.robot.maps.subsystems.AlgaeDestageMap.Data;
import frc.robot.subsystems.Elevator;

public class ElevatorFill extends AnimatedPattern {
private final Color color;
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/frc/robot/subsystems/Elevator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@

import com.chopshop166.chopshoplib.PersistenceCheck;
import com.chopshop166.chopshoplib.logging.LoggedSubsystem;
import com.chopshop166.chopshoplib.motors.Modifier;

import edu.wpi.first.math.controller.ElevatorFeedforward;
import edu.wpi.first.math.controller.ProfiledPIDController;
import edu.wpi.first.math.trajectory.TrapezoidProfile.State;
import edu.wpi.first.networktables.DoublePublisher;
import edu.wpi.first.networktables.DoubleSubscriber;
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.units.Units;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.maps.subsystems.ElevatorMap;
import frc.robot.maps.subsystems.ElevatorMap.Data;
Expand All @@ -28,7 +24,6 @@ public class Elevator extends LoggedSubsystem<Data, ElevatorMap> {
final double SLOW_DOWN_COEF = 0.5;
final double LOWER_SPEED = -0.15;
double holdHeight = 0;
double elevatorMaxHeight = 56.5;

NetworkTableInstance instance = NetworkTableInstance.getDefault();
DoublePublisher heightPub = instance.getDoubleTopic("Elevator/Height").publish();
Expand Down Expand Up @@ -113,7 +108,7 @@ public void safeState() {
@Override
public void periodic() {
super.periodic();
heightPub.set(getData().heightAbsInches / elevatorMaxHeight);
heightPub.set(getData().heightAbsInches / getMap().hardLimits.max());
if (level != ElevatorPresets.OFF) {
double targetHeight = level == ElevatorPresets.HOLD ? holdHeight : getMap().elevatorPreset.getValue(level);
double setpoint = pid.calculate(getElevatorHeight(), new State(targetHeight, 0));
Expand Down

0 comments on commit c87cb41

Please sign in to comment.