Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions lib/src/main/java/com/team2813/lib2813/util/ControlUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.team2813.lib2813.util;

import edu.wpi.first.math.MathUtil;

/** Utility class for comon control-related utility functions. */
public class ControlUtils {
private ControlUtils() {
Expand All @@ -21,7 +23,9 @@ private ControlUtils() {
* @param deadband The deadband range value, must be in [0.0, 1.0).
* @return The deadbanded value.
* @throws IllegalArgumentException If the value or deadband is out of bounds.
* @deprecated Use edu.wpi.first.math.MathUtil.applyDeadband instead.
*/
@Deprecated(forRemoval = true)
public static double deadband(double value, double deadband) {
if (deadband < 0.0 || deadband >= 1.0) {
throw new IllegalArgumentException(
Expand All @@ -30,14 +34,6 @@ public static double deadband(double value, double deadband) {
if (value < -1.0 || value > 1.0) {
throw new IllegalArgumentException("Value must be in [-1.0, 1.0]. Instead, it was " + value);
}
if (Math.abs(value) <= deadband) {
return 0.0;
} else {
if (value > 0.0) {
return (value - deadband) / (1.0 - deadband);
} else {
return (value + deadband) / (1.0 - deadband);
}
}
return MathUtil.applyDeadband(value, deadband);
}
}
Loading