Merge branch 'main' into 2027

This commit is contained in:
Peter Johnson
2025-11-29 10:41:16 -08:00
8 changed files with 41 additions and 17 deletions

View File

@@ -124,4 +124,16 @@ class ElevatorSimTest {
sim.getPosition(),
0.01);
}
@Test
void testCurrentDraw() {
var motor = DCMotor.getKrakenX60(2);
var sim = new ElevatorSim(motor, 20, 8.0, 0.1, 0.0, 1.0, true, 0.0, 0.01, 0.0);
assertEquals(0.0, sim.getCurrentDrawAmps());
sim.setInputVoltage(motor.getVoltage(motor.getTorque(60.0), 0.0));
sim.update(0.100);
// current draw should start at 60 A and decrease as the back emf catches up
assertTrue(0.0 < sim.getCurrentDrawAmps() && sim.getCurrentDrawAmps() < 60.0);
}
}