mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Merge branch 'main' into 2027
This commit is contained in:
@@ -31,8 +31,9 @@ class WPILIB_DLLEXPORT LTVUnicycleController {
|
||||
public:
|
||||
/**
|
||||
* Constructs a linear time-varying unicycle controller with default maximum
|
||||
* desired error tolerances of (0.0625 m, 0.125 m, 2 rad) and default maximum
|
||||
* desired control effort of (1 m/s, 2 rad/s).
|
||||
* desired error tolerances of (x = 0.0625 m, y = 0.125 m, heading = 2 rad)
|
||||
* and default maximum desired control effort of (linear velocity = 1 m/s,
|
||||
* angular velocity = 2 rad/s).
|
||||
*
|
||||
* @param dt Discretization timestep.
|
||||
*/
|
||||
@@ -46,8 +47,10 @@ class WPILIB_DLLEXPORT LTVUnicycleController {
|
||||
* https://docs.wpilib.org/en/stable/docs/software/advanced-controls/state-space/state-space-intro.html#lqr-tuning
|
||||
* for how to select the tolerances.
|
||||
*
|
||||
* @param Qelems The maximum desired error tolerance for each state.
|
||||
* @param Relems The maximum desired control effort for each input.
|
||||
* @param Qelems The maximum desired error tolerance for each state (x, y,
|
||||
* heading).
|
||||
* @param Relems The maximum desired control effort for each input (linear
|
||||
* velocity, angular velocity).
|
||||
* @param dt Discretization timestep.
|
||||
*/
|
||||
LTVUnicycleController(const wpi::array<double, 3>& Qelems,
|
||||
|
||||
@@ -334,7 +334,7 @@ class ct_matrix {
|
||||
requires(Rows == 3 && Cols == 3)
|
||||
{
|
||||
// |a b c|
|
||||
// |d e f| = aei + bfg + cgh - ceg - bdi - afh
|
||||
// |d e f| = aei + bfg + cdh - ceg - bdi - afh
|
||||
// |g h i|
|
||||
Scalar a = (*this)(0, 0);
|
||||
Scalar b = (*this)(0, 1);
|
||||
@@ -345,7 +345,7 @@ class ct_matrix {
|
||||
Scalar g = (*this)(2, 0);
|
||||
Scalar h = (*this)(2, 1);
|
||||
Scalar i = (*this)(2, 2);
|
||||
return a * e * i + b * f * g + c * g * h - c * e * g - b * d * i -
|
||||
return a * e * i + b * f * g + c * d * h - c * e * g - b * d * i -
|
||||
a * f * h;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/LU>
|
||||
#include <gcem.hpp>
|
||||
#include <wpi/StackTrace.h>
|
||||
#include <wpi/SymbolExports.h>
|
||||
@@ -77,7 +76,11 @@ class WPILIB_DLLEXPORT Rotation2d {
|
||||
if ((R * R.transpose() - Matrix2d::Identity()).norm() > 1e-9) {
|
||||
throw std::domain_error("Rotation matrix isn't orthogonal");
|
||||
}
|
||||
if (gcem::abs(R.determinant() - 1.0) > 1e-9) {
|
||||
// HACK: Uses ct_matrix instead of <Eigen/LU> for determinant because
|
||||
// including <Eigen/LU> doubles compilation times on MSVC, even if
|
||||
// this constructor is unused. MSVC's frontend inefficiently parses
|
||||
// large headers; GCC and Clang are largely unaffected.
|
||||
if (gcem::abs(ct_matrix{R}.determinant() - 1.0) > 1e-9) {
|
||||
throw std::domain_error(
|
||||
"Rotation matrix is orthogonal but not special orthogonal");
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <type_traits>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/LU>
|
||||
#include <fmt/format.h>
|
||||
#include <gcem.hpp>
|
||||
#include <wpi/SymbolExports.h>
|
||||
@@ -114,7 +113,11 @@ class WPILIB_DLLEXPORT Rotation3d {
|
||||
if ((R * R.transpose() - Matrix3d::Identity()).norm() > 1e-9) {
|
||||
throw std::domain_error("Rotation matrix isn't orthogonal");
|
||||
}
|
||||
if (gcem::abs(R.determinant() - 1.0) > 1e-9) {
|
||||
// HACK: Uses ct_matrix instead of <Eigen/LU> for determinant because
|
||||
// including <Eigen/LU> doubles compilation times on MSVC, even if
|
||||
// this constructor is unused. MSVC's frontend inefficiently parses
|
||||
// large headers; GCC and Clang are largely unaffected.
|
||||
if (gcem::abs(ct_matrix{R}.determinant() - 1.0) > 1e-9) {
|
||||
throw std::domain_error(
|
||||
"Rotation matrix is orthogonal but not special orthogonal");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user