mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
[wpimath] Replace Speeds with Velocities (#8479)
I left "free speed" alone since that's the technical term for it. In general, velocity is a vector quantity, and speed is a magnitude (i.e., a strictly positive value). This PR also replaces the speed verbiage in MotorController with duty cycle. Fixes #8423.
This commit is contained in:
@@ -142,7 +142,7 @@ class ArmSimulationTest {
|
||||
// advance 75 timesteps
|
||||
SimHooks.stepTiming(3.5);
|
||||
|
||||
assertEquals(0.0, m_motorSim.getSpeed(), 0.01);
|
||||
assertEquals(0.0, m_motorSim.getDutyCycle(), 0.01);
|
||||
assertEquals(Constants.kMinAngleRads, m_encoderSim.getDistance(), 2.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ class ElevatorSimulationTest {
|
||||
// advance 75 timesteps
|
||||
SimHooks.stepTiming(1.5);
|
||||
|
||||
assertEquals(0.0, m_motorSim.getSpeed(), 0.05);
|
||||
assertEquals(0.0, m_motorSim.getDutyCycle(), 0.05);
|
||||
assertEquals(0.0, m_encoderSim.getDistance(), 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class PotentiometerPIDTest {
|
||||
HAL.registerSimPeriodicBeforeCallback(
|
||||
() -> {
|
||||
m_elevatorSim.setInputVoltage(
|
||||
m_motorSim.getSpeed() * RobotController.getBatteryVoltage());
|
||||
m_motorSim.getDutyCycle() * RobotController.getBatteryVoltage());
|
||||
m_elevatorSim.update(0.02);
|
||||
|
||||
/*
|
||||
|
||||
@@ -47,14 +47,14 @@ class IntakeTest {
|
||||
m_intake.retract(); // close the intake
|
||||
m_intake.activate(0.5); // try to activate the motor
|
||||
assertEquals(
|
||||
0.0, m_simMotor.getSpeed(), DELTA); // make sure that the value set to the motor is 0
|
||||
0.0, m_simMotor.getDutyCycle(), DELTA); // make sure that the value set to the motor is 0
|
||||
}
|
||||
|
||||
@Test
|
||||
void worksWhenOpen() {
|
||||
m_intake.deploy();
|
||||
m_intake.activate(0.5);
|
||||
assertEquals(0.5, m_simMotor.getSpeed(), DELTA);
|
||||
assertEquals(0.5, m_simMotor.getDutyCycle(), DELTA);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user