RIT VEXU Core API
Toggle main menu visibility
Loading...
Searching...
No Matches
linear_system.h
1
#pragma once
2
3
#include "core/utils/math/eigen_interface.h"
4
#include "core/utils/math/systems/discretization.h"
5
15
template
<
int
STATES,
int
INPUTS,
int
OUTPUTS>
16
class
LinearSystem
{
17
public
:
18
using
MatrixA = EMat<STATES, STATES>;
19
using
MatrixB = EMat<STATES, INPUTS>;
20
using
MatrixC = EMat<OUTPUTS, STATES>;
21
using
MatrixD = EMat<OUTPUTS, INPUTS>;
22
23
using
VectorX = EVec<STATES>;
24
using
VectorU = EVec<INPUTS>;
25
using
VectorY = EVec<OUTPUTS>;
26
35
LinearSystem
(
const
MatrixA &
A
,
const
MatrixB &
B
,
const
MatrixC &
C
,
const
MatrixD &
D
) : m_Ac(
A
), m_Bc(
B
), m_C(
C
), m_D(
D
) {}
36
40
MatrixA
A
() {
return
m_Ac; }
41
45
MatrixB
B
() {
return
m_Bc; }
46
50
const
std::tuple<std::tuple<MatrixA, MatrixB>> &
discAB
(
const
double
&dt) {
return
discretize_AB(m_Ac, m_Bc, dt); }
51
55
MatrixC
C
() {
return
m_C; }
56
60
MatrixD
D
() {
return
m_D; }
61
72
VectorX
compute_X
(
const
VectorX &x,
const
VectorU &u,
double
dt) {
73
// Discretize A and B
74
auto
[Ad, Bd] = discretize_AB(m_Ac, m_Bc, dt);
75
76
return
Ad * x + Bd * u;
77
}
78
87
VectorY
compute_Y
(
const
VectorX &x,
const
VectorU &u) {
88
return
m_C * x + m_D * u;
89
}
90
91
private
:
92
// Continuous system matrix
93
MatrixA m_Ac;
94
// Continuous input matrix
95
MatrixB m_Bc;
96
// Output matrix
97
MatrixC m_C;
98
// Feedthrough matrix
99
MatrixD m_D;
100
};
LinearSystem::compute_X
VectorX compute_X(const VectorX &x, const VectorU &u, double dt)
Definition
linear_system.h:72
LinearSystem::B
MatrixB B()
Definition
linear_system.h:45
LinearSystem::discAB
const std::tuple< std::tuple< MatrixA, MatrixB > > & discAB(const double &dt)
Definition
linear_system.h:50
LinearSystem::LinearSystem
LinearSystem(const MatrixA &A, const MatrixB &B, const MatrixC &C, const MatrixD &D)
Definition
linear_system.h:35
LinearSystem::C
MatrixC C()
Definition
linear_system.h:55
LinearSystem::D
MatrixD D()
Definition
linear_system.h:60
LinearSystem::A
MatrixA A()
Definition
linear_system.h:40
LinearSystem::compute_Y
VectorY compute_Y(const VectorX &x, const VectorU &u)
Definition
linear_system.h:87
include
core
utils
math
systems
linear_system.h
Generated by
1.17.0