|
9 | 9 | import static edu.wpi.first.units.Units.Meters; |
10 | 10 | import static edu.wpi.first.units.Units.MetersPerSecond; |
11 | 11 | import static edu.wpi.first.units.Units.MetersPerSecondPerSecond; |
| 12 | +import static org.frc6423.lib.utilities.CtreUtils.*; |
12 | 13 | import static org.frc6423.robot.subsystems.superstructure.elevator.Elevator.CANBUS; |
13 | 14 | import static org.frc6423.robot.subsystems.superstructure.elevator.Elevator.CHILD_MOTOR_ID; |
14 | 15 | import static org.frc6423.robot.subsystems.superstructure.elevator.Elevator.MAX_ACCELERATION; |
@@ -70,8 +71,8 @@ public ElevatorIOReal() { |
70 | 71 | conf.MotionMagic.MotionMagicCruiseVelocity = MAX_VELOCITY.in(MetersPerSecond); |
71 | 72 | conf.MotionMagic.MotionMagicAcceleration = MAX_ACCELERATION.in(MetersPerSecondPerSecond); |
72 | 73 |
|
73 | | - parent.getConfigurator().apply(conf); |
74 | | - child.getConfigurator().apply(conf); |
| 74 | + tryUntilOk(() -> parent.getConfigurator().apply(conf), 10, PARENT_MOTOR_ID); |
| 75 | + tryUntilOk(() -> child.getConfigurator().apply(conf), 10, CHILD_MOTOR_ID); |
75 | 76 | child.setControl(new Follower(parent.getDeviceID(), true)); |
76 | 77 |
|
77 | 78 | parentPoseSig = parent.getPosition(); |
@@ -143,8 +144,9 @@ public void setGains(double kG, double kS, double kV, double kA, double kP, doub |
143 | 144 | conf.Slot0.kP = kP; |
144 | 145 | conf.Slot0.kD = kD; |
145 | 146 |
|
146 | | - parent.getConfigurator().apply(conf); |
147 | | - child.getConfigurator().apply(conf); |
| 147 | + // I think the configurator will only apply if the config is different so this should be fine |
| 148 | + tryUntilOk(() -> parent.getConfigurator().apply(conf), 10, PARENT_MOTOR_ID); |
| 149 | + tryUntilOk(() -> child.getConfigurator().apply(conf), 10, CHILD_MOTOR_ID); |
148 | 150 | } |
149 | 151 |
|
150 | 152 | @Override |
|
0 commit comments