WPILibC++ 2023.4.3-108-ge5452e3
StateSpaceUtil.h File Reference
#include <array>
#include <cmath>
#include <concepts>
#include <limits>
#include <random>
#include <wpi/SymbolExports.h>
#include <wpi/deprecated.h>
#include "Eigen/Eigenvalues"
#include "Eigen/QR"
#include "frc/EigenCore.h"
#include "frc/geometry/Pose2d.h"

Go to the source code of this file.

Namespaces

namespace  frc
 
namespace  frc::detail
 

Functions

template<typename Matrix , typename T , typename... Ts>
void frc::detail::CostMatrixImpl (Matrix &result, T elem, Ts... elems)
 
template<typename Matrix , typename T , typename... Ts>
void frc::detail::CovMatrixImpl (Matrix &result, T elem, Ts... elems)
 
template<typename Matrix , typename T , typename... Ts>
void frc::detail::WhiteNoiseVectorImpl (Matrix &result, T elem, Ts... elems)
 
template<int States, int Inputs>
bool frc::detail::IsStabilizableImpl (const Matrixd< States, States > &A, const Matrixd< States, Inputs > &B)
 
template<std::same_as< double >... Ts>
Matrixd< sizeof...(Ts), sizeof...(Ts)> frc::MakeCostMatrix (Ts... tolerances)
 Creates a cost matrix from the given vector for use with LQR. More...
 
template<std::same_as< double >... Ts>
Matrixd< sizeof...(Ts), sizeof...(Ts)> frc::MakeCovMatrix (Ts... stdDevs)
 Creates a covariance matrix from the given vector for use with Kalman filters. More...
 
template<size_t N>
Matrixd< N, N > frc::MakeCostMatrix (const std::array< double, N > &costs)
 Creates a cost matrix from the given vector for use with LQR. More...
 
template<size_t N>
Matrixd< N, N > frc::MakeCovMatrix (const std::array< double, N > &stdDevs)
 Creates a covariance matrix from the given vector for use with Kalman filters. More...
 
template<std::same_as< double >... Ts>
Matrixd< sizeof...(Ts), 1 > frc::MakeWhiteNoiseVector (Ts... stdDevs)
 
template<int N>
Vectord< N > frc::MakeWhiteNoiseVector (const std::array< double, N > &stdDevs)
 Creates a vector of normally distributed white noise with the given noise intensities for each element. More...
 
WPILIB_DLLEXPORT Vectord< 3 > frc::PoseTo3dVector (const Pose2d &pose)
 Converts a Pose2d into a vector of [x, y, theta]. More...
 
WPILIB_DLLEXPORT Vectord< 4 > frc::PoseTo4dVector (const Pose2d &pose)
 Converts a Pose2d into a vector of [x, y, std::cos(theta), std::sin(theta)]. More...
 
template<int States, int Inputs>
bool frc::IsStabilizable (const Matrixd< States, States > &A, const Matrixd< States, Inputs > &B)
 Returns true if (A, B) is a stabilizable pair. More...
 
template<int States, int Outputs>
bool frc::IsDetectable (const Matrixd< States, States > &A, const Matrixd< Outputs, States > &C)
 Returns true if (A, C) is a detectable pair. More...
 
template<>
WPILIB_DLLEXPORT bool frc::IsStabilizable< 1, 1 > (const Matrixd< 1, 1 > &A, const Matrixd< 1, 1 > &B)
 
template<>
WPILIB_DLLEXPORT bool frc::IsStabilizable< 2, 1 > (const Matrixd< 2, 2 > &A, const Matrixd< 2, 1 > &B)
 
WPILIB_DLLEXPORT Vectord< 3 > frc::PoseToVector (const Pose2d &pose)
 Converts a Pose2d into a vector of [x, y, theta]. More...
 
template<int Inputs>
Vectord< Inputs > frc::ClampInputMaxMagnitude (const Vectord< Inputs > &u, const Vectord< Inputs > &umin, const Vectord< Inputs > &umax)
 Clamps input vector between system's minimum and maximum allowable input. More...
 
template<int Inputs>
Vectord< Inputs > frc::DesaturateInputVector (const Vectord< Inputs > &u, double maxMagnitude)
 Renormalize all inputs if any exceeds the maximum magnitude. More...