LinearPlantInversionFeedforward_1_1

class wpimath.controller.LinearPlantInversionFeedforward_1_1(*args, **kwargs)

Bases: pybind11_object

Constructs a plant inversion model-based feedforward from a LinearSystem.

The feedforward is calculated as :strong:` u_ff = B:sup:+ (r_k+1 - A r_k) , where :strong: B:sup:+ ` is the pseudoinverse of B.

For more on the underlying math, read https://file.tavsys.net/control/controls-engineering-in-frc.pdf.

@tparam States The number of states. @tparam Inputs The number of inputs.

Overloaded function.

  1. __init__(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1, A: numpy.ndarray[numpy.float64[1, 1]], B: numpy.ndarray[numpy.float64[1, 1]], dt: seconds) -> None

Constructs a feedforward with the given coefficients.

Parameters:
  • A – Continuous system matrix of the plant being controlled.

  • B – Continuous input matrix of the plant being controlled.

  • dt – Discretization timestep.

  1. __init__(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1, arg0: wpimath._controls._controls.system.LinearSystem_1_1_1, arg1: seconds) -> None

  2. __init__(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1, arg0: wpimath._controls._controls.system.LinearSystem_1_1_2, arg1: seconds) -> None

R(*args, **kwargs)

Overloaded function.

  1. R(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1) -> numpy.ndarray[numpy.float64[1, 1]]

Returns the current reference vector r.

Returns:

The current reference vector.

  1. R(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1, i: int) -> float

Returns an element of the reference vector r.

Parameters:

i – Row of r.

Returns:

The row of the current reference vector.

calculate(*args, **kwargs)

Overloaded function.

  1. calculate(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1, nextR: numpy.ndarray[numpy.float64[1, 1]]) -> numpy.ndarray[numpy.float64[1, 1]]

Calculate the feedforward with only the desired future reference. This uses the internally stored “current” reference.

If this method is used the initial state of the system is the one set using Reset(const StateVector&). If the initial state is not set it defaults to a zero vector.

Parameters:

nextR – The reference state of the future timestep (k + dt).

Returns:

The calculated feedforward.

  1. calculate(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1, r: numpy.ndarray[numpy.float64[1, 1]], nextR: numpy.ndarray[numpy.float64[1, 1]]) -> numpy.ndarray[numpy.float64[1, 1]]

Calculate the feedforward with current and future reference vectors.

Parameters:
  • r – The reference state of the current timestep (k).

  • nextR – The reference state of the future timestep (k + dt).

Returns:

The calculated feedforward.

reset(*args, **kwargs)

Overloaded function.

  1. reset(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1, initialState: numpy.ndarray[numpy.float64[1, 1]]) -> None

Resets the feedforward with a specified initial state vector.

Parameters:

initialState – The initial state vector.

  1. reset(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1) -> None

Resets the feedforward with a zero initial state vector.

uff(*args, **kwargs)

Overloaded function.

  1. uff(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1) -> numpy.ndarray[numpy.float64[1, 1]]

Returns the previously calculated feedforward as an input vector.

Returns:

The calculated feedforward.

  1. uff(self: wpimath._controls._controls.controller.LinearPlantInversionFeedforward_1_1, i: int) -> float

Returns an element of the previously calculated feedforward.

Parameters:

i – Row of uff.

Returns:

The row of the calculated feedforward.