mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpimath] Add full state support to LinearSystemId functions (#6554)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
committed by
GitHub
parent
7fbbecb5b7
commit
7fc17811fa
@@ -28,7 +28,7 @@ TEST(LinearQuadraticRegulatorTest, ElevatorGains) {
|
||||
// Gear ratio
|
||||
constexpr double G = 40.0 / 40.0;
|
||||
|
||||
return frc::LinearSystemId::ElevatorSystem(motors, m, r, G);
|
||||
return frc::LinearSystemId::ElevatorSystem(motors, m, r, G).Slice(0);
|
||||
}();
|
||||
Matrixd<1, 2> K =
|
||||
LinearQuadraticRegulator<2, 1>{plant, {0.02, 0.4}, {12.0}, 5.05_ms}.K();
|
||||
@@ -50,8 +50,9 @@ TEST(LinearQuadraticRegulatorTest, ArmGains) {
|
||||
// Gear ratio
|
||||
constexpr double G = 100.0;
|
||||
|
||||
return frc::LinearSystemId::SingleJointedArmSystem(
|
||||
motors, 1.0 / 3.0 * m * r * r, G);
|
||||
return frc::LinearSystemId::SingleJointedArmSystem(motors,
|
||||
1.0 / 3.0 * m * r * r, G)
|
||||
.Slice(0);
|
||||
}();
|
||||
|
||||
Matrixd<1, 2> K =
|
||||
@@ -75,7 +76,7 @@ TEST(LinearQuadraticRegulatorTest, FourMotorElevator) {
|
||||
// Gear ratio
|
||||
constexpr double G = 14.67;
|
||||
|
||||
return frc::LinearSystemId::ElevatorSystem(motors, m, r, G);
|
||||
return frc::LinearSystemId::ElevatorSystem(motors, m, r, G).Slice(0);
|
||||
}();
|
||||
Matrixd<1, 2> K =
|
||||
LinearQuadraticRegulator<2, 1>{plant, {0.1, 0.2}, {12.0}, 20_ms}.K();
|
||||
@@ -177,7 +178,7 @@ TEST(LinearQuadraticRegulatorTest, LatencyCompensate) {
|
||||
// Gear ratio
|
||||
constexpr double G = 14.67;
|
||||
|
||||
return frc::LinearSystemId::ElevatorSystem(motors, m, r, G);
|
||||
return frc::LinearSystemId::ElevatorSystem(motors, m, r, G).Slice(0);
|
||||
}();
|
||||
LinearQuadraticRegulator<2, 1> controller{plant, {0.1, 0.2}, {12.0}, 0.02_s};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user