-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
278 additions
and
155 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
src/main/java/frc/robot/statemachine/states/tele/ScoreCoral.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/frc/robot/util/ConfigurableLinearInterpolation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package frc.robot.util; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
|
||
import me.nabdev.oxconfig.ConfigurableClass; | ||
import me.nabdev.oxconfig.ConfigurableClassParam; | ||
import me.nabdev.oxconfig.OxConfig; | ||
|
||
public class ConfigurableLinearInterpolation implements ConfigurableClass { | ||
ConfigurableClassParam<Double> x1; | ||
ConfigurableClassParam<Double> y1; | ||
ConfigurableClassParam<Double> x2; | ||
ConfigurableClassParam<Double> y2; | ||
private String key; | ||
private String prettyName; | ||
private final ArrayList<ConfigurableClassParam<?>> params = new ArrayList<>(); | ||
|
||
public ConfigurableLinearInterpolation(String key) { | ||
this.key = key; | ||
this.prettyName = key; | ||
x1 = new ConfigurableClassParam<Double>(this, 0.0, (x) -> { | ||
}, "x1"); | ||
y1 = new ConfigurableClassParam<Double>(this, 0.0, (x) -> { | ||
}, "y1"); | ||
x2 = new ConfigurableClassParam<Double>(this, 0.0, (x) -> { | ||
}, "x2"); | ||
y2 = new ConfigurableClassParam<Double>(this, 0.0, (x) -> { | ||
}, "y2"); | ||
Collections.addAll(params, x1, y1, x2, y2); | ||
OxConfig.registerConfigurableClass(this); | ||
|
||
} | ||
|
||
@Override | ||
public ArrayList<ConfigurableClassParam<?>> getParameters() { | ||
return params; | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return key; | ||
} | ||
|
||
@Override | ||
public String getPrettyName() { | ||
return prettyName; | ||
} | ||
|
||
public double calculate(double x) { | ||
return y1.get() + (y2.get() - y1.get()) * (x - x1.get()) / (x2.get() - x1.get()); | ||
} | ||
} |