-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge Drive Motor feed-forward from Dev
Finished XML config storage for our custom interpolation class
- Loading branch information
Showing
8 changed files
with
97 additions
and
35 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/main/deploy/configs/InterpolatedMotorFeedForward/DrivingMotorOpenLoop.xml
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,18 @@ | ||
<InterpolatedMotorFeedForward> | ||
<info> | ||
<interpolatedVariablesCount type="int">1</interpolatedVariablesCount> | ||
<length type="int">2</length> | ||
</info> | ||
|
||
<variable0> | ||
<name type="string">motorVelocity</name> | ||
<sample0 type="double">0</sample0> | ||
<sample1 type="double">4.8</sample1> | ||
</variable0> | ||
|
||
<variable1> | ||
<name type="string">motorPower</name> | ||
<sample0 type="double">0</sample0> | ||
<sample1 type="double">1</sample1> | ||
</variable1> | ||
</InterpolatedMotorFeedForward> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
package frc.robot.tests; | ||
|
||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | ||
import frc.robot.utils.Config.MapleConfigFile; | ||
import frc.robot.utils.Config.MapleInterpolationTable; | ||
|
||
import java.io.IOException; | ||
|
||
public class InterpolationTableTest implements UnitTest { | ||
private final MapleInterpolationTable testTable; | ||
public InterpolationTableTest() { | ||
testTable = new MapleInterpolationTable( | ||
"testTable", | ||
new MapleInterpolationTable.Variable("x", 1, 2, 3, 4), | ||
new MapleInterpolationTable.Variable("y", 2, 3, 4, 5) | ||
); | ||
try { | ||
testTable = MapleInterpolationTable.fromConfigFile(MapleConfigFile.fromDeployedConfig("InterpolatedMotorFeedForward", "DrivingMotorOpenLoop")); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public void testStart() { | ||
SmartDashboard.putNumber("InterpolationTables/testValueX", 1.0); | ||
SmartDashboard.putNumber("InterpolationTables/testValueVelocity", 1.0); | ||
} | ||
|
||
@Override | ||
public void testPeriodic() { | ||
final double x = SmartDashboard.getNumber("InterpolationTables/testValueX", 1.0); | ||
assert testTable != null; | ||
final double vel = SmartDashboard.getNumber("InterpolationTables/testValueVelocity", 1.0); | ||
SmartDashboard.putNumber( | ||
"InterpolationTables/testOutPutY", | ||
testTable.interpolateVariable("y", x) | ||
"InterpolationTables/testOutPutPower", | ||
testTable.interpolateVariable("motorPower", vel) | ||
); | ||
} | ||
} |
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