ImplicitModelFollower_2_2

class wpimath.ImplicitModelFollower_2_2(*args, **kwargs)

Bases: pybind11_object

Contains the controller coefficients and logic for an implicit model follower.

Implicit model following lets us design a feedback controller that erases the dynamics of our system and makes it behave like some other system. This can be used to make a drivetrain more controllable during teleop driving by making it behave like a slower or more benign drivetrain.

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

@tparam States Number of states. @tparam Inputs Number of inputs.

Overloaded function.

  1. __init__(self: wpimath._wpimath.ImplicitModelFollower_2_2, A: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, “[2, 2]”], B: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, “[2, 2]”], Aref: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, “[2, 2]”], Bref: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, “[2, 2]”]) -> None

Constructs a controller with the given coefficients and plant.

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

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

  • Aref – Continuous system matrix whose dynamics should be followed.

  • Bref – Continuous input matrix whose dynamics should be followed.

  1. __init__(self: wpimath._wpimath.ImplicitModelFollower_2_2, plant: wpimath._wpimath.LinearSystem_2_2_1, plantRef: wpimath._wpimath.LinearSystem_2_2_1) -> None

  2. __init__(self: wpimath._wpimath.ImplicitModelFollower_2_2, plant: wpimath._wpimath.LinearSystem_2_2_2, plantRef: wpimath._wpimath.LinearSystem_2_2_2) -> None

  3. __init__(self: wpimath._wpimath.ImplicitModelFollower_2_2, plant: wpimath._wpimath.LinearSystem_2_2_3, plantRef: wpimath._wpimath.LinearSystem_2_2_3) -> None

U(*args, **kwargs)

Overloaded function.

  1. U(self: wpimath._wpimath.ImplicitModelFollower_2_2) -> typing.Annotated[numpy.typing.NDArray[numpy.float64], “[2, 1]”]

Returns the control input vector u.

Returns:

The control input.

  1. U(self: wpimath._wpimath.ImplicitModelFollower_2_2, i: typing.SupportsInt | typing.SupportsIndex) -> float

Returns an element of the control input vector u.

Parameters:

i – Row of u.

Returns:

The row of the control input vector.

calculate(x: Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]'], u: Annotated[numpy.typing.ArrayLike, numpy.float64, '[2, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]']

Returns the next output of the controller.

Parameters:
  • x – The current state x.

  • u – The current input for the original model.

reset() None

Resets the controller.