30template <
int States,
int Inputs,
int Outputs>
41 const std::array<double, Outputs>& measurementStdDevs = {})
127 units::second_t dt) {
128 return m_plant.CalculateX(currentXhat, u, dt);
139 return frc::DesaturateInputVector<Inputs>(
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RowXpr row(Index i)
This is the const version of row(). */.
Definition: BlockMethods.h:1118
A plant defined using state-space notation.
Definition: LinearSystem.h:31
static double GetInputVoltage()
Get the input voltage to the robot controller.
This class helps simulate linear systems.
Definition: LinearSystemSim.h:31
double GetOutput(int row) const
Returns an element of the current output of the plant.
Definition: LinearSystemSim.h:82
const Vectord< Outputs > & GetOutput() const
Returns the current output of the plant.
Definition: LinearSystemSim.h:74
std::array< double, Outputs > m_measurementStdDevs
Definition: LinearSystemSim.h:148
LinearSystemSim(const LinearSystem< States, Inputs, Outputs > &system, const std::array< double, Outputs > &measurementStdDevs={})
Creates a simulated generic linear system.
Definition: LinearSystemSim.h:39
Vectord< Inputs > m_u
Definition: LinearSystemSim.h:147
void Update(units::second_t dt)
Updates the simulation.
Definition: LinearSystemSim.h:55
void SetInput(const Vectord< Inputs > &u)
Sets the system inputs (usually voltages).
Definition: LinearSystemSim.h:89
Vectord< States > m_x
Definition: LinearSystemSim.h:145
LinearSystem< States, Inputs, Outputs > m_plant
Definition: LinearSystemSim.h:143
void SetState(const Vectord< States > &state)
Sets the system state.
Definition: LinearSystemSim.h:107
Vectord< Inputs > ClampInput(Vectord< Inputs > u)
Clamp the input vector such that no element exceeds the given voltage.
Definition: LinearSystemSim.h:138
virtual Vectord< States > UpdateX(const Vectord< States > ¤tXhat, const Vectord< Inputs > &u, units::second_t dt)
Updates the state estimate of the system.
Definition: LinearSystemSim.h:125
Vectord< Outputs > m_y
Definition: LinearSystemSim.h:146
virtual ~LinearSystemSim()=default
void SetInput(int row, double value)
Definition: LinearSystemSim.h:97
virtual units::ampere_t GetCurrentDraw() const
Returns the current drawn by this simulated system.
Definition: LinearSystemSim.h:115
Definition: AnalogOutputSim.h:15
Eigen::Vector< double, Size > Vectord
Definition: EigenCore.h:12