[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:
Tyler Veness
2026-03-06 14:19:15 -08:00
committed by GitHub
parent 1e39f39128
commit 9bd9656871
594 changed files with 8073 additions and 7875 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
/*

View File

@@ -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