13#include "wpi/units/time.hpp"
39template <
int States,
int Inputs>
57 wpi::units::second_t dt)
104 double Uff(
int i)
const {
return m_uff(i); }
120 double R(
int i)
const {
return m_r(i); }
171 m_uff = m_B.householderQr().solve(rDot - m_f(r, InputVector::Zero()));
180 wpi::units::second_t m_dt;
ControlAffinePlantInversionFeedforward & operator=(ControlAffinePlantInversionFeedforward &&)=default
ControlAffinePlantInversionFeedforward(ControlAffinePlantInversionFeedforward &&)=default
double R(int i) const
Returns an element of the reference vector r.
Definition ControlAffinePlantInversionFeedforward.hpp:120
const InputVector & Uff() const
Returns the previously calculated feedforward as an input vector.
Definition ControlAffinePlantInversionFeedforward.hpp:95
double Uff(int i) const
Returns an element of the previously calculated feedforward.
Definition ControlAffinePlantInversionFeedforward.hpp:104
Vectord< Inputs > InputVector
Definition ControlAffinePlantInversionFeedforward.hpp:43
void Reset(const StateVector &initialState)
Resets the feedforward with a specified initial state vector.
Definition ControlAffinePlantInversionFeedforward.hpp:127
void Reset()
Resets the feedforward with a zero initial state vector.
Definition ControlAffinePlantInversionFeedforward.hpp:135
ControlAffinePlantInversionFeedforward(std::function< StateVector(const StateVector &)> f, const Matrixd< States, Inputs > &B, wpi::units::second_t dt)
Constructs a feedforward with given model dynamics as a function of state, and the plant's B matrix(c...
Definition ControlAffinePlantInversionFeedforward.hpp:74
Vectord< States > StateVector
Definition ControlAffinePlantInversionFeedforward.hpp:42
const StateVector & R() const
Returns the current reference vector r.
Definition ControlAffinePlantInversionFeedforward.hpp:111
InputVector Calculate(const StateVector &r, const StateVector &nextR)
Calculate the feedforward with current and future reference vectors.
Definition ControlAffinePlantInversionFeedforward.hpp:165
InputVector Calculate(const StateVector &nextR)
Calculate the feedforward with only the desired future reference.
Definition ControlAffinePlantInversionFeedforward.hpp:153
ControlAffinePlantInversionFeedforward(std::function< StateVector(const StateVector &, const InputVector &)> f, wpi::units::second_t dt)
Constructs a feedforward with given model dynamics as a function of state and input.
Definition ControlAffinePlantInversionFeedforward.hpp:55
Definition LinearSystem.hpp:20
auto NumericalJacobianU(F &&f, const Vectord< States > &x, const Vectord< Inputs > &u, Args &&... args)
Returns numerical Jacobian with respect to u for f(x, u, ...).
Definition NumericalJacobian.hpp:117
Eigen::Matrix< double, Rows, Cols, Options, MaxRows, MaxCols > Matrixd
Definition EigenCore.hpp:21
Eigen::Vector< double, Size > Vectord
Definition EigenCore.hpp:12