mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpimath] Remove LinearSystem from LinearSystemLoop (#2968)
The system wasn't being used internally, and as LinearSystem is stateless, it doesn't need to be held by LinearSystemLoop.
This commit is contained in:
@@ -43,10 +43,10 @@ class StateSpace : public testing::Test {
|
||||
LinearSystemLoop<2, 1, 1> loop{plant, controller, observer, 12_V, kDt};
|
||||
};
|
||||
|
||||
void Update(LinearSystemLoop<2, 1, 1>& loop, double noise) {
|
||||
Eigen::Matrix<double, 1, 1> y =
|
||||
loop.Plant().CalculateY(loop.Xhat(), loop.U()) +
|
||||
Eigen::Matrix<double, 1, 1>(noise);
|
||||
void Update(const LinearSystem<2, 1, 1>& plant, LinearSystemLoop<2, 1, 1>& loop,
|
||||
double noise) {
|
||||
Eigen::Matrix<double, 1, 1> y = plant.CalculateY(loop.Xhat(), loop.U()) +
|
||||
Eigen::Matrix<double, 1, 1>(noise);
|
||||
loop.Correct(y);
|
||||
loop.Predict(kDt);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ TEST_F(StateSpace, CorrectPredictLoop) {
|
||||
loop.SetNextR(references);
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
Update(loop, dist(generator));
|
||||
Update(plant, loop, dist(generator));
|
||||
EXPECT_PRED_FORMAT2(testing::DoubleLE, -12.0, loop.U(0));
|
||||
EXPECT_PRED_FORMAT2(testing::DoubleLE, loop.U(0), 12.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user