mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[wpimath] Replace frc/EigenCore.h typedefs with Eigen's where possible (#5597)
This commit is contained in:
@@ -226,7 +226,7 @@ Vectord<N> MakeWhiteNoiseVector(const std::array<double, N>& stdDevs) {
|
||||
* @return The vector.
|
||||
*/
|
||||
WPILIB_DLLEXPORT
|
||||
Vectord<3> PoseTo3dVector(const Pose2d& pose);
|
||||
Eigen::Vector3d PoseTo3dVector(const Pose2d& pose);
|
||||
|
||||
/**
|
||||
* Converts a Pose2d into a vector of [x, y, std::cos(theta), std::sin(theta)].
|
||||
@@ -236,7 +236,7 @@ Vectord<3> PoseTo3dVector(const Pose2d& pose);
|
||||
* @return The vector.
|
||||
*/
|
||||
WPILIB_DLLEXPORT
|
||||
Vectord<4> PoseTo4dVector(const Pose2d& pose);
|
||||
Eigen::Vector4d PoseTo4dVector(const Pose2d& pose);
|
||||
|
||||
/**
|
||||
* Returns true if (A, B) is a stabilizable pair.
|
||||
@@ -301,7 +301,7 @@ WPILIB_DLLEXPORT bool IsStabilizable<Eigen::Dynamic, Eigen::Dynamic>(
|
||||
* @return The vector.
|
||||
*/
|
||||
WPILIB_DLLEXPORT
|
||||
Vectord<3> PoseToVector(const Pose2d& pose);
|
||||
Eigen::Vector3d PoseToVector(const Pose2d& pose);
|
||||
|
||||
/**
|
||||
* Clamps input vector between system's minimum and maximum allowable input.
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <wpi/SymbolExports.h>
|
||||
#include <wpi/array.h>
|
||||
|
||||
#include "frc/EigenCore.h"
|
||||
#include "frc/estimator/PoseEstimator.h"
|
||||
#include "frc/geometry/Pose2d.h"
|
||||
#include "frc/geometry/Rotation2d.h"
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <wpi/SymbolExports.h>
|
||||
#include <wpi/array.h>
|
||||
|
||||
#include "frc/EigenCore.h"
|
||||
#include "frc/geometry/Pose2d.h"
|
||||
#include "frc/geometry/Rotation2d.h"
|
||||
#include "frc/interpolation/TimeInterpolatableBuffer.h"
|
||||
|
||||
@@ -81,9 +81,9 @@ void PoseEstimator<WheelSpeeds, WheelPositions>::AddVisionMeasurement(
|
||||
// Step 3: We should not trust the twist entirely, so instead we scale this
|
||||
// twist by a Kalman gain matrix representing how much we trust vision
|
||||
// measurements compared to our current pose.
|
||||
Vectord<3> k_times_twist =
|
||||
Eigen::Vector3d k_times_twist =
|
||||
m_visionK *
|
||||
Vectord<3>{twist.dx.value(), twist.dy.value(), twist.dtheta.value()};
|
||||
Eigen::Vector3d{twist.dx.value(), twist.dy.value(), twist.dtheta.value()};
|
||||
|
||||
// Step 4: Convert back to Twist2d
|
||||
Twist2d scaledTwist{units::meter_t{k_times_twist(0)},
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/EigenCore.h"
|
||||
#include "frc/geometry/Pose3d.h"
|
||||
#include "frc/geometry/Rotation3d.h"
|
||||
|
||||
@@ -67,7 +67,7 @@ class WPILIB_DLLEXPORT CoordinateAxis {
|
||||
private:
|
||||
friend class CoordinateSystem;
|
||||
|
||||
Vectord<3> m_axis;
|
||||
Eigen::Vector3d m_axis;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/EigenCore.h"
|
||||
#include "frc/geometry/CoordinateAxis.h"
|
||||
#include "frc/geometry/Pose3d.h"
|
||||
#include "frc/geometry/Rotation3d.h"
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/EigenCore.h"
|
||||
|
||||
namespace wpi {
|
||||
class json;
|
||||
} // namespace wpi
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <wpi/SymbolExports.h>
|
||||
|
||||
#include "frc/EigenCore.h"
|
||||
#include "frc/geometry/Quaternion.h"
|
||||
#include "frc/geometry/Rotation2d.h"
|
||||
#include "units/angle.h"
|
||||
@@ -57,7 +57,7 @@ class WPILIB_DLLEXPORT Rotation3d {
|
||||
* @param axis The rotation axis.
|
||||
* @param angle The rotation around the axis.
|
||||
*/
|
||||
Rotation3d(const Vectord<3>& axis, units::radian_t angle);
|
||||
Rotation3d(const Eigen::Vector3d& axis, units::radian_t angle);
|
||||
|
||||
/**
|
||||
* Constructs a Rotation3d with the given rotation vector representation. This
|
||||
@@ -86,7 +86,7 @@ class WPILIB_DLLEXPORT Rotation3d {
|
||||
* @param initial The initial vector.
|
||||
* @param final The final vector.
|
||||
*/
|
||||
Rotation3d(const Vectord<3>& initial, const Vectord<3>& final);
|
||||
Rotation3d(const Eigen::Vector3d& initial, const Eigen::Vector3d& final);
|
||||
|
||||
/**
|
||||
* Adds two rotations together.
|
||||
@@ -173,7 +173,7 @@ class WPILIB_DLLEXPORT Rotation3d {
|
||||
/**
|
||||
* Returns the axis in the axis-angle representation of this rotation.
|
||||
*/
|
||||
Vectord<3> Axis() const;
|
||||
Eigen::Vector3d Axis() const;
|
||||
|
||||
/**
|
||||
* Returns the angle in the axis-angle representation of this rotation.
|
||||
|
||||
@@ -49,7 +49,7 @@ class WPILIB_DLLEXPORT CubicHermiteSpline : public Spline<3> {
|
||||
* Returns the hermite basis matrix for cubic hermite spline interpolation.
|
||||
* @return The hermite basis matrix for cubic hermite spline interpolation.
|
||||
*/
|
||||
static Matrixd<4, 4> MakeHermiteBasis() {
|
||||
static Eigen::Matrix4d MakeHermiteBasis() {
|
||||
// Given P(i), P'(i), P(i+1), P'(i+1), the control vectors, we want to find
|
||||
// the coefficients of the spline P(t) = a₃t³ + a₂t² + a₁t + a₀.
|
||||
//
|
||||
@@ -71,10 +71,10 @@ class WPILIB_DLLEXPORT CubicHermiteSpline : public Spline<3> {
|
||||
// [a₁] = [ 0 1 0 0][P(i+1) ]
|
||||
// [a₀] = [ 1 0 0 0][P'(i+1)]
|
||||
|
||||
static const Matrixd<4, 4> basis{{+2.0, +1.0, -2.0, +1.0},
|
||||
{-3.0, -2.0, +3.0, -1.0},
|
||||
{+0.0, +1.0, +0.0, +0.0},
|
||||
{+1.0, +0.0, +0.0, +0.0}};
|
||||
static const Eigen::Matrix4d basis{{+2.0, +1.0, -2.0, +1.0},
|
||||
{-3.0, -2.0, +3.0, -1.0},
|
||||
{+0.0, +1.0, +0.0, +0.0},
|
||||
{+1.0, +0.0, +0.0, +0.0}};
|
||||
return basis;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/StateSpaceUtil.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <cmath>
|
||||
|
||||
#include "units/time.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user