Unicycle Model and Control
Unicycle Model and Control
Mobile Robotics
Matteo Ragni [161822] July 14, 2013
A.A. 2012/2013
Contents
1 Mobile Robot Design 2 Nonholomic systems
Constraint types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Integrability and involutivity Global and local accessibility
1 3
3 4 5
3 Accessibility space
Unicycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Car Like . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Car Like FD Car Like RD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
6 8 9 10
4 Matlab Project
Theoretic approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulink models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Feedback linearization
11
11 17 17 22
Input/output linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduce mobile robot designing with considerations about the interrelation existing within:
task, during analysis and synthesis of a mobile robot, represents the rst necessary
1
step that will dene a great number of specications, both mechanical and electrical, of the nal robot. Actually, we can identify two dierent approaches in the denition of the task, as testied in "Learning to understand task for mobile robots ": an approach that is completely "a priori", that will be the one that we will consider in this little essay, and an hybrid approach, that is the one deepened in Cognitive Robotics of this course.
1 Hegen
In the
hybrid approach, the task is completely dened only after the design and production
of the mobile robot, and this constrains the designer to give some redundant and maybe not completely useful characteristics to the robot, to make it capable to work in a particular context (we can also consider it as a framework approach). Sometimes, the procedure to assign a task to the robot is put beside a control architecture that is able to learn. In the
a priori approach, before robot initial design, task is analyzed deeply, and main aspects type of environment in which the robot will operate.
The environment
of a task will be used to dene, in a rigorous way, specications of the robot. This approach is the only one that can be used to achieve an optimal design. Specication and design process should take into account the may be:
semi-structured :
initial path or trajectory, but robot must be elastic to perturbation (obstacle avoidance, map variations, symmetric spaces, etc.);
unstructured : there is no knowledge about enviroment and its map, and also may be no
knowledge about eventually perturbation to system recognition/environment mapping.
Try to think about a mobile robot that will operate in a semi-structured environment, in which designer may dene a
trajectory
q(t)
for
t [ts , te ]
The problem of
planning a trajectory can be broken down in nding a path Mobile robots have some
q(s)
s(t).
centered wheel without skeet generates a nonholonomic constraint on contact point between wheel and ground) and dened as non-integrable, or in Pfaan form:
kinematic model:
unicycle (that can be used also for dierential drive and synchro drive robots); bicycle rear driven or front driven (that can be used also with all car-like robots).
This equation, if it is not integrable, costraints generalized speeds of mobile robots in a subspace of all possible speed congurations. We will see integrability conditions in the next exercise. In addition to complying with the bonduary conditions, a possible path planning must also satisfy any nonholonomic constraint at all points. a time-dependent scalar function space, so given: If we can express our path as a function of
s(t),
= q
that may be used to rewrite constraints:
dq dq = s =q s dt ds
AT (q(s)) q s = A (q(s)) q
for
0 0 q.
There are
s = 0.
dierent way to dene this path, the most used are: planning via cartesian polynomials on degree space or in chained form space; planning via parametrized input (given the parametric input, one evaluate parameters that generate desired output);
l 3,
From this last equation is clear the strict relation between kinematic model (that denes constraints) and feasible trajectory or path (that must be a possible solution of kinematic constraints). It is important to notice that even if space of possible trajectories is reduced, space of conguration for the system is not reduced: even if a conguration
q(t ) = q
with a minimal trajectory), globally this conguration could be reached with a concatenation of minimal trajectories (if it belongs to congurational space). The last step is to dene a timing law that could be obtained through:
min (J ) = min
tf
ti
dt
(as key point or geometrical function), trajectory following (dened as a geometrical function parametrized with respect to time, expressed in joint-space or in work-space). from the sensors. Those low level routines shall be used to dene a series of must be implemented a big set of any simple commands, such as the response to events derived
that allow
our robot to response in an appropriate way to environment perturbation, for example, to avoid collision with object (devising a new path on the imposed trajectory). This architecture in robotic cognition science is also called
subsumption architecture,
2 3
introduced by Brooks in "Intelligence without representation ", based upon the previous work "A robust layered control for a mobile robot ". This high level routines act as a general strategies to accomplish the dened task. The circle is closed whereas we consider that the nature of the task aects directly the complexity of the strategy that must be implemented. Sometimes some high level structures are not necessary, so we can relax some control hypothesis (for example, a symmetric robot may not be interested in attitude control), simplifying our problem.
Nonholomic systems
(non)holonomicity (non)integrability (non)involutivity instantaneus motion directions (local) global accessibility (with manoeuvring !?)
Constraint types
Consider a mechanical system. The space of possible congurations
C Rn
is described with
q C. = 0)
0);
or rheonomic (or
) scleronomous (or xed) constraints if not time dependent (h(q, q ) mobile) constraints if time dependent (h(t, q, q
= 0)
smooth constraint (if reaction is parallel to constraint direction) or scabrous constraint (if reaction isn't parallel to constraint direction).
2 Brooks, 3 Brooks,
Consider a mechanical system subject only to If all constraint may be rewritten in form:
hi (q) = 0
those constraints are dened as functions
i = 1, ..., k
h() : C R are suciently smooth. This type of constraint limits the space of accessible nk congurations to a subspace G R and can be used to dene a map to subspace G . Considering qA G the set of degree of freedom that are accessible, and qB C\G the degrees of freedom that are not accessible, it is possible to dene, inverting the set of holonomous equations h(): qB, i (qA ) : C\G C
of the space
holonomic
or
integrable.
i = 1, ..., k
Possible congurations that can be reached by mechanical system coincide with all congurations
of this constraints are spherical and prismatic joints used in robot manipulators. Constraints that involve both the generalized coordinates that their derivatives with respect to time and can not be traced (either by integration) to holonomous form are said or
not integrable:
non-holonomic
) = 0 ai (q, q
i = 1, ..., k
In the next section we will see what characterized this constraints, but before that we have to explore the concept of integrability of this type of equations.
) = 0 AT (q) q =0 a(q, q
This particular system of equations is said Pfaan system of equations, if matrix characterized by column vectors linearly independent. Consider for the moment, in order to understand, a mechanical system with constraint equations turn out to be only one:
A()
is
ai () : C Rn
k = 1.
The
aT (q) q =0
If this constraint equation is of type holonomic, this can be integrated and dened as a function of only the generalized coordinates:
h(q) = c;
h =0 (q) = q h(q) q t
and
of the system were conned with respect to a particular contour line of the hyper-surface dened by the function In fact, given an initial conguration for the model in a space of congurations dened by the contour line (the contour line itself ) of
n1
degrees of freedom.
Consider instead that the constraint is non-holonomous. We said that this constraint is also called non-integrable, eg. can not be traced back to the primitive form expressed above for holonomic constraints. Considering the constraint equation leads us to infer that:
n 1;
generalized coordinates are bound by a kinematic point of view, but there is no restriction regarding access to the conguration space
C.
This implies that a mechanical system subject to non-holonolomic constraints can access all space even if its speed must belong to a subspace Take a set of equations of motion of the type:
n k.
4
aT i (q) q
i=1
j = 1, ..., p k
= span
In the case that the distribution is singular (det() the Frobenius theorem: this theorem, it is evident that if the distribution
= 0))
is called involutive.
According to From
C Rn
to the subspace
particular case of system completely holonomic. and constrains are said to be non-holonomic.
AT (q),
resented by the null-space (kernel) of the matrix, a distribution of linearly independent vectors:
= f (q) + G(q) u q
where the function
f (q)
RA=m =
which coincides locally with the accessibility matrix of a linear system. Globally, the accessibility may be reduced only by holonomic constraints. In fact system completely non-holonolomous has accessibility space which is equal to full conguration space.
4 Even if a constraint taken alone can be non-holonomic, a multiplicity of constraints can be completely integrable. 5 A very accurate description, with proof of this theorem is in the book: A. Isidori, Nonlinear Control Systems:
An Introduction, Chapter 1: Local Decomposition of Control Systems, 1985
Accessibility space
Compute the accessibility space for the following representative kinematic models after having re-obtained them from the original kinematic equations:
sin() cos() 0
Car like front driven (FD):
T 0 0 1
x y q=
v1F
v2
x y q=
T 0 0 0 1
v1R
v2
x y q=
Unicycle
The model of the wheel that will use is the following: In particular, it is:
vn=0
. vt=R
vt vn
model:
= R = 0
Taking the model of unicycle: Dened feed speed, you get one of the kinematic constraints of the
. y=v sin
/2
. x=v cos
x
Figure 2: Unicycle model and feed speed projections
= AT (q ) q
The kernel of the matrix
sin()
cos()
=0 q
AT ()
(there are dierent vector that one could choose to represent this kernel, we use one that is confortable for us, as we will see in the next exercise):
N (AT (q)) =
g1
g2
cos() = sin() 0
0 0 1
cos() x 0 y sin() 0 = v+ 0 1
The accessibility may be calculated using Lie algebra:
[g1 , g2 ]
= =
sin() 0 cos() 0 = 0 1
RA=2
and the determinant is:
0 sin() 0 cos() 1 0
3,
with a degree of
2.
yf
x
Figure 3: Car Like model
xf
Car Like
From the picture we can draw the following conclusions, applying the constraints of pure rolling exploited in the case of the unicycle to the wheels of this model:
x sin() y cos() = 0
constraint on the front wheel:
x f sin( + ) y f cos( + ) = 0
position of the front wheels, as rigid body constraint:
xf = x + l cos() yf = y + l sin()
that dierentiating becomes:
sin() x f = x l y f = y + l cos()
The location constraint dierentiated can be replaced in the equation of the front axle as follows:
x f sin( + ) y f cos( + ) = 0 (x l sin()) sin( + ) (y + l cos()) cos( + ) = 0 (sin() sin( + ) + cos() cos( + ) = 0 x sin( + ) y cos( + ) l
analyzing the trigonometric element in parentheses and exploiting the expansion of the sum between angles:
sin() cos() + cos() sin() cos() cos() sin() sin() sin() sin( + ) + cos() cos( + ) (cos2 () + sin2 ()) cos() + (sin() cos() sin() cos()) sin()
that will take us to a new constraint expression for the front wheels:
= = = =
At this point, the equations can be reported in the usual Pfaan form:
= AT (q) q
0 0
x y =0
AT 's null space will be of dimension n k = dim(q) rk(AT ) = 2 represented cos() cos() 0 sin() cos() 0 = sin()/l 0 0 1
N (AT ) =
g1
g2
= q x y =
where
0 0 0 1
u2
(1)
u2
u1
mobile robot and depends on the axis to which it is applied, front (FD) or rear (RD).
Car Like FD
In FD case:
u1 = v
and then the model is quite equal to that of equation 1:
0 0 = g1 v + g2 v+ 0 1
RA=3 =
where:
g1
g2
[g1 , g2 ]
[g1 , [g1 , g2 ]]
g1 g2 g1 g2 = [g1 , g2 ] = q q cos() cos() 0 0 sin() cos() 0 0 = [0] 0 0 sin( ) /l 0 0 0 cos( ) sin( ) sin() sin() = cos()/l 0
g1 [g1 , g2 ] g1 [g1 , g2 ] = [g1 , [g1 , g2 ]] = q q 0 0 sin() sin() cos() cos() cos() cos() 0 0 cos() cos() sin() sin() sin() cos() = 0 0 0 sin()/l sin()/l 0 0 0 0 0
0 0 sin() cos() cos() sin() cos() sin() 0 0 cos() cos() sin() cos() sin() sin() 0 0 0 cos()/l cos()/l 0 0 0 0 0 2 2 (sin ( ) + cos ( )) sin( ) /l sin( ) /l cos()/l (sin2 () + cos2 ()) cos()/l = = 0 0 0 0
Is obtained:
RA=3
cos() cos() 0 cos() sin() sin()/l sin() cos() 0 sin() sin() cos()/l = sin()/l 0 cos()/l 0 0 1 0 0 det(RA ) = 1 =0 l2 3.
Car Like RD
In RD case:
u1 =
and the model in state space becomes:
v cos()
0 0 = g1 v + g2 v+ 0 1
0 0 = 2 1 / ( l cos ()) 0
[g1 , g2 ] g1 g1 [g1 , g2 ] = [g1 , [g1 , g2 ]] = q q 0 0 0 0 cos() 0 0 0 0 sin() 0 0 0 2 tan()/ cos2 () tan()/l + 0 0 0 0 0 0 sin() 0 0 0 0 cos() 0 0 2 0 0 0 1/(l cos2 ()) 1 / ( l cos ()) 0 0 0 0 0
the matrix:
sin()/(l cos2 ()) cos()/(l cos2 ()) = 0 0 sin()/(l cos2 ()) cos()/(l cos2 ()) 0 0
RA=3
0 0 0 1/(l 1
0 0 cos2 ()) 0
det(RA=3 ) =
1 =0 l cos3 ()
for
non-holonomicity
+ k 2
k N7 . equal to 3.
for
Matlab Project
Assume the unicycle kinematic model with dierential drive (no uncertainties about the mechanical system size), and a suciently smooth path adopting the chained-form trajectory planning method powered by constant inputs. The coordinate change in chained-form have to be obtained via Lie algebra. Therefore, invert the equations and compute the kinematic model inputs for allowing the unicycle to follow the assigned path in the assigned time interval (normalize/rescale/parametrize the time-law between 0 and 1). Moreover, dene an output function for this MIMO nonholonomic system and motivate the choice. Then, apply the linearizing feedback (in the new coordinates). Compute the linearizing feedback via Lie algebra from the new coordinates where
only for didactic purposes, rewrite it in the old set of generalized coordinates Finally model a perturbation (time-limited and not constant).
For compensating the trajectory space-time oset apply a control (trajectory tracker) and choose the inputs required for obtaining zero dynamic in order to reduce the quantity:
e = yd (t) y(t)
Explain why, in this case, the strictly normal form for the generalized coordinate change does not exist in the set of possible solutions (be concise: one short sentence, now you already should have the answer...).
Theoretic approach
There are two main theoretic approach that we will use to control our system:
The model of dierential unicycle is simplied by transforming the angular velocities of the two wheels in speed and angular velocity of the system:
r l
Feedback linearization
8
Theroy of exact feedback linearization is quite complex and requires In this work, is supposed that the reader already know this
nonlinear control theory . The problem is to identify an output function dene a coordinate transformation from this typical nonlinear system:
h(x)
that allows us to
x y
7 Condition 8 Refer
that appears to be always satised, since the steering angle turns out to be always:
to: A. Isidori, M.D. di Benedetto Feedback linearization of nonlinear systems and Non linear Zero
dynamics in chapter 57. Design Methods of AA.VV. The control handbook, 1996, CRC Press IEEE
z i z r zj
= zi+1 = v = q (z)
i = 1, ..., r 1 j = r + 1, ..., n
y = z1
that is linear in the controllable part (identied by the rst refer to the the form:
relative degree of the system. This subsystem is called also chained form). The trasformation is a dieomorphism that must be dened at least locally and a control action in
h(x) Lf h(x)
. . .
component of
z,
where also
= (x) =
+ v)
u =
There exists a function are satised:
h(x)
that allows to dene this map, if and only if the following conditions
has rank
n;
is involutive.
Now we expand this notion from SISO system to a MIMO system. For a we dene a new type of generalized vector's dimension:
(2 input, n output)-system
with
(1)k
. . .
@ position k + 2
k = n 1. There are some conditions to prove the existence (2 input, 3 output)-system, like our unicycle; from our system: = g1 (q) u1 + g2 (q) u2 q
of a output function
0 1 2
= = =
if
ential
and
{1 , 2 }
h1 (q)
whose dier-
dh1 1, i dh1 g1
for which the system could transformed in:
= =
0 1
i = {1, 2}
z1 z2 z3
where
= h1 = Lg1 h2 = h2 h1 (q)
and such that:
h2 (q)
h2 2 = 0
And the input transformation is:
v1 v2
= u1 = L2 g1 h2 u1 + Lg2 Lg1 h2 u2
Now we are ready to apply this input transformation to the unicycle model:
cos() 0 x y = 0 + sin() v 0 1
now we make all computations to create the three distributions
{0 , 1 , 2 }:
adg1 g2
2
where:
0 cos() sin() 0 sin() cos() = span 1 0 0 cos() sin() sin() cos() = span 0 0 cos() sin() = span 0
0 dim(0 ) : det 0 1
that conrm also that
{1 , 2 } are involutive.
h1 (q) =
dh1 =
the system:
True
True
True
h1
are respected. As
h2 (q)
dh2 2
= =
Because all conditions are respected, those functions could be used for a transformation, after a Lie derivative:
Lg1 h2
= =
= x cos() + y sin()
and the trasformation:
the input tasformation is based upon Lie derivatives of the second order:
L2 g1 h2 =
(Lg1 h2 ) g1 = q
cos()
(Lg1 h2 )g2 = q
cos()
v1 v2
we dene also the inverse trasformation, for both states and inputs:
cos() +
y
v sin( )
= v + (y cos() x sin()) = = v + z3 = = v2 dz3 dt = x sin() + x cos() y cos() + y sin() = = (x sin() y cos()) + (x cos() + y sin()) =
=0 (constraint)
= z2 = = z2 v1
summing up the new model is:
z 1 z 2 z 3
We have chosen those two functions
= v1 = v2 = z2 v1
because they linearize the system with a new set of
{h1 , h2 },
z1 z2 z3
represents angle
represents direction parallel to sagittal axis of the unicycle; represents direction orthogonal to
z2 .
In the next section is shown how to control a simple cubic path, that is sucently smooth to respect nonholonomic constraints, with an external linear error compensation:
x = ax t3 + bx t2 + cx t y = ay t3 + by t2 + cy t = atan2(y, x )
but we have to said that it is really dicult to nd in litterature trajectory follow problem with this kind of decomposition because of the stiness that could be introduced during trajectory planning, that is also why in this model there is no external error simulation. In fact, this control loop is used mainly in posture regulation, in combination with a polar input, due to the fact that be considered as a radius, and litterature.
z2
could
z1
as an orientation.
robust due to a redenition of the output, and in fact is the one that we nd as the more used in
Input/output linearization
If we use
the model of unicycle, choosing as output a slightly dierent point from the center of the axle shaft, in such a way as to obtain the complete observability:
x y = y1 y2 =
cos() sin() 0
v =
= [g1 g2 ] u h1 h2
x + b cos() y + b sin()
h1 g1 = Lg1 h1 = q h1 g2 = q h2 g1 = q h2 g2 = q
Lg2 h1 =
Lg1 h2 =
Lg2 h2 =
cos() b sin() sin() = cos() 0 0 b sin() 0 = b sin() 1 cos() b cos() sin() = sin() 0 0 b cos() 0 = b cos() 1 A(q) = cos() b sin() sin() b sin()
(det(A)
= b > 0)
A1 (q) =
from which we can evaluate:
cos() sin()/b
sin() cos()/b
u v
z1 z2 = z3 y1 y2 =
to which to apply the error of the trajectory, drawn as a at output. For the trajectory
t [0, 1]
e = yd y
At this point, it can be concluded by exploiting the zero dynamics as linear control law:
v=
where e
z 1d k1 (z1d z1 ) z 2d k2 (z2d z2 )
exponentially stable for
k1 , k2 are two control parameters. Non linear control result k2 > 0. The anti-transformation is x z1 b cos() y z2 b sin() = z3
k1 > 0
r l
1/r 1/r
d d
v1 v2
Here are some results of the simulation and implementation of the Matlab/Simulink model. Both model are based upon the concept of at output, that derives directly from the zerodynamics .
Simulink models
with respect to
Feedback linearization
The results of simulation can be seen in the next few images. As already said, the system converge
z1 ,
that represents orientation, and tends to mantain a costant error (if we not
consider derive due to integration) in position. The control scheme could be improved using a PI controller, instead the only P used. However, the control action is to be contained.
y [m]
Figure 4: Trajectory
9 Refer
to: A. Isidori, M.D. di Benedetto Feedback linearization of nonlinear systems and Non linear Zero
dynamics in chapter 57. Design Methods of AA.VV. The control handbook, 1996, CRC Press IEEE
Error 1
0.5
0 error 0.5 1
eZ1 e e
Z2 Z3
1.5
4 time [s]
10
Figure 5: Errors
[v1 , v2 ]
This is the complete Symulink Model and the startup script. For blocks implementation, see the compressed le that can be downloaded from here.
1
% % Simulation for a unicycle % The system is linearized with a feedback linerization , and thus obtains % the form : %
% $$ \ dot { z_ {1}} = v_ {1} $$ % % $$ \ dot { z_ {2}} = v_ {2} $$ % % $$ \ dot { z_ {3}} = v_ {1} z_ {2} $$ clear all ; close all ; clc ; %% % Initial conditions X0 = 1; Y0 = 1; TH0 = pi /4;
11
16
21
%% % Controller Gain . It is a $$2 \ times3 $$ matrix . $$dim ( e ) = 3 $$ and we % have a correction of dimension $$2 $$ Gain = [ 10 0 0; 0 10 10];
26
% % Simulation % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if 1 == 1 sim ( ' Model ') ; end % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Results figure ( ' color ' , 'w ') % Desired trajectory plot ( Trajectory (: ,1) , Trajectory (: ,2) , 'g - - ') , hold on , ... % Robot motion plot ( Results (: ,1) , Results (: ,2) , 'r ') , hold on , ... legend ( ' trajectory desired ' , ' trajectory followed ' , ' Location ' , ' SouthEast ') , ... % Robot model for i =1:150: size ( Results ,1) DrawUnicycle ( Results (i ,1) , Results (i ,2) , Results (i ,3) ) , ... hold on , ... end grid on , ... xlabel ( 'x [ m ] ') , ylabel ( 'y [ m ] ') , ... title ( ' Unicycle model ') figure ( ' color ' , 'w ') % Error on z1 plot ( time , Error (: ,1) , 'r ') , hold on , ... % Error on z2 plot ( time , Error (: ,2) , 'g ') , hold on ... % Error on z3 plot ( time , Error (: ,3) , 'b ') , ... grid on , xlabel ( ' time [ s ] ') , ylabel ( ' error ') , ... legend ( ' e_ { Z1 } ' , ' e_ { Z2 } ' , ' e_ { Z3 } ' ,' Location ' , ' SouthEast ') , ... title ( ' Error ')
31
36
41
46
51
56
61
66
71
figure ( ' color ' , 'w ') % Control Action V1 plot ( time , ControlAction (: ,1) , 'r ') , hold on , ... % Control Action V2 plot ( time , ControlAction (: ,2) , 'b ') , ... grid on , xlabel ( ' time [ s ] ') , ylabel ( ' Control Action ') , ... legend ( ' V_ {1} ' , ' V_ {2} ' , ' Location ' ,' SouthEast ') , ... title ( ' Control Action ') %% % Trajectory function , contained in symulink model % % % % % % % % % % % % % % % % function [X , Y , Xdot , Ydot , TH ] = trajectory ( t ) %# codegen A = 0.003; B = 0.05; C = 0.2; D = 0.001; E = 0.07; F = 0.8; X = A * t ^3 + B * t ^2 + C * t ; Y = D * t ^3 + E * t ^2 + F * t ; Xdot = 3* A * t ^2 + 2* B* t + C ; Ydot = 3* D * t ^2 + 2* E* t + F ; TH = atan2 ( Ydot , Xdot ) ;
76
81
86
91
Input/output linearization
The results of this simulation are, as aspected, much better, due to the dention of the chain system. The main dierence with respect to the previous model can be seen in the fast convergence of the error, characteristic that make this model the most used in trajectory following problems. We can see in
e1 vs e2
plot, that even with an external error source (5 rand([1, ..., 1],
= 0, 2 = 1)),
the system could mantain the error very limited to an ellipsys with very small radius. The control action is provided as wheels rotational speed, it is quite contained but is evident the eect of random white noise.
0 y [m] 1 2 3 4 4
0 x [m]
Figure 7: Trajectory
Error 0.05 0 0.05 0.1 0.15 error [m] 0.2 0.25 0.3 0.35 0.4 0.45 0 2 4 time [s] 6 8 e [m]
x y
e [m] 10
Figure 8: Errrors
4 time [s]
Error 1 vs 2 0.05 0 0.05 0.1 0.15 eZ2 0.2 0.25 0.3 0.35 0.4 0.45 0.45 0.4 0.35 0.3 0.25 0.2 0.15 eZ1 0.1 0.05 0
Figure 10:
e1 vs e2
Position errors for system without random errors on input 0.05 0 0.05 0.1 0.15 error [m] 0.2 0.25 0.3 0.35 0.4 0.45 0 2 4 time [s] 6 8 eZ1 [m] eZ2 [m] 10
This is the complete Symulink Model and the startup script. For blocks implementation, see the compressed le that can be downloaded from here.
% % Simulation for a unicicle in input / output linearization % The system is linearized with a input output , and thus obtains % the form : %
% $$ \ dot { z_ {1}} = v_ {1} $$ % % $$ \ dot { z_ {2}} = v_ {2} $$ % % $$ \ dot { z_ {3}} = \ frac {1}{ b } ( v_ {2} cos ( z_ {3}) - v_ {1} sin ( z_ {3}) ) $$ clear all close all clc
10
15
20
25
%% % Model parameters
30
40
%% % Initial Condition x0 = 0.5; y0 = 0.5; th0 = pi /3; %% % Controller Gain k1 = 100; k2 = 100; % % Simulation %
45
50
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if 1 == 1 sim ( ' Unicycle3 ') ; end % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Results figure ( ' color ' , 'w ') % Desired trajectory plot ( Xd (: ,1) ,Xd (: ,2) , 'g -- ') , hold on , ... % Robot motion plot ( Qout (: ,1) , Qout (: ,2) , 'r ') , hold on , ... legend ( ' trajectory desired ' , ' trajectory followed ') , ... % Robot model for i =1:150: size ( Qout ,1)
55
60
65
70
end grid on , ... xlabel ( 'x [ m ] ') , ylabel ( 'y [ m ] ') , ... title ( ' Unicycle model ')
DrawUnicycle ( Qout (i ,1) , Qout (i ,2) , Qout (i ,3) ) , ... hold on , ...
75
80
figure ( ' color ' , 'w ') % Error on y1 plot ( time , error (: ,1) , 'r ') , hold on , ... % Error on y2 plot ( time , error (: ,2) , 'b ') , ... grid on , xlabel ( ' time [ s ] ') , ylabel ( ' error [ m ] ') , ... legend ( ' e_ { x } [ m ] ' , ' e_ {y } [ m ] ' , ' Location ' , ' SouthEast ') , ... title ( ' Error ') figure ( ' color ' , 'w ') % Control action plot ( time (100: end ,1) ,U (100: end ,1) , 'r ') , hold on , ... plot ( time (100: end ,1) ,U (100: end ,2) ) , ... grid on , ... xlim ([1 ,6.5]) , ... legend ( ' {\ omega } _ { r } ' , ' {\ omega } _ { l } ') , ... xlabel ( ' time [ s ] ') , ylabel ( ' Angular speed [ rad / s ] ') , ... title ( ' Differential drive control action ') figure ( ' color ' , 'w ') % Error action e1 on e2 plot ( error (: ,1) , error (: ,2) ) , ... grid on , ... xlabel ( ' e_ { Z1 } ') , ylabel ( ' e_ { Z2 } ') , ... title ( ' Error 1 vs 2 ') figure ( ' color ' , 'w ') % Error on y1 plot ( time , error_2 (: ,1) , 'r ') , hold on , ... % Error on y2 plot ( time , error_2 (: ,2) , 'b ') , ... grid on , xlabel ( ' time [ s ] ') , ylabel ( ' error [ m ] ') , ... legend ( ' e_ { Z1 } [ m ] ' , ' e_ { Z2 } [ m ] ' , ' Location ' , ' SouthEast ') , ... title ( ' Position errors for system without random errors on input ') % This document could be published with Matlab publishing function
85
90
95
100
105
110