|
1 |
| -# [Advanced example: the Goddard problem](@id goddard) |
| 1 | +# [Advanced example](@id goddard) |
2 | 2 |
|
3 | 3 | ## Introduction
|
4 | 4 |
|
@@ -38,7 +38,7 @@ $v(t) \leq v_{\max}$. The initial state is fixed while only the final mass is pr
|
38 | 38 | ```@setup main
|
39 | 39 | using Plots
|
40 | 40 | using Plots.PlotMeasures
|
41 |
| -plot(args...; kwargs...) = Plots.plot(args...; kwargs..., leftmargin=20px) |
| 41 | +plot(args...; kwargs...) = Plots.plot(args...; kwargs..., leftmargin=25px) |
42 | 42 | using Suppressor # to suppress warnings
|
43 | 43 | ```
|
44 | 44 |
|
@@ -141,35 +141,57 @@ We are now in position to solve the problem by an indirect shooting method. We f
|
141 | 141 | the four control laws in feedback form and their associated flows. For this we need to
|
142 | 142 | compute some Lie derivatives,
|
143 | 143 | namely [Poisson brackets](https://en.wikipedia.org/wiki/Poisson_bracket) of Hamiltonians
|
144 |
| -(themselves obtained as lifts to the cotangent bundle of vector fields), or |
| 144 | +(themselves obtained as lifts to the cotangent bundle of vector fields), or |
145 | 145 | derivatives of functions along a vector field. For instance, the control along the
|
146 | 146 | *minimal order* singular arcs is obtained as the quotient
|
| 147 | + |
147 | 148 | ```math
|
148 | 149 | u_s = -\frac{H_{001}}{H_{101}}
|
149 | 150 | ```
|
| 151 | + |
150 | 152 | of length three Poisson brackets:
|
| 153 | + |
151 | 154 | ```math
|
152 |
| -H_{001} = \{H_0,\{H_0,H_1\}\} |
| 155 | +H_{001} = \{H_0,\{H_0,H_1\}\}, \quad H_{101} = \{H_1,\{H_0,H_1\}\} |
153 | 156 | ```
|
| 157 | + |
154 | 158 | where, for two Hamiltonians $H$ and $G$,
|
| 159 | + |
155 | 160 | ```math
|
156 | 161 | \{H,G\} := (\nabla_p H|\nabla_x G) - (\nabla_x H|\nabla_p G).
|
157 | 162 | ```
|
| 163 | + |
158 | 164 | While the Lie derivative of a function $f$ *wrt.* a vector field $X$ is simply obtained as
|
| 165 | + |
159 | 166 | ```math
|
160 | 167 | (X \cdot f)(x) := f'(x) \cdot X(x),
|
161 | 168 | ```
|
162 |
| -and is used to the compute the control along the boundary arc, |
| 169 | + |
| 170 | +and is used to the compute the control along the boundary arc, |
| 171 | + |
163 | 172 | ```math
|
164 | 173 | u_b(x) = -(F_0 \cdot g)(x) / (F_1 \cdot g)(x),
|
165 | 174 | ```
|
| 175 | + |
166 | 176 | as well as the associated multiplier for the *order one* state constraint on the velocity:
|
| 177 | + |
167 | 178 | ```math
|
168 | 179 | \mu(x, p) = H_{01}(x, p) / (F_1 \cdot g)(x).
|
169 | 180 | ```
|
170 | 181 |
|
| 182 | +!!! note |
| 183 | + |
| 184 | + The Poisson bracket $\{H,G\}$ is also given by the Lie derivative of $G$ along the |
| 185 | + Hamiltonian vector field $X_H = (\nabla_p H, -\nabla_x H)$ of $H$, that is |
| 186 | + |
| 187 | + ```math |
| 188 | + \{H,G\} = X_H \cdot G |
| 189 | + ``` |
| 190 | + |
| 191 | + which is the reason why we use the `@Lie` macro to compute Poisson brackets below. |
| 192 | + |
171 | 193 | With the help of the [differential geometry primitives](https://control-toolbox.org/CTBase.jl/stable/api-diffgeom.html)
|
172 |
| -form [CTBase.jl](https://control-toolbox.org/CTBase.jl/stable/index.html), |
| 194 | +from [CTBase.jl](https://control-toolbox.org/docs/ctbase), |
173 | 195 | these expressions are straightforwardly translated into Julia code:
|
174 | 196 |
|
175 | 197 | ```@example main
|
@@ -198,7 +220,7 @@ Then, we define the shooting function according to the optimal structure we have
|
198 | 220 | that is a concatenation of four arcs.
|
199 | 221 |
|
200 | 222 | ```@example main
|
201 |
| -x0 = [ r0, v0, m0 ] # initial state |
| 223 | +x0 = [ r0, v0, m0 ] # initial state |
202 | 224 |
|
203 | 225 | function shoot!(s, p0, t1, t2, t3, tf)
|
204 | 226 |
|
@@ -252,8 +274,8 @@ Finally, we can solve the shooting equations thanks to the [MINPACK](https://doc
|
252 | 274 | ```@example main
|
253 | 275 | using MINPACK # NLE solver
|
254 | 276 |
|
255 |
| -nle = (s, ξ) -> shoot!(s, ξ[1:3], ξ[4], ξ[5], ξ[6], ξ[7]) # auxiliary function with aggregated inputs |
256 |
| -
|
| 277 | +nle = (s, ξ) -> shoot!(s, ξ[1:3], ξ[4], ξ[5], ξ[6], ξ[7]) # auxiliary function |
| 278 | + # with aggregated inputs |
257 | 279 | ξ = [ p0 ; t1 ; t2 ; t3 ; tf ] # initial guess
|
258 | 280 | indirect_sol = @suppress_err begin # hide
|
259 | 281 | fsolve(nle, ξ)
|
|
0 commit comments