Lodestar
An integrated real-time control package in C++
ls::systems::DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim > Class Template Reference
Inheritance diagram for ls::systems::DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim >:
[legend]
Collaboration diagram for ls::systems::DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim >:
[legend]

Public Types

typedef StateSpace< TScalar, TStateDim, TInputDim, TOutputDim > Base
 
- Public Types inherited from ls::systems::StateSpace< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic >
typedef Eigen::Matrix< double, TStateDim, TStateDim > TDStateMatrix
 
typedef Eigen::Matrix< double, TStateDim, TInputDim > TDInputMatrix
 
typedef Eigen::Matrix< double, TOutputDim, TStateDim > TDOutputMatrix
 
typedef Eigen::Matrix< double, TOutputDim, TInputDim > TDFeedforwardMatrix
 

Public Member Functions

 DiscreteStateSpace ()
 Default constructor. More...
 
 DiscreteStateSpace (double dt)
 Constructs empty discrete state space system with given sampling period. More...
 
 DiscreteStateSpace (const Eigen::MatrixXd &A, const Eigen::MatrixXd &B, const Eigen::MatrixXd &C, const Eigen::MatrixXd &D)
 Constructs a discrete state space system with the given matrices. More...
 
 DiscreteStateSpace (const Eigen::MatrixXd &A, const Eigen::MatrixXd &B, const Eigen::MatrixXd &C, const Eigen::MatrixXd &D, double dt)
 Constructs a discrete state space system with the given matrices. More...
 
 DiscreteStateSpace (const DiscreteStateSpace &other)
 Copy constructor. More...
 
void resample (double dt)
 Resamples the system. More...
 
void resampleFast (double dt)
 Resamples the system. More...
 
bool isStable (double tolerance=0) const
 
- Public Member Functions inherited from ls::systems::StateSpace< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic >
 StateSpace ()
 Default constructor.
 
 StateSpace (TDStateMatrix *A, TDInputMatrix *B, TDOutputMatrix *C, TDOutputMatrix *D)
 Construct a state space system with the given matrices. More...
 
 StateSpace (const Eigen::EigenBase< DerivedA > &A, const Eigen::EigenBase< DerivedB > &B, const Eigen::EigenBase< DerivedC > &C, const Eigen::EigenBase< DerivedD > &D)
 
 StateSpace (const StateSpace &other)
 Copy constructor. More...
 
const TDStateMatrix & getA () const
 Gets the state matrix. More...
 
void setA (TDStateMatrix *A)
 Sets the state matrix. More...
 
void setA (Eigen::EigenBase< Derived > *A)
 
void setA (const TDStateMatrix &A)
 Sets the state matrix. More...
 
void setA (const Eigen::EigenBase< Derived > &A)
 
const TDInputMatrix & getB () const
 Gets the input matrix. More...
 
void setB (TDInputMatrix *B)
 Sets the input matrix. More...
 
void setB (Eigen::EigenBase< Derived > *B)
 
void setB (const TDInputMatrix &B)
 Sets the input matrix. More...
 
void setB (const Eigen::EigenBase< Derived > &B)
 
const TDOutputMatrix & getC () const
 Gets the output matrix. More...
 
void setC (TDOutputMatrix *C)
 Sets the output matrix. More...
 
void setC (Eigen::EigenBase< Derived > *C)
 
void setC (const TDOutputMatrix &C)
 Sets the output matrix. More...
 
void setC (const Eigen::EigenBase< Derived > &C)
 
const TDFeedforwardMatrix & getD () const
 Gets the feedforward matrix. More...
 
void setD (TDFeedforwardMatrix *D)
 Sets the feedforward matrix. More...
 
void setD (Eigen::EigenBase< Derived > *D)
 
void setD (const TDFeedforwardMatrix &D)
 Sets the feedforward matrix. More...
 
void setD (const Eigen::EigenBase< Derived > &D)
 
void copyMatrices (const StateSpace &other)
 Copies matrices from one state space object to the current instance. More...
 
void setDiscreteParams (double dt)
 Sets the discrete time system parameters. More...
 
void setDiscreteParams (double dt, bool discrete)
 Sets the discrete time system parameters. More...
 
bool isDiscrete () const
 Returns a bool that tells if the system is discrete. More...
 
double getSamplingPeriod () const
 Returns the sampling period. More...
 
void setSamplingPeriod (double dt)
 Sets the sampling period. More...
 
 stateDim () const
 Returns the state dimension. More...
 
 stateDim () const
 
long stateDimDynamic () const
 
long stateDimStatic () const
 
 inputDim () const
 Returns the input dimension. More...
 
 inputDim () const
 
long inputDimDynamic () const
 
long inputDimStatic () const
 
 outputDim () const
 Returns the output dimension. More...
 
 outputDim () const
 
long outputDimDynamic () const
 
long outputDimStatic () const
 
void append (const StateSpace< double, TStateDim2, TOutputDim, TOutputDim2 > &ss)
 Appends to state space systems. More...
 
bool isStable (double tolerance=0) const
 Determines if the system is stable based on its eigenvalues. More...
 
ls::systems::StateSpace< T_TScalar, LS_STATIC_UNLESS_DYNAMIC(T_TStateDim+T_TOutputDim), T_TInputDim, T_TOutputDim > addIntegralAction (LS_IS_DYNAMIC_DEFAULT(T_TStateDim, T_TInputDim, T_TOutputDim)) const
 Returns a state space representation that adds integral action to the original system. More...
 
ls::systems::StateSpace< T_TScalar, LS_STATIC_UNLESS_DYNAMIC(T_TStateDim+T_TOutputDim), T_TInputDim, T_TOutputDim > addIntegralAction (LS_IS_STATIC_DEFAULT(T_TStateDim, T_TInputDim, T_TOutputDim)) const
 Returns a state space representation that adds integral action to the original system. More...
 
ls::systems::StateSpace< T_TScalar, LS_STATIC_UNLESS_DYNAMIC(T_TStateDim+T_TOutputDim), T_TInputDim, T_TOutputDim > addIntegralAction (LS_IS_DYNAMIC(T_TStateDim, T_TInputDim, T_TOutputDim)) const
 
ls::systems::StateSpace< T_TScalar, LS_STATIC_UNLESS_DYNAMIC(T_TStateDim+T_TOutputDim), T_TInputDim, T_TOutputDim > addIntegralAction (LS_IS_STATIC(T_TStateDim, T_TInputDim, T_TOutputDim)) const
 

Additional Inherited Members

- Protected Attributes inherited from ls::systems::StateSpace< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic >
TDStateMatrix * A_
 
TDInputMatrix * B_
 TState matrix.
 
TDOutputMatrix * C_
 Input matrix.
 
TDFeedforwardMatrix * D_
 Output matrix.
 
double dt_
 Feedforward matrix.
 
bool isDiscrete_
 Sampling period.
 

Constructor & Destructor Documentation

◆ DiscreteStateSpace() [1/5]

template<typename TScalar = double, int TStateDim = Eigen::Dynamic, int TInputDim = Eigen::Dynamic, int TOutputDim = Eigen::Dynamic>
ls::systems::DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim >::DiscreteStateSpace ( )
inline

Default constructor.

Sets sampling time to 1.

◆ DiscreteStateSpace() [2/5]

template<typename TScalar = double, int TStateDim = Eigen::Dynamic, int TInputDim = Eigen::Dynamic, int TOutputDim = Eigen::Dynamic>
ls::systems::DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim >::DiscreteStateSpace ( double  dt)
inline

Constructs empty discrete state space system with given sampling period.

Parameters
dtSampling period.

◆ DiscreteStateSpace() [3/5]

template<typename TScalar = double, int TStateDim = Eigen::Dynamic, int TInputDim = Eigen::Dynamic, int TOutputDim = Eigen::Dynamic>
ls::systems::DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim >::DiscreteStateSpace ( const Eigen::MatrixXd &  A,
const Eigen::MatrixXd &  B,
const Eigen::MatrixXd &  C,
const Eigen::MatrixXd &  D 
)
inline

Constructs a discrete state space system with the given matrices.

The sampling period is set to 1.

Parameters
ATState matrix.
BInput matrix.
COutput matrix.
DFeedforward matrix.

◆ DiscreteStateSpace() [4/5]

template<typename TScalar = double, int TStateDim = Eigen::Dynamic, int TInputDim = Eigen::Dynamic, int TOutputDim = Eigen::Dynamic>
ls::systems::DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim >::DiscreteStateSpace ( const Eigen::MatrixXd &  A,
const Eigen::MatrixXd &  B,
const Eigen::MatrixXd &  C,
const Eigen::MatrixXd &  D,
double  dt 
)
inline

Constructs a discrete state space system with the given matrices.

Parameters
ATState matrix.
BInput matrix.
COutput matrix.
DFeedforward matrix.
dtSampling period.

◆ DiscreteStateSpace() [5/5]

template<typename TScalar = double, int TStateDim = Eigen::Dynamic, int TInputDim = Eigen::Dynamic, int TOutputDim = Eigen::Dynamic>
ls::systems::DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim >::DiscreteStateSpace ( const DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim > &  other)
inline

Copy constructor.

Parameters
otherDiscrete state space object to copy.

Member Function Documentation

◆ resample()

template<typename TScalar , int TStateDim, int TInputDim, int TOutputDim>
void ls::systems::DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim >::resample ( double  dt)

Resamples the system.

This method uses zero-order hold.

Parameters
dtNew sampling period.

◆ resampleFast()

template<typename TScalar , int TStateDim, int TInputDim, int TOutputDim>
void ls::systems::DiscreteStateSpace< TScalar, TStateDim, TInputDim, TOutputDim >::resampleFast ( double  dt)

Resamples the system.

This method uses a backward difference transformation.

Parameters
dtNew sampling period.

The documentation for this class was generated from the following file: