File tree Expand file tree Collapse file tree
src/main/java/frc/robot/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,9 +63,16 @@ else if (lowerLimit != null && m_desiredHeight < currentLimit.getKey()) { // goi
6363 pivotLimits = currentLimit .getValue ();
6464 }
6565
66- final double pivotPosition = MathUtil .clamp (m_endEffectorSubsystem .getSetpoint (), pivotLimits .getFirst (),
66+
67+ // first clamp using setpoint limit
68+ final double pivotPositionSetpointClamped = MathUtil .clamp (m_endEffectorSubsystem .getSetpoint (), pivotLimits .getFirst (),
6769 pivotLimits .getSecond ());
68- m_endEffectorSubsystem .pivotTo (pivotPosition );
70+
71+ // then clamp with current limit
72+ final double pivotPositionClamped = MathUtil .clamp (pivotPositionSetpointClamped , currentLimit .getValue ().getFirst (),
73+ currentLimit .getValue ().getSecond ());
74+
75+ m_endEffectorSubsystem .pivotTo (pivotPositionClamped );
6976 }
7077
7178 // Called once the command ends or is interrupted.
You can’t perform that action at this time.
0 commit comments