Skip to content

Commit

Permalink
issue #54: Added code, added picture of the reachability tube and set
Browse files Browse the repository at this point in the history
  • Loading branch information
BabaylovaPolina committed Feb 15, 2018
1 parent c65c7c2 commit 581e271
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 10 deletions.
29 changes: 19 additions & 10 deletions doc/chap_examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -632,14 +632,27 @@ Defining :math:`x_1 = x, x_2=\dot{x}_1, x_3 = \theta` and :math:`x_4=\dot{x}_3`,
0 \\
-\frac{m_2Lg\pi}{4J_c+m_2L^2} \end{array}\right].
Consider some moment of time :math:`t_1` and final position :math:`x_1(t_1) = x_1, x_2(t_1) = 0, x_3(t_1) = \frac{\pi}{2}, x_4(t_1) = 0`. It is required to calculate the backward reachability sets (tube) for the linearized system :eq:`invpendls` emanating from the given final position and project it onto :math:`(x_1, x_3)` subspace. It is also required to identify whether it’s possible to reach the final position from a given initial position :math:`x_1(t_1) = x_1, x_2(t_1) = v_1, x_3(t_1) = \theta_1, x_4(t_1) = \omega_1` using some admissible control function.
Consider some moment of time :math:`t_1` and final position :math:`x_1(t_1) = x^1_1, x_2(t_1) = 0, x_3(t_1) = \frac{\pi}{2}, x_4(t_1) = 0`. It is required to calculate the backward reachability sets (tube) for the linearized system :eq:`invpendls` emanating from the given final position and project it onto :math:`(x_1, x_3)` subspace. It is also required to identify whether it’s possible to reach the final position from a given initial position :math:`x_1(t_0) = x^0_1, x_2(t_0) = v_1, x_3(t_0) = \theta_1, x_4(t_0) = \omega_1` using some admissible control function.

.. raw:: html
<h2>References</h2>
.. literalinclude:: ../products/+elltool/+doc/+snip/s_chapter06_section05_snippet01.m
:language: matlab
:linenos:

.. [SUN2003] L.Muñoz, X.Sun, R.Horowitz, and L.Alvarez. 2003. Traffic Density
Estimation with the Cell Transmission Model. In *Proceedings of the
American Control Conference*, 3750–3755. Denver, Colorado, USA.
.. _brset:

.. figure:: /pic/chapter06_section05_set1.png
:alt: set1
:width: 50 %

Backward reachability set

.. _brtube:

.. figure:: /pic/chapter06_section05_tube1.png
:alt: tube1
:width: 50 %

Backward reachability tube


LMI-based three-vehicle platoon
Expand Down Expand Up @@ -858,7 +871,3 @@ Solving collision problem:
robust longitudinal guidance. Proceedings of the 17th World Congress
The International Federation of Automatic Control
Seoul, Korea, July 6-11, 2008
=======
Consider some moment of time :math:`t_1` and final position :math:`x_1(t_1) = x^1_1, x_2(t_1) = 0, x_3(t_1) = \frac{\pi}{2}, x_4(t_1) = 0`. It is required to calculate the backward reachability sets (tube) for the linearized system :eq:`invpendls` emanating from the given final position and project it onto :math:`(x_1, x_3)` subspace. It is also required to identify whether it’s possible to reach the final position from a given initial position :math:`x_1(t_0) = x^0_1, x_2(t_0) = v_1, x_3(t_0) = \theta_1, x_4(t_0) = \omega_1` using some admissible control function.


Binary file added doc/pic/chapter06_section05_set1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/chapter06_section05_tube1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions products/+elltool/+doc/+snip/s_chapter06_section05_snippet01.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
alpha = 10;
k1 = 50;
k2 = 500;
m1 = 150;
m2 = 100;
L = 5;
g = 9.8;
Jc = 100;

x1 = 1;
v1 = 0;
theta1 = pi/2;
omega1 = 0;
t1 = 1;

d = Jc + m2*L^2/4;
% define matrices aMat, bMat, and control bounds uBoundsEllObj:
aMat = [0, 1, 0, 0; 0, -k1/m1, 0, 0; 0, 0, 0, 1; 0, 0, m2*L*g/2/d, -k2*L/d];
bMat = [0; 1/m1; 0; 0];
uBoundsEllObj = alpha * ell_unitball(1);
%define disturbance:
gMat = [0; 0; 0; -m2*L*g*pi/4/d];
vEllObj = ellipsoid(1, 0); %known disturbance

%linear system
lsys = elltool.linsys.LinSysContinuous(aMat, bMat, uBoundsEllObj,...
gMat, vEllObj);
timeVec = [t1, 0];
% initial directions (some random vectors in R^4):
dirsMat = [1 0 1 0; 1 -1 0 0; 0 -1 0 1; 1 1 -1 1; -1 1 1 0; -2 0 1 1].';
% x1EllObj = ellipsoid([x1; v1; theta1; omega1], eps*eye(4)); %known final point
x1EllObj = ellipsoid([x1; v1; theta1; omega1], zeros(4)); %known final point


%backward reach set
brsObj = elltool.reach.ReachContinuous(lsys, x1EllObj, dirsMat, timeVec,...
'isRegEnabled', true, 'isJustCheck', false, 'regTol', 1e-4,...
'absTol', 1e-5, 'relTol', 1e-4);

basisMat = [1 0 0 0; 0 0 1 0].'; % orthogonal basis of (x1, x3) subspace
psObj = brsObj.projection(basisMat); % reach set projection

% plot projection of reach set internal approximation:
psObj.plotByIa('b');

%plot backward reach set approximation at time t=0
psCutObj = psObj.cut(0);
psCutObj.plotByIa('r');

1 comment on commit 581e271

@irublev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You should make the labels on the pictures understandable for the user by using clear notations taken from the description of your model. I.e. not simply [1 0 0 0], [0 0 1 0], but what these phase coordinates really mean.

  2. The number of pictures should be increased

  3. The discussion of these pictures should be slightly extended. I.e. not only "Backward reachability set" and "Backward reachability tube" (after the corresponding pictures), but something more detailed, full sentences with verbs (each BEFORE the respective picture)

Please sign in to comment.