Skip to content

Commit b143da9

Browse files
authoredDec 7, 2024··
Add Tag and type description for ValuedParameterDescriptor (#626)
Add test coverage
1 parent ee33170 commit b143da9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
 

‎src/main/java/robotbuilder/utils/YamlUtils.java

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class YamlUtils {
4545
tag.getClassName().equals(ListProperty.class.getName()) ||
4646
tag.getClassName().equals(TeamNumberProperty.class.getName()) ||
4747
tag.getClassName().equals(ParameterDescriptor.class.getName()) ||
48+
tag.getClassName().equals(ValuedParameterDescriptor.class.getName()) ||
4849

4950
tag.getClassName().equals(DistinctValidator.class.getName()) ||
5051
tag.getClassName().equals(ExistsValidator.class.getName()) ||
@@ -74,6 +75,7 @@ public class YamlUtils {
7475
constructor.addTypeDescription(new TypeDescription(ListProperty.class, "!ListProperty"));
7576
constructor.addTypeDescription(new TypeDescription(TeamNumberProperty.class, "!TeamNumberProperty"));
7677
constructor.addTypeDescription(new TypeDescription(ParameterDescriptor.class, "!ParameterDescriptor"));
78+
constructor.addTypeDescription(new TypeDescription(ValuedParameterDescriptor.class, "!ValuedParameterDescriptor"));
7779

7880
constructor.addTypeDescription(new TypeDescription(DistinctValidator.class, "!DistinctValidator"));
7981
constructor.addTypeDescription(new TypeDescription(ExistsValidator.class, "!ExistsValidator"));

‎src/test/java/robotbuilder/TestUtils.java

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
package robotbuilder;
33

44
import robotbuilder.data.RobotWalker;
5+
import robotbuilder.data.properties.ConstantsProperty;
6+
import robotbuilder.data.properties.ValuedParameterDescriptor;
57
import robotbuilder.exporters.GenericExporter;
68
import robotbuilder.robottree.RobotTree;
79

@@ -98,6 +100,9 @@ public static RobotTree generateTestTree() {
98100
wrist.add(wristMotor);
99101
RobotComponent pot = new RobotComponent("Pot", "Analog Potentiometer", tree);
100102
wrist.add(pot);
103+
ValuedParameterDescriptor setpoint = new ValuedParameterDescriptor("InSP", "double", 1.0);
104+
ConstantsProperty setpoints = new ConstantsProperty("Setpoints", List.of(setpoint), null, null);
105+
wrist.getProperty("Constants").setValueAndUpdate(setpoints);
101106

102107
// Create a misc subsystem
103108
RobotComponent misc = new RobotComponent("Misc", "Subsystem", tree);

0 commit comments

Comments
 (0)
Please sign in to comment.