Rigid Body Rotation

On smooth optimal control determination, Ilya Ioslovich and Per-Olof Gutman, Technion, Israel Institute of Technology.

Example 1: Rigid body rotation

Contents

Problem Description

Find u over t in [0; 1 ] to minimize:

$$ J = \frac{1}{4}*\int_0^{1} (u_1^2+u_2^2)^2 \mathrm{d}t $$

subject to:

$$ \frac{dx}{dt} = a*y+u_1 $$

$$ \frac{dy}{dt} = -a*x+u_2 $$

$$ \frac{du_1}{dt} = a*u_2 $$

$$ \frac{du_2}{dt} = -a*u_1 $$

$$ x(t_0) = [0.9 \ 0.75] $$

$$ x(t_f) = [0 \ 0] $$

$$ a = 2 $$

% Copyright (c) 2007-2008 by Tomlab Optimization Inc.

Problem setup

toms t
p = tomPhase('p', t, 0, 1, 20);
setPhase(p);

tomStates x y u1 u2

% Boundary constraints
cbnd = {initial({x == 0.9; y == 0.75})
    final({x == 0; y == 0})};

% ODEs and path constraints
a = 2;
ceq = collocate({dot(x)  == a*y+u1; dot(y)  == -a*x+u2
    dot(u1) == a*u2; dot(u2) == -a*u1});

% Objective
objective = 0.25*integrate((u1.^2+u2.^2).^2);

Solve the problem

options = struct;
options.name = 'Rigid Body Rotation';
solution = ezsolve(objective, {cbnd, ceq}, [], options);
t  = subs(collocate(t),solution);
x = subs(collocate(x),solution);
y = subs(collocate(y),solution);
u1 = subs(collocate(u1),solution);
u2 = subs(collocate(u2),solution);
Problem type appears to be: con
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2010-02-05
=====================================================================================
Problem: ---  1: Rigid Body Rotation            f_k       0.470939062499997170
                                       sum(|constr|)      0.000000000000549555
                              f(x_k) + sum(|constr|)      0.470939062500546730
                                              f(x_0)      0.000000000000000000

Solver: snopt.  EXIT=0.  INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied

FuncEv    3 GradEv    1 MinorIter   34
CPU time: 0.015625 sec. Elapsed time: 0.016000 sec. 

Plot result

figure(1);
subplot(2,1,1);
plot(t,x,'*-',t,y,'*-');
legend('x','y');

subplot(2,1,2);
plot(t,u1,'*-',t,u2,'*-');
legend('u1','u2');