Jason K. Moore
July 8, 2015
SciPy 2015, Austin, Texas, USA
Ackermann, M. and van den Bogert, A. J. Predictive simulation of gait at low gravity reveals skipping as the preferred
locomotion strategy. Journal of Biomechanics, 45, 2012
Earth: g=9.8 m/s-2 |
Moon: g=1.6 m/s-2 |
$\dot{\mathbf{x}} = \begin{bmatrix} \dot{\theta}(t) \\ \dot{\omega}(t) \end{bmatrix} = \begin{bmatrix} \omega(t) \\ \frac{g}{l} \sin{\theta}(t) + \mathbf{T} \end{bmatrix}$
$J(\mathbf{T}) = \min\limits_{\mathbf{T}} \int_{t_0}^{t_f} \mathbf{T}^2 dt$
Pendulum figure: https://commons.wikimedia.org/wiki/File:Pendulum_gravity.svg, Creative Commons Attribution-Share Alike 3.0 Unported
Find the parameters $\mathbf{p}$ such that the difference between the model simulation, $\mathbf{y}$, and measurements, $\mathbf{y}_m$ is minimized.
where $$J(\mathbf{p}) = \int [\mathbf{y}_m - \mathbf{y}(\mathbf{p})]^2 dt$$
Vyasarayani, Chandrika P., Thomas Uchida, Ashwin Carvalho, and John McPhee.
"Parameter Identification in Dynamic Systems Using the Homotopy Optimization Approach". Multibody System Dynamics 26, no. 4 (2011): 411-24.
$\dot{\mathbf{x}} = \begin{bmatrix} \dot{\theta}(t) \\ \dot{\omega}(t) \end{bmatrix} = \begin{bmatrix} \omega(t) \\ -p \sin{\theta}(t) \end{bmatrix}$
$J(p) = \min\limits_{p} \int_{t_0}^{t_f} [\theta_m(t) - \theta(\mathbf{x}, p, t)]^2 dt$
No need to solve for $\dot{\mathbf{x}}$.
$$\mathbf{f}(\dot{\mathbf{x}}, \mathbf{x}, \mathbf{r}, \mathbf{p}, t) = 0$$Backward Euler:
$\mathbf{f}(\frac{\mathbf{x}_i - \mathbf{x}_{i-1}}{h} , \mathbf{x}_i, \mathbf{r}_i, \mathbf{p}, t_i) = 0$
Midpoint Rule:
$\mathbf{f}(\frac{\mathbf{x}_{i + 1} - \mathbf{x}_i}{h}, \frac{\mathbf{x}_i + \mathbf{x}_{i + 1}}{2}, \frac{\mathbf{r}_i + \mathbf{r}_{i + 1}}{2}, \mathbf{p}, t_i) = 0$
# Specify symbols for the parameters
p, t = symbols('p, t')
# Specify the functions of time
theta, omega, theta_m, T = symbols('theta, omega, theta_m, T', cls=Function)
# Specify the symbolic equations of motion
eom = Matrix([theta(t), omega(t)]).diff(t) - Matrix([omega(t), -p * sin(theta(t) + T(t))])
# Choose discretization values
num_nodes = 1000
interval = 0.01 # seconds
obj = Integral(T(t)**2, t)
boundary_constraints = (theta(0.0), theta(duration) - pi / 2, omega(0.0), omega(duration))
prob = Problem(obj, # symbolic objective
eom, # symbolic equations of motion
(theta(t), omega(t)), # system symbolic states
num_nodes,
interval,
known_parameter_map={p: 9.81},
instance_constraints=boundary_constraints)
# Set an initial guess
initial_guess = random(prob.num_free)
# Solve the system
solution, info = prob.solve(initial_guess)
*Still in development
<img src="two-link-pendulum-with-cart.svg"style="float:right;margin=5px;" width=400px/>
Given the boundary conditions can we find the optimal input trajectory such that the "effort" is minimized?
$$\min\limits_\theta J(\mathbf{\theta}), \quad J(\mathbf{\theta})= \sum_{i=1}^N h [\mathbf{T}_i]^2$$where
$$ \mathbf{\theta} = [\mathbf{x}_1, \ldots, \mathbf{x}_N, \mathbf{T}_i, \ldots \mathbf{T}_N] $$Subject to the constraints:
$$\mathbf{f}(\mathbf{x}_i, \mathbf{T}_i)=0, \quad i=1 \ldots N$$And the initial guess:
$$\mathbf{\theta}_0 = [\mathbf{0}]$$For, $N$ = 500:
$$\dot{\mathbf{x}} = \mathbf{f}_o(\mathbf{x}, \mathbf{r}_c, \mathbf{r}_k, \mathbf{p}_k, t)$$
Given noisy measurements of the states, $\mathbf{x}_m$, and the platform acceleration, $a_m$, can we identify the controller parameters $\mathbf{K}$?
$$\min\limits_\theta J(\mathbf{\theta}), \quad J(\mathbf{\theta})= \sum_{i=1}^N h [\mathbf{x}_{mi} - \mathbf{x}_i]^2$$where
$$ \mathbf{\theta} = [\mathbf{x}_1, \ldots, \mathbf{x}_N, \mathbf{p}_u] $$Subject to the constraints:
$$\mathbf{f}_{ci}(\mathbf{x}_i, a_{mi}, \mathbf{p}_u)=0, \quad i=1 \ldots N$$And the initial guess:
$$\mathbf{\theta}_0 = [\mathbf{x}_{m1}, \ldots, \mathbf{x}_{mN}, \mathbf{0}]$$For, $N$ = 6000:
Converges in 11 iterations in 2.8 seconds of computation time.
Known | Identified | Error | |
---|---|---|---|
$k_{00}$ | 950 | 946 | -0.4% |
$k_{01}$ | 175 | 177 | 1.4% |
$k_{02}$ | 185 | 185 | -0.2% |
$k_{03}$ | 50 | 55 | 9.4% |
$k_{10}$ | 45 | 45 | 1.1% |
$k_{11}$ | 290 | 289 | -0.3% |
$k_{12}$ | 60 | 59 | -2.1% |
$k_{13}$ | 26 | 27 | 4.2% |