template<int STATES, int INPUTS>
class LinearPlantInversionFeedforward< STATES, INPUTS >
This class computes a feedforward control input by inverting the discrete plant dynamics. A continuous linear system is provided, it is then discretized on some timestep, then the feedforward control input is computed to satisfy:
B_d * u_ff = next_state - A_d * current_state
|
| template<int OUTPUTS> |
| | LinearPlantInversionFeedforward (LinearSystem< STATES, INPUTS, OUTPUTS > &plant, const double &dt) |
| | LinearPlantInversionFeedforward (const EMat< STATES, STATES > &A, const EMat< STATES, INPUTS > &B, const double &dt) |
| EVec< INPUTS > | calculate (const EVec< STATES > &r, const EVec< STATES > &next_r) |
| EVec< INPUTS > | calculate (const EVec< STATES > &next_r) override |
| EVec< INPUTS > | calculate (const EVec< STATES > &r, const EVec< STATES > &next_r, const units::Time &dt) |
| EVec< INPUTS > | calculate (const EVec< STATES > &next_r, const units::Time &dt) |
| void | reset (const EVec< STATES > &initial_state) |
| void | reset () override |
| | Resets the reference to all zeros, and the feedforward to zero.
|
|
EVec< INPUTS > | get_output () |
| | Gets the last saved output value.
|
|
EVec< STATES > | get_reference () |
| | Gets the currently stored reference state.
|
template<int STATES, int INPUTS>
| EVec< INPUTS > LinearPlantInversionFeedforward< STATES, INPUTS >::calculate |
( |
const EVec< STATES > & | r, |
|
|
const EVec< STATES > & | next_r, |
|
|
const units::Time & | dt ) |
|
inline |
Computes the feedforward control input given the current reference state and the next reference state. This also sets the current reference state to the next reference state for you. Use this function if your timestep is not the same between each run.
This is slower because it discretizes A and B on each run, requiring computing a matrix exponential. Don't use this unless you have to.
- Parameters
-
| r | The current reference state. |
| next_r | The next reference state. |
| dt | The timestep for this run. |