mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +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:
@@ -13,7 +13,6 @@
|
||||
#include "wpi/math/system/Models.hpp"
|
||||
#include "wpi/simulation/EncoderSim.hpp"
|
||||
#include "wpi/system/RobotController.hpp"
|
||||
#include "wpi/units/math.hpp"
|
||||
#include "wpi/units/time.hpp"
|
||||
|
||||
#define EXPECT_NEAR_UNITS(val1, val2, eps) \
|
||||
@@ -31,9 +30,9 @@ TEST(ElevatorSimTest, StateSpaceSim) {
|
||||
for (size_t i = 0; i < 100; ++i) {
|
||||
controller.SetSetpoint(2.0);
|
||||
auto nextVoltage = controller.Calculate(encoderSim.GetDistance());
|
||||
motor.Set(nextVoltage / wpi::RobotController::GetInputVoltage());
|
||||
motor.SetDutyCycle(nextVoltage / wpi::RobotController::GetInputVoltage());
|
||||
|
||||
wpi::math::Vectord<1> u{motor.Get() *
|
||||
wpi::math::Vectord<1> u{motor.GetDutyCycle() *
|
||||
wpi::RobotController::GetInputVoltage()};
|
||||
sim.SetInput(u);
|
||||
sim.Update(20_ms);
|
||||
|
||||
Reference in New Issue
Block a user