Академический Документы
Профессиональный Документы
Культура Документы
Submitted for:
Franco Hidalgo Herencia
Submitted by:
Marta Larraaga Palacios
Paul Mendoza Yupanqui
Hugo Deudor Benavente
Jos Balbuena Galvn
Heser Len Reyes
San Miguel
May 22, 2016
20110113
20111271
20111683
20112077
20112270
I.
Introduction
Nowadays, there are a lot of applications where the mobile robots simplify our work
or keep us safe from some dangerous tasks. For example, mobile robots are used
for localizing mines and removing them or for inspections in places where a person
can go through like pipes. In all these activities mention before, there are many tasks
that mobile robots have to do. The most important is move efficiently in an
environment, in this project we are going to simulate the movement of a mobile robot
that is the first step in any kind of application where mobile robots are involved.
II.
Problem
The problem of this project is to create a complete navigation program that have as
input a robots pose (position and orientation). In order to achieve this objective we
have to create a kinematic model, a motion profile, a path algorithm and identify a
dynamic system.
III. Methodology
1. Kinematic Model
Model in Simulink the kinematic model of a mobile vehicle given v and w as inputs
and the pose (position and orientation) of the robot as output.
Where:
Ur: right wheel velocity
Ul: left wheel velocity
r: radius of Wheel
L: distance between wheels
v: linear velocity
w: angular velocity
Using the kinematic ecuations shown, we can obtain de model in simulink:
Subsystem consist of 4 inputs (r, L, v and w) and four outputs (x, y and theta)
Simulation:
1) r=5; L=13; v=2; w=0
Results show that the robot is moving streight and has no angular variation. This
result is correct because as input it was introduced w=0.
Figure 6. Simulation by w
0.
Results show that the robot is turning in circles and has angular variation. This
result is correct because as input it was introduced w 0.
2. System Identification
For this part of the project, the selected model is the same model used for the
PA1, the model is shown below in Figure 7.
To find the missing parameters, we used a grey-box model where the inputoutput information was given. The identification data is shown below in Figure 8.
First of all, we created an ODE-file, this type of file allow us to create a nonlinear
state-space model, and the code is shown below:
function [dx,y] = NonlinearMobile(~,x,u, p1, p2, p3, p4, p5, p6,
varargin)
% Output equation.
y = [x(1);
% linear velocity
x(2)];
% angular velocity,.
% State equations.
% X(1) = v , X(2) = w
dx = [p1*x(2)^2 + p2*x(1) + p3*(u(1)+u(2));
% Linear velocity
p4*x(1)*x(2) + p5*x(2) + p6*(u(2)-u(1)) ];
% Angular velocity
Then, we create a code where we load the data and process it to get linear and
angular velocity as output. These outputs are filtered using a moving average
filter and median filter; the first one smooth the curve and the second eliminate
all kind of peaks. The comparison between the data with filtered data is shown
below in Figure 9 and Figure 10.
Figure 9. Comparison between linear velocity data (left) and filtered data (right)
Figure 10. Comparison between angular velocity data (left) and filtered data (right)
The code used for this and also the creation of the data set (iddata) is shown
below:
clear all; close all; clc;
load E_R.mat;
load E_L.mat;
load PWM_R.mat;
load PWM_L.mat;
% -------------------- PART 1 -----------------------------% In this part we will prepare the data what was obtained from
the
% experiment (given by teacher)
sample_time = 0.03;
%Ticks/revolutions relation: 540 ticks = 1 rev
rel_T.R = 540;
%radius of the wheel (5cm)
r = 5/100;
%distance between wheels (13cm)
L = 13/100;
%time
t = E_L.time;
t = t';
%Data of the encoder R
Enco_R_Data = E_R.Data;
for i = 1:length(Enco_R_Data)-1
Enco_r(i) = (Enco_R_Data(i+1)-Enco_R_Data(i))/0.03;
end
Enco_r(750) = Enco_r(749);
%Conversion to rev
Rev_R = Enco_r/rel_T.R;
%Conversion to rad/s
vR = Rev_R*2*pi;
%Data of the encoder L
Enco_L_Data = E_L.Data;
for i = 1:length(Enco_L_Data)-1
Enco_l(i) = (Enco_L_Data(i+1)-Enco_L_Data(i))/0.03;
end
Enco_l(750) = Enco_l(749);
%Conversion to rev
Rev_L = Enco_l/rel_T.R;
%Conversion to rad/s
vL = Rev_L*2*pi;
Z = zeros(11,1);
%With the encoder data we find the v, w outputs values
v = r*(vR + vL)/2;
vf = medfilt1(v);
vf = [Z;vf];
vf = tsmovavg(vf,'s',12,1);
vf = vf(12:761);
v1 = vf';
w = r*(vR - vL)/L;
wf = medfilt1(w);
wf = [Z;wf];
wf = tsmovavg(wf,'s',12,1);
wf = wf(12:761);
w1 = wf';
%With the PWM lectures we have the inputs values
%Data of the
PWM_R_Data = PWM_R_ts.Data;
PWM_L_Data = PWM_L_ts.Data;
%We are gonna create a "iddata" with two inputs and two outputs
an ts =
%0.03, this is gonna help us to evaluate the model
data = iddata([vf,wf],[PWM_L_Data,PWM_R_Data],sample_time,
'Name','Mobile Dynamics');
data.InputName = {'% PWM Left Wheel','% PWM Right Wheel'};
data.InputUnit = {'%V', '%V'};
data.OutputName = {'Linear Velocity','Angular Velocity'};
data.OutputUnit = {'m/s','rad/s'};
data.Tstart = 0;
data.TimeUnit = 's';
%Plotting the data
figure; subplot(1,2,1);plot(v); title('Linear velocity');
subplot(1,2,2); plot(vf); title('Filtered Linear velocity');
figure; subplot(1,2,1);plot(w); title('Angular velocity');
subplot(1,2,2); plot(wf); title('Filtered angular velocity');
After, this we initialize the ODE-file, and run the program to estimate the value
of the missing parameters, the code and the results is shown below:
%----------------- PART 2 -------------------------------% Initializing the ODE model
FileName
= 'NonlinearMobile'; %File describing the model
structure.
Order
= [2 2 2];
% Model orders [ny nu nx].
Parameters
= [0;0;0;0;0;0]; %Initial random parameters.Np= 6.
InitialStates = [0;0];
% Initial initial states.
Ts
= 0.03;
% Time-continuous system.
nlgr = idnlgrey(FileName, Order, Parameters, InitialStates, Ts,
'Name', 'Mobile Robot');
set(nlgr, 'InputName', {'% PWM Left Wheel','% PWM Right Wheel'},
'InputUnit',{'%V', '%V'} , 'OutputName',{'Linear
Velocity','Angular Velocity'},'OutputUnit', {'m/s','rad/s'} ,
'TimeUnit', 's');
nlgr = setinit(nlgr, 'Name', {'Linear Velocity' 'Angular
Velocity'} );
nlgr = setinit(nlgr, 'Unit', {'m/s' 'rad/s'});
nlgr = setpar(nlgr, 'Name', {'p1' 'p2' 'p3' 'p4' 'p5' 'p6'});
nlgr = setpar(nlgr, 'Unit', {'m/rad' '1/s' 'm/V.s2' '1/s.m' '1/s'
'rad/V.s2'});
nlgr.Algorithm.SearchMethod = 'lsqnonlin';
nlgr.Algorithm.SimulationOptions.Solver = 'Auto';
nlgr.Algorithm.SimulationOptions.AbsTol = 1e-6;
nlgr.Algorithm.SimulationOptions.RelTol = 1e-5;
nlgr = setinit(nlgr, 'Fixed', {false false}); % Estimate the
initial state.
nlgr = pem(data, nlgr, 'Display', 'Full');
compare(data,nlgr)
present(nlgr)
Figure 11. Results of the system identification. Real data (grey) and simulated data (blue)
%aceleration time
%desaceleration time
%constang velocity time
*The complete code of pureputsuitfun function is in the attached file and the principal
script is Pathalgorithm.m
The red dot is the circle and the blue line is its orientation, the green dot is the
reach point
The next picture shows us the trajectory followed by the mobile robot using the Pure
Pursuit Algorithm
IV. Analysis
The Pure Pursuit Algorithm is an algorithm that gives the robot a trajectory that it can
follow (a curvature).
Inside the algorithm there must be considered the limitation of the mobile robot, like the
maximum steering angle.
V.
Conclusions
-