Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

% % Define the artificial potential field parameters % Points of attraction xa = 7 0 ; ya = 5 0 ; % Location of

%% Define the artificial potential field parameters % Points of attraction xa =70; ya =50; % Location of obstacles nobs =5; xo =[2030355065]; yo =[1325353845]; % Size of obstacles (rho_0) rho_0=[74534]; % Constants. Ka =1; Kv =20; Kr =[500350500250250]*1000; mass =5; %% Integration step. % initial conditions x0=5; y0=5; % Initialise simulation parameters x = x0; y = y0; vx =0; vy =0; terminate = false; t =0; dt =0.01; % Store variables for later assessment traj =[]; Fac =[]; Frc =[]; Fdc =[]; Fc =[]; while(~terminate)%% Check if reached destination rho = sqrt((xa-x)^2+(ya-y)^2); if(rho <0.1) terminate = true; end %%% Calculate the conservative forces % Attractive force (Fa) Fa = zeros(2,1); %------ INSERT YOUR CODE HERE ------ Fac =[Fac Fa]; % Repulsive force (Fr) Fr = zeros(2,1); %------ INSERT YOUR CODE HERE ------ Frc =[Frc Fr]; % Damping force (Fd) Fd = zeros(2,1); %------ INSERT YOUR CODE HERE ------ Fdc =[Fdc Fd]; % Total force (F)%------ INSERT YOUR CODE HERE ------ Fc =[Fc F]; % Velocity and Position (vx, vy, x, y) through integrating the equations %------ INSERT YOUR CODE HERE ------ traj =[traj [x;y]]; %plot the trajectory end %% Display the results % Plot the trajectory figure(1); % Now the attractive potential contour xmin =0; xmax =80; ymin =0; ymax =60; [X,Y]= meshgrid(xmin:5:xmax,ymin:5:ymax); Z =1.0*(0.5*Ka*sqrt((X-xa).^2+(Y-ya).^2)); Zmax = max(max(Z)); Z =10*Z/Zmax; contour(X,Y,Z,50);hold on; plot(traj(1,1),traj(2,1),'bo','LineWidth',6); plot(xa,ya,'bx','LineWidth',10); xlabel('x(m)'); ylabel('y(m)'); axis('equal'); % The obstacle contours for kk =1:nobs r =0:0.01:rho_0(kk); tht =0:0.1:2*pi+0.1; [THT,R]= meshgrid(tht,r); Z =0.5*Kr(kk)*((sqrt((R.*cos(THT)).^2+(R.*sin(THT)).^2))-(rho_0(kk))).^2; Zmax = max(max(Z)); Z =10*Z/Zmax; contour(xo(kk)+R.*cos(THT),yo(kk)+R.*sin(THT),Z,50); end % Draw the obstacle boundaries for jj =1:nobs tht =0:0.01:2*pi; xobs = xo(jj)+rho_0(jj)*cos(tht); yobs = yo(jj)+rho_0(jj)*sin(tht); plot(xobs,yobs,':r','LineWidth',2.0); end %% Finally, plot the trajectory plot(traj(1,:),traj(2,:),'g','LineWidth',2.0); hold off; axis equal; axis tight; Insert code in required space The task in term project 1 is to implement the artificial potential function path planning algorithm for the drone scenario shown in figure TP1. x 0504030201 Figure TP1: Drone path scenario.The obstacles in the path of the drone have the size, coordinates and repulsive gain given in table TP1 below, Kr Obstacle Position 1(20,13)2(30,25)3(35,35)4(50,385(65,45 Radius 74534.500000350000500000250000250000 Table TP1: Obstacle parameters. Furthermore, the initial drone position is (5,5) and the location of the desired target point is (70,50). Your task is to complete the code template provided and to show that a feasible path can be generated using the artificial potential function method. The drone equations of motion can be represented by a simple double-integrator model in 2 dimensions (x,y). Assume the vehicle has a mass of 5kg. The Potential functions should take the following form,Furthermore, the initial drone position is (5,5) and the location of the desired target point is (70,50). Your task is to complete the code template provided and to show that a feasible path can be generated using the artificial potential function method. The drone equations of motion can be represented by a simple double-integrator model in 2 dimensions (x,y). Assume the vehicle has a mass of 5kg. The Potential functions should take the following form, Attractive: Ua Kap? 0\rho >\Rho \omicron 2 Repulsive: U,= K, p < PO Pr Pol where Pa =(x xa)2+(y ya)2 and Por (x Xobs)2+(y Yobs). When developing the appropriate APF control law, you should also include an additional force proportional to the drone velocity as follows, Fx,=-K, Vx) F yy =-K, Vy Remember to use the variable names specified in the template code for each of the simulation terms. Failure to do so will result in failure of the Matlab Grader tests. Once your code have passed all of the MATLAB Grader tests, you MUST press SUBMIT for marking.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

=+What is the brand's character or personality?

Answered: 1 week ago