[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:
Matt
2020-12-28 10:35:51 -08:00
committed by GitHub
parent aa89744c95
commit 254931b9a8
4 changed files with 43 additions and 73 deletions

View File

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