centroidal_control_collection
Public Types | Public Member Functions | Public Attributes | List of all members
CCC::StateSpaceModel< StateDim, InputDim, OutputDim > Class Template Reference

State-space model. More...

#include <StateSpaceModel.h>

Inheritance diagram for CCC::StateSpaceModel< StateDim, InputDim, OutputDim >:
Inheritance graph
[legend]

Public Types

using StateDimVector = Eigen::Matrix< double, StateDim, 1 >
 Type of state vector. More...
 
using InputDimVector = Eigen::Matrix< double, InputDim, 1 >
 Type of input vector. More...
 
using OutputDimVector = Eigen::Matrix< double, OutputDim, 1 >
 Type of output vector. More...
 

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW StateSpaceModel (int state_dim=StateDim, int input_dim=InputDim, int output_dim=OutputDim)
 Constructor. More...
 
virtual ~StateSpaceModel ()=default
 Destructor. More...
 
int stateDim () const
 Gets the state dimension. More...
 
int inputDim () const
 Gets the input dimension. More...
 
int outputDim () const
 Gets the output dimension. More...
 
StateDimVector stateEq (const StateDimVector &x, const InputDimVector &u) const
 Calculate the continuous state equation. More...
 
StateDimVector stateEqDisc (const StateDimVector &x, const InputDimVector &u) const
 Calculate the discrete state equation. More...
 
OutputDimVector observEq (const StateDimVector &x) const
 Calculate the observation equation. More...
 
OutputDimVector observEq (const StateDimVector &x, const InputDimVector &u) const
 Calculate the observation equation. More...
 
void calcDiscMatrix (double dt)
 Calculate the discrete system matrices \(\boldsymbol{A}_d, \boldsymbol{B}_d, \boldsymbol{e}_d\). More...
 

Public Attributes

const int state_dim_ = 0
 State dimension. More...
 
const int input_dim_ = 0
 Input dimension. More...
 
const int output_dim_ = 0
 Output dimension. More...
 
Eigen::Matrix< double, StateDim, StateDim > A_
 Matrix \(\boldsymbol{A}\) of continuous state equation. More...
 
Eigen::Matrix< double, StateDim, InputDim > B_
 Matrix \(\boldsymbol{B}\) of continuous state equation. More...
 
Eigen::Matrix< double, OutputDim, StateDim > C_
 Matrix \(\boldsymbol{C}\) of observation equation. More...
 
Eigen::Matrix< double, OutputDim, InputDim > D_
 Matrix \(\boldsymbol{D}\) of observation equation. More...
 
StateDimVector E_
 Offset vector \(\boldsymbol{e}\) of continuous state equation. More...
 
OutputDimVector F_
 Offset vector \(\boldsymbol{f}\) of observation equation. More...
 
double dt_ = 0
 Discretization timestep [sec] (zero if discrete coefficients are not initialized) More...
 
Eigen::Matrix< double, StateDim, StateDim > Ad_
 Matrix \(\boldsymbol{A}_d\) of discrete state equation. More...
 
Eigen::Matrix< double, StateDim, InputDim > Bd_
 Matrix \(\boldsymbol{B}_d\) of discrete state equation. More...
 
StateDimVector Ed_
 Offset vector \(\boldsymbol{e}_d\) of discrete state equation. More...
 

Detailed Description

template<int StateDim, int InputDim, int OutputDim>
class CCC::StateSpaceModel< StateDim, InputDim, OutputDim >

State-space model.

Template Parameters
StateDimstate dimension
InputDiminput dimension
OutputDimoutput dimension

\begin{align*} \boldsymbol{\dot{x}} &= \boldsymbol{A} \boldsymbol{x} + \boldsymbol{B} \boldsymbol{u} + \boldsymbol{e} \\ \boldsymbol{y} &= \boldsymbol{C} \boldsymbol{x} + \boldsymbol{D} \boldsymbol{u} + \boldsymbol{f} \end{align*}

Definition at line 21 of file StateSpaceModel.h.

Member Typedef Documentation

◆ InputDimVector

template<int StateDim, int InputDim, int OutputDim>
using CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::InputDimVector = Eigen::Matrix<double, InputDim, 1>

Type of input vector.

Definition at line 28 of file StateSpaceModel.h.

◆ OutputDimVector

template<int StateDim, int InputDim, int OutputDim>
using CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::OutputDimVector = Eigen::Matrix<double, OutputDim, 1>

Type of output vector.

Definition at line 31 of file StateSpaceModel.h.

◆ StateDimVector

template<int StateDim, int InputDim, int OutputDim>
using CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::StateDimVector = Eigen::Matrix<double, StateDim, 1>

Type of state vector.

Definition at line 25 of file StateSpaceModel.h.

Constructor & Destructor Documentation

◆ StateSpaceModel()

template<int StateDim, int InputDim, int OutputDim>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::StateSpaceModel ( int  state_dim = StateDim,
int  input_dim = InputDim,
int  output_dim = OutputDim 
)
inline

Constructor.

Parameters
state_dimstate dimension
input_diminput dimension
output_dimoutput dimension
Note
dimensions in parameter can be omitted if a fixed value is given in the template value.

Definition at line 42 of file StateSpaceModel.h.

◆ ~StateSpaceModel()

template<int StateDim, int InputDim, int OutputDim>
virtual CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::~StateSpaceModel ( )
virtualdefault

Destructor.

Note
Need to make class polymorphic. See https://stackoverflow.com/a/15114118

Member Function Documentation

◆ calcDiscMatrix()

template<int StateDim, int InputDim, int OutputDim>
void CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::calcDiscMatrix ( double  dt)
inline

Calculate the discrete system matrices \(\boldsymbol{A}_d, \boldsymbol{B}_d, \boldsymbol{e}_d\).

Parameters
dtdiscretization timestep [sec]

\begin{align*} \boldsymbol{x}_{k+1} = \boldsymbol{A}_d \boldsymbol{x}_k + \boldsymbol{B}_d \boldsymbol{u}_k + \boldsymbol{e}_d \end{align*}

Definition at line 164 of file StateSpaceModel.h.

◆ inputDim()

template<int StateDim, int InputDim, int OutputDim>
int CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::inputDim ( ) const
inline

Gets the input dimension.

Definition at line 107 of file StateSpaceModel.h.

◆ observEq() [1/2]

template<int StateDim, int InputDim, int OutputDim>
OutputDimVector CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::observEq ( const StateDimVector x) const
inline

Calculate the observation equation.

Parameters
xstate \(\boldsymbol{x}\)
Returns
observation \(\boldsymbol{y}\)

Definition at line 142 of file StateSpaceModel.h.

◆ observEq() [2/2]

template<int StateDim, int InputDim, int OutputDim>
OutputDimVector CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::observEq ( const StateDimVector x,
const InputDimVector u 
) const
inline

Calculate the observation equation.

Parameters
xstate \(\boldsymbol{x}\)
uinput \(\boldsymbol{u}\)
Returns
observation \(\boldsymbol{y}\)

Definition at line 152 of file StateSpaceModel.h.

◆ outputDim()

template<int StateDim, int InputDim, int OutputDim>
int CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::outputDim ( ) const
inline

Gets the output dimension.

Definition at line 113 of file StateSpaceModel.h.

◆ stateDim()

template<int StateDim, int InputDim, int OutputDim>
int CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::stateDim ( ) const
inline

Gets the state dimension.

Definition at line 101 of file StateSpaceModel.h.

◆ stateEq()

template<int StateDim, int InputDim, int OutputDim>
StateDimVector CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::stateEq ( const StateDimVector x,
const InputDimVector u 
) const
inline

Calculate the continuous state equation.

Parameters
xstate \(\boldsymbol{x}\)
uinput \(\boldsymbol{u}\)
Returns
time derivative of state \(\boldsymbol{\dot{x}}\)

Definition at line 123 of file StateSpaceModel.h.

◆ stateEqDisc()

template<int StateDim, int InputDim, int OutputDim>
StateDimVector CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::stateEqDisc ( const StateDimVector x,
const InputDimVector u 
) const
inline

Calculate the discrete state equation.

Parameters
xcurrent state \(\boldsymbol{x}_k\)
ucurrent input \(\boldsymbol{u}_k\)
Returns
next state \(\boldsymbol{x}_{k+1}\)

Definition at line 133 of file StateSpaceModel.h.

Member Data Documentation

◆ A_

template<int StateDim, int InputDim, int OutputDim>
Eigen::Matrix<double, StateDim, StateDim> CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::A_

Matrix \(\boldsymbol{A}\) of continuous state equation.

Definition at line 229 of file StateSpaceModel.h.

◆ Ad_

template<int StateDim, int InputDim, int OutputDim>
Eigen::Matrix<double, StateDim, StateDim> CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::Ad_

Matrix \(\boldsymbol{A}_d\) of discrete state equation.

Definition at line 250 of file StateSpaceModel.h.

◆ B_

template<int StateDim, int InputDim, int OutputDim>
Eigen::Matrix<double, StateDim, InputDim> CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::B_

Matrix \(\boldsymbol{B}\) of continuous state equation.

Definition at line 232 of file StateSpaceModel.h.

◆ Bd_

template<int StateDim, int InputDim, int OutputDim>
Eigen::Matrix<double, StateDim, InputDim> CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::Bd_

Matrix \(\boldsymbol{B}_d\) of discrete state equation.

Definition at line 253 of file StateSpaceModel.h.

◆ C_

template<int StateDim, int InputDim, int OutputDim>
Eigen::Matrix<double, OutputDim, StateDim> CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::C_

Matrix \(\boldsymbol{C}\) of observation equation.

Definition at line 235 of file StateSpaceModel.h.

◆ D_

template<int StateDim, int InputDim, int OutputDim>
Eigen::Matrix<double, OutputDim, InputDim> CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::D_

Matrix \(\boldsymbol{D}\) of observation equation.

Definition at line 238 of file StateSpaceModel.h.

◆ dt_

template<int StateDim, int InputDim, int OutputDim>
double CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::dt_ = 0

Discretization timestep [sec] (zero if discrete coefficients are not initialized)

Definition at line 247 of file StateSpaceModel.h.

◆ E_

template<int StateDim, int InputDim, int OutputDim>
StateDimVector CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::E_

Offset vector \(\boldsymbol{e}\) of continuous state equation.

Definition at line 241 of file StateSpaceModel.h.

◆ Ed_

template<int StateDim, int InputDim, int OutputDim>
StateDimVector CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::Ed_

Offset vector \(\boldsymbol{e}_d\) of discrete state equation.

Definition at line 256 of file StateSpaceModel.h.

◆ F_

template<int StateDim, int InputDim, int OutputDim>
OutputDimVector CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::F_

Offset vector \(\boldsymbol{f}\) of observation equation.

Definition at line 244 of file StateSpaceModel.h.

◆ input_dim_

template<int StateDim, int InputDim, int OutputDim>
const int CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::input_dim_ = 0

Input dimension.

Definition at line 223 of file StateSpaceModel.h.

◆ output_dim_

template<int StateDim, int InputDim, int OutputDim>
const int CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::output_dim_ = 0

Output dimension.

Definition at line 226 of file StateSpaceModel.h.

◆ state_dim_

template<int StateDim, int InputDim, int OutputDim>
const int CCC::StateSpaceModel< StateDim, InputDim, OutputDim >::state_dim_ = 0

State dimension.

Definition at line 220 of file StateSpaceModel.h.


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