[wpimath] Add extern templates for common cases

This helps reduce compile times and memory usage.
This commit is contained in:
Peter Johnson
2022-04-29 16:56:03 -07:00
parent 7200c4951d
commit e3d62c22d3
8 changed files with 68 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
#include <limits>
#include <wpi/SymbolExports.h>
#include <wpi/array.h>
#include <wpi/timestamp.h>
@@ -320,4 +321,7 @@ class SwerveDrivePoseEstimator {
}
};
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)
SwerveDrivePoseEstimator<4>;
} // namespace frc

View File

@@ -6,6 +6,7 @@
#include <functional>
#include <wpi/SymbolExports.h>
#include <wpi/array.h>
#include "Eigen/Cholesky"
@@ -425,4 +426,9 @@ class UnscentedKalmanFilter {
MerweScaledSigmaPoints<States> m_pts;
};
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)
UnscentedKalmanFilter<3, 3, 1>;
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)
UnscentedKalmanFilter<5, 3, 3>;
} // namespace frc

View File

@@ -6,6 +6,7 @@
#include <cstddef>
#include <wpi/SymbolExports.h>
#include <wpi/array.h>
#include "Eigen/Core"
@@ -185,6 +186,10 @@ class SwerveDriveKinematics {
mutable Translation2d m_previousCoR;
};
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)
SwerveDriveKinematics<4>;
} // namespace frc
#include "SwerveDriveKinematics.inc"

View File

@@ -8,6 +8,7 @@
#include <cstddef>
#include <ctime>
#include <wpi/SymbolExports.h>
#include <wpi/timestamp.h>
#include "SwerveDriveKinematics.h"
@@ -112,6 +113,9 @@ class SwerveDriveOdometry {
Rotation2d m_gyroOffset;
};
extern template class EXPORT_TEMPLATE_DECLARE(WPILIB_DLLEXPORT)
SwerveDriveOdometry<4>;
} // namespace frc
#include "SwerveDriveOdometry.inc"