@@ -18,23 +18,23 @@ Overview of differential flatness
1818A nonlinear differential equation of the form
1919
2020.. math ::
21-
22- \dot x = f(x, u), \qquad x \in R^n, u \in R^m
21+
22+ \dot x = f(x, u), \qquad x \in R^n, u \in R^m
2323
2424 is *differentially flat * if there exists a function :math: `\alpha ` such that
2525
2626.. math ::
27-
28- z = \alpha (x, u, \dot u\, \dots , u^{(p)})
27+
28+ z = \alpha (x, u, \dot u\, \dots , u^{(p)})
2929
3030 and we can write the solutions of the nonlinear system as functions of
3131:math: `z` and a finite number of derivatives
3232
3333.. math ::
34- :label: flat2 state
35-
36- x &= \beta (z, \dot z, \dots , z^{(q)}) \\
37- u &= \gamma (z, \dot z, \dots , z^{(q)}).
34+ :label: flat2 state
35+
36+ x &= \beta (z, \dot z, \dots , z^{(q)}) \\
37+ u &= \gamma (z, \dot z, \dots , z^{(q)}).
3838
3939 For a differentially flat system, all of the feasible trajectories for
4040the system can be written as functions of a flat output :math: `z(\cdot )` and
@@ -48,15 +48,15 @@ space, and then map these to appropriate inputs. Suppose we wish to
4848generate a feasible trajectory for the nonlinear system
4949
5050.. math ::
51-
52- \dot x = f(x, u), \qquad x(0 ) = x_0 ,\, x(T) = x_f.
51+
52+ \dot x = f(x, u), \qquad x(0 ) = x_0 ,\, x(T) = x_f.
5353
5454 If the system is differentially flat then
5555
5656.. math ::
57-
58- x(0 ) &= \beta \bigl (z(0 ), \dot z(0 ), \dots , z^{(q)}(0 ) \bigr ) = x_0 , \\
59- x(T) &= \gamma \bigl (z(T), \dot z(T), \dots , z^{(q)}(T) \bigr ) = x_f,
57+
58+ x(0 ) &= \beta \bigl (z(0 ), \dot z(0 ), \dots , z^{(q)}(0 ) \bigr ) = x_0 , \\
59+ x(T) &= \gamma \bigl (z(T), \dot z(T), \dots , z^{(q)}(T) \bigr ) = x_f,
6060
6161 and we see that the initial and final condition in the full state
6262space depends on just the output :math: `z` and its derivatives at the
@@ -72,45 +72,45 @@ trajectory of the system. We can parameterize the flat output trajectory
7272using a set of smooth basis functions :math: `\psi _i(t)`:
7373
7474.. math ::
75-
76- z(t) = \sum _{i=1 }^N c_i \psi _i(t), \qquad c_i \in R
75+
76+ z(t) = \sum _{i=1 }^N c_i \psi _i(t), \qquad c_i \in R
7777
7878 We seek a set of coefficients :math: `c_i`, :math: `i = 1 , \dots , N` such
7979that :math: `z(t)` satisfies the boundary conditions for :math: `x(0 )` and
8080:math: `x(T)`. The derivatives of the flat output can be computed in terms of
8181the derivatives of the basis functions:
8282
8383.. math ::
84-
85- \dot z(t) &= \sum _{i=1 }^N c_i \dot \psi _i(t) \\
86- &\,\vdots \\
87- \dot z^{(q)}(t) &= \sum _{i=1 }^N c_i \psi ^{(q)}_i(t).
84+
85+ \dot z(t) &= \sum _{i=1 }^N c_i \dot \psi _i(t) \\
86+ &\, \vdots \\
87+ \dot z^{(q)}(t) &= \sum _{i=1 }^N c_i \psi ^{(q)}_i(t).
8888
8989 We can thus write the conditions on the flat outputs and their
9090derivatives as
9191
9292.. math ::
93-
94- \begin {bmatrix}
95- \psi _1 (0 ) & \psi _2 (0 ) & \dots & \psi _N(0 ) \\
96- \dot \psi _1 (0 ) & \dot \psi _2 (0 ) & \dots & \dot \psi _N(0 ) \\
97- \vdots & \vdots & & \vdots \\
98- \psi ^{(q)}_1 (0 ) & \psi ^{(q)}_2 (0 ) & \dots & \psi ^{(q)}_N(0 ) \\[ 1 ex]
99- \psi _1 (T) & \psi _2 (T) & \dots & \psi _N(T) \\
100- \dot \psi _1 (T) & \dot \psi _2 (T) & \dots & \dot \psi _N(T) \\
101- \vdots & \vdots & & \vdots \\
102- \psi ^{(q)}_1 (T) & \psi ^{(q)}_2 (T) & \dots & \psi ^{(q)}_N(T) \\
103- \end {bmatrix}
104- \begin {bmatrix} c_1 \\ \vdots \\ c_N \end {bmatrix} =
105- \begin {bmatrix}
106- z(0 ) \\ \dot z(0 ) \\ \vdots \\ z^{(q)}(0 ) \\[ 1 ex]
107- z(T) \\ \dot z(T) \\ \vdots \\ z^{(q)}(T) \\
108- \end {bmatrix}
93+
94+ \begin {bmatrix}
95+ \psi _1 (0 ) & \psi _2 (0 ) & \dots & \psi _N(0 ) \\
96+ \dot \psi _1 (0 ) & \dot \psi _2 (0 ) & \dots & \dot \psi _N(0 ) \\
97+ \vdots & \vdots & & \vdots \\
98+ \psi ^{(q)}_1 (0 ) & \psi ^{(q)}_2 (0 ) & \dots & \psi ^{(q)}_N(0 ) \\[ 1 ex]
99+ \psi _1 (T) & \psi _2 (T) & \dots & \psi _N(T) \\
100+ \dot \psi _1 (T) & \dot \psi _2 (T) & \dots & \dot \psi _N(T) \\
101+ \vdots & \vdots & & \vdots \\
102+ \psi ^{(q)}_1 (T) & \psi ^{(q)}_2 (T) & \dots & \psi ^{(q)}_N(T) \\
103+ \end {bmatrix}
104+ \begin {bmatrix} c_1 \\ \vdots \\ c_N \end {bmatrix} =
105+ \begin {bmatrix}
106+ z(0 ) \\ \dot z(0 ) \\ \vdots \\ z^{(q)}(0 ) \\[ 1 ex]
107+ z(T) \\ \dot z(T) \\ \vdots \\ z^{(q)}(T) \\
108+ \end {bmatrix}
109109
110110 This equation is a *linear * equation of the form
111111
112112.. math ::
113-
113+
114114 M c = \begin {bmatrix} \bar z(0 ) \\ \bar z(T) \end {bmatrix}
115115
116116 where :math: `\bar z` is called the *flat flag * for the system.
@@ -123,43 +123,43 @@ Module usage
123123
124124To create a trajectory for a differentially flat system, a
125125:class: `~flatsys.FlatSystem ` object must be created. This is done
126- using the :func: `~flatsys.flatsys ` function:
126+ using the :func: `~flatsys.flatsys ` function::
127127
128- import control.flatsys as fs
129- sys = fs.flatsys(forward, reverse)
128+ import control.flatsys as fs
129+ sys = fs.flatsys(forward, reverse)
130130
131131The `forward ` and `reverse ` parameters describe the mappings between the
132132system state/input and the differentially flat outputs and their
133133derivatives ("flat flag").
134134
135135The :func: `~flatsys.FlatSystem.forward ` method computes the
136- flat flag given a state and input:
136+ flat flag given a state and input::
137137
138- zflag = sys.forward(x, u)
138+ zflag = sys.forward(x, u)
139139
140140The :func: `~flatsys.FlatSystem.reverse ` method computes the state
141- and input given the flat flag:
141+ and input given the flat flag::
142142
143- x, u = sys.reverse(zflag)
143+ x, u = sys.reverse(zflag)
144144
145145The flag :math: `\bar z` is implemented as a list of flat outputs :math: `z_i`
146146and their derivatives up to order :math: `q_i`:
147147
148- zflag[i][j] = :math: `z_i^{(j)}`
148+ ` zflag[i][j] ` = :math: `z_i^{(j)}`
149149
150150The number of flat outputs must match the number of system inputs.
151151
152152For a linear system, a flat system representation can be generated by
153153passing a :class: `StateSpace ` system to the
154154:func: `~flatsys.flatsys ` factory function::
155155
156- sys = fs.flatsys(linsys)
156+ sys = fs.flatsys(linsys)
157157
158158The :func: `~flatsys.flatsys ` function also supports the use of
159159named input, output, and state signals::
160160
161- sys = fs.flatsys(
162- forward, reverse, states=['x1', ..., 'xn'], inputs=['u1', ..., 'um'])
161+ sys = fs.flatsys(
162+ forward, reverse, states=['x1', ..., 'xn'], inputs=['u1', ..., 'um'])
163163
164164In addition to the flat system description, a set of basis functions
165165:math: `\phi _i(t)` must be chosen. The `FlatBasis ` class is used to
@@ -168,7 +168,7 @@ form 1, :math:`t`, :math:`t^2`, ... can be computed using the
168168:class: `~flatsys.PolyFamily ` class, which is initialized by
169169passing the desired order of the polynomial basis set::
170170
171- basis = fs.PolyFamily(N)
171+ basis = fs.PolyFamily(N)
172172
173173Additional basis function families include Bezier curves
174174(:class: `~flatsys.BezierFamily `) and B-splines
@@ -178,14 +178,14 @@ Once the system and basis function have been defined, the
178178:func: `~flatsys.point_to_point ` function can be used to compute a
179179trajectory between initial and final states and inputs::
180180
181- traj = fs.point_to_point(
182- sys, Tf, x0, u0, xf, uf, basis=basis)
181+ traj = fs.point_to_point(
182+ sys, Tf, x0, u0, xf, uf, basis=basis)
183183
184184The returned object has class :class: `~flatsys.SystemTrajectory ` and
185185can be used to compute the state and input trajectory between the initial and
186186final condition::
187187
188- xd, ud = traj.eval(T)
188+ xd, ud = traj.eval(T)
189189
190190where `T ` is a list of times on which the trajectory should be evaluated
191191(e.g., `T = numpy.linspace(0, Tf, M) `.
@@ -197,8 +197,8 @@ format as :func:`optimal.solve_ocp`.
197197The :func: `~flatsys.solve_flat_ocp ` function can be used to
198198solve an optimal control problem without a final state::
199199
200- traj = fs.solve_flat_ocp(
201- sys, timepts, x0, u0, cost, basis=basis)
200+ traj = fs.solve_flat_ocp(
201+ sys, timepts, x0, u0, cost, basis=basis)
202202
203203The `cost ` parameter is a function with call signature
204204`cost(x, u) ` and should return the (incremental) cost at the given
@@ -295,7 +295,7 @@ the endpoints.
295295
296296 Alternatively, we can solve an optimal control problem in which we
297297minimize a cost function along the trajectory as well as a terminal
298- cost:`
298+ cost:
299299
300300.. code-block :: python
301301
0 commit comments