[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

@@ -6,6 +6,7 @@
#include <cmath>
#include <Eigen/Core>
#include <wpi/json.h>
using namespace frc;
@@ -21,14 +22,14 @@ namespace {
* @param rotation The rotation vector.
* @return The rotation vector as a 3x3 rotation matrix.
*/
Matrixd<3, 3> RotationVectorToMatrix(const Vectord<3>& rotation) {
Eigen::Matrix3d RotationVectorToMatrix(const Eigen::Vector3d& rotation) {
// Given a rotation vector <a, b, c>,
// [ 0 -c b]
// Omega = [ c 0 -a]
// [-b a 0]
return Matrixd<3, 3>{{0.0, -rotation(2), rotation(1)},
{rotation(2), 0.0, -rotation(0)},
{-rotation(1), rotation(0), 0.0}};
return Eigen::Matrix3d{{0.0, -rotation(2), rotation(1)},
{rotation(2), 0.0, -rotation(0)},
{-rotation(1), rotation(0), 0.0}};
}
} // namespace