[wpimath] Replace frc/EigenCore.h typedefs with Eigen's where possible (#5597)

This commit is contained in:
Tyler Veness
2023-08-31 11:03:37 -07:00
committed by GitHub
parent 383289bc4b
commit 99f66b1e24
25 changed files with 79 additions and 80 deletions

View File

@@ -4,9 +4,9 @@
#include <cmath>
#include <Eigen/Core>
#include <gtest/gtest.h>
#include "frc/EigenCore.h"
#include "frc/controller/DifferentialDriveFeedforward.h"
#include "frc/controller/LinearPlantInversionFeedforward.h"
#include "frc/system/plant/LinearSystemId.h"
@@ -38,9 +38,9 @@ TEST(DifferentialDriveFeedforwardTest, CalculateWithTrackwidth) {
auto [left, right] = differentialDriveFeedforward.Calculate(
currentLeftVelocity, nextLeftVelocity, currentRightVelocity,
nextRightVelocity, dt);
frc::Matrixd<2, 1> nextX = plant.CalculateX(
frc::Vectord<2>{currentLeftVelocity, currentRightVelocity},
frc::Vectord<2>{left, right}, dt);
Eigen::Vector2d nextX = plant.CalculateX(
Eigen::Vector2d{currentLeftVelocity, currentRightVelocity},
Eigen::Vector2d{left, right}, dt);
EXPECT_NEAR(nextX(0), nextLeftVelocity.value(), 1e-6);
EXPECT_NEAR(nextX(1), nextRightVelocity.value(), 1e-6);
}
@@ -72,9 +72,9 @@ TEST(DifferentialDriveFeedforwardTest, CalculateWithoutTrackwidth) {
auto [left, right] = differentialDriveFeedforward.Calculate(
currentLeftVelocity, nextLeftVelocity, currentRightVelocity,
nextRightVelocity, dt);
frc::Matrixd<2, 1> nextX = plant.CalculateX(
frc::Vectord<2>{currentLeftVelocity, currentRightVelocity},
frc::Vectord<2>{left, right}, dt);
Eigen::Vector2d nextX = plant.CalculateX(
Eigen::Vector2d{currentLeftVelocity, currentRightVelocity},
Eigen::Vector2d{left, right}, dt);
EXPECT_NEAR(nextX(0), nextLeftVelocity.value(), 1e-6);
EXPECT_NEAR(nextX(1), nextRightVelocity.value(), 1e-6);
}