Package edu.wpi.first.math.system
Class LinearSystem<States extends Num,Inputs extends Num,Outputs extends Num>
java.lang.Object
edu.wpi.first.math.system.LinearSystem<States,Inputs,Outputs>
public class LinearSystem<States extends Num,Inputs extends Num,Outputs extends Num> extends Object
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description Matrix<States,N1>
calculateX(Matrix<States,N1> x, Matrix<Inputs,N1> clampedU, double dtSeconds)
Computes the new x given the old x and the control input.Matrix<Outputs,N1>
calculateY(Matrix<States,N1> x, Matrix<Inputs,N1> clampedU)
Computes the new y given the control input.Matrix<States,States>
getA()
Returns the system matrix A.double
getA(int row, int col)
Returns an element of the system matrix A.Matrix<States,Inputs>
getB()
Returns the input matrix B.double
getB(int row, int col)
Returns an element of the input matrix B.Matrix<Outputs,States>
getC()
Returns the output matrix C.double
getC(int row, int col)
Returns an element of the output matrix C.Matrix<Outputs,Inputs>
getD()
Returns the feedthrough matrix D.double
getD(int row, int col)
Returns an element of the feedthrough matrix D.String
toString()
-
Constructor Details
-
LinearSystem
public LinearSystem(Matrix<States,States> a, Matrix<States,Inputs> b, Matrix<Outputs,States> c, Matrix<Outputs,Inputs> d)Construct a new LinearSystem from the four system matrices.- Parameters:
a
- The system matrix A.b
- The input matrix B.c
- The output matrix C.d
- The feedthrough matrix D.- Throws:
IllegalArgumentException
- if any matrix element isn't finite.
-
-
Method Details
-
getA
Returns the system matrix A.- Returns:
- the system matrix A.
-
getA
Returns an element of the system matrix A.- Parameters:
row
- Row of A.col
- Column of A.- Returns:
- the system matrix A at (i, j).
-
getB
Returns the input matrix B.- Returns:
- the input matrix B.
-
getB
Returns an element of the input matrix B.- Parameters:
row
- Row of B.col
- Column of B.- Returns:
- The value of the input matrix B at (i, j).
-
getC
Returns the output matrix C.- Returns:
- Output matrix C.
-
getC
Returns an element of the output matrix C.- Parameters:
row
- Row of C.col
- Column of C.- Returns:
- the double value of C at the given position.
-
getD
Returns the feedthrough matrix D.- Returns:
- the feedthrough matrix D.
-
getD
Returns an element of the feedthrough matrix D.- Parameters:
row
- Row of D.col
- Column of D.- Returns:
- The feedthrough matrix D at (i, j).
-
calculateX
public Matrix<States,N1> calculateX(Matrix<States,N1> x, Matrix<Inputs,N1> clampedU, double dtSeconds)Computes the new x given the old x and the control input.This is used by state observers directly to run updates based on state estimate.
- Parameters:
x
- The current state.clampedU
- The control input.dtSeconds
- Timestep for model update.- Returns:
- the updated x.
-
calculateY
Computes the new y given the control input.This is used by state observers directly to run updates based on state estimate.
- Parameters:
x
- The current state.clampedU
- The control input.- Returns:
- the updated output matrix Y.
-
toString
-