Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 2.86 KB

README.md

File metadata and controls

35 lines (23 loc) · 2.86 KB

Carrot Chasing Algorithm (CCA)

One of the simplest path-following algorithm is Carrot Chasing Algorithm (CCA). CCA exploits the virtual target (VTP) and make the UAV chase this VTP by updating the heading angle direction $\psi$

Sraight-line Following CCA

The carrot chasing algorithm (CCA) for straight line can be applied, even the path is a nonlinear curve, by simply discretizing the path into waypoints. After obtaining all the waypoints, CCA can be executed for each section of the path as shown in figure below.

image
CCA path following implementation scheme

The algorithm can be summarized below. This has been coded in the main while loop in CCA_Straight.m

image

while x(i+1) < Wf(1)
i = i + 1 ;
%--------------------CCA Path Following Algorithm---------------------
% Step 1
% Distance between initial waypoint and current UAV position, Ru
Ru = norm(Wi - p(:,i));
% Orientation of vector from initial waypoint to final waypoint, theta
theta = atan2(Wf(2) - Wi(2), Wf(1) - Wi(1));
% Step 2
% Orientation of vector from initial waypoint to current UAV position, thetau
theta_u = atan2(p(2,i) - Wi(2), p(1,i) - Wi(1));
% Difference between theta and theatu, DEL_theta
DEL_theta = theta - theta_u;
% Step 3
% Distance between initial waypoint and q, R
R = sqrt( Ru^2 - (Ru*sin(DEL_theta))^2 );
% Step 4
% Carrot position, s = ( xt, yt )
xt = Wi(1) + (R + delta) * cos(theta);
yt = Wi(2) + (R + delta) * sin(theta);
% Step 5
% Desired heading angle, psid
psi_d = atan2(yt - p(2,i), xt - p(1,i));
% Wrapping up psid
psi_d = rem(psi_d,2*pi);
if psi_d < -pi
psi_d = psi_d + 2*pi;
elseif psi_d > pi
psi_d = psi_d-2*pi;
end
% Step6
% Guidance command, u
u(i) = kappa*(psi_d - psi(i))*va;
% Limit u
if u(i) > umax
u(i) = umax;
elseif u(i) < -umax
u(i) = - umax;
end
%--------------------------------------------------------------------%

Result - CCA Straight-Line

image
CCA for straight-line path following with $\kappa = 0.75$ and various $\delta$

Tuning CCA

For CCA, the design parameters include the look-ahead distance $\delta$, and the gain $\kappa$. The closed loop trajectory directly depends on these parameters. The effect of each parameters have been plotted in figure below. In general, too small $\delta$ can give an overshoot and oscillation to the trajectory since the virtual target has been placed too close to the initial position. Larger $\delta$ can make the trajectory settle on the path quickly while reducing the cross-track error. However, too large $\delta$ may results in a slow convergence to the line. The value of $\delta$ should be carefully determined based on the distance of the path and the velocity of the vehicle. Although the gain $\kappa$ has little effect on the trajectory, smaller $\kappa$ can increase the stability of the trajectory and has less error to the desired path.

image image
The effect of different design parameters on the path following trajectory

References

[1] Bhadani, R. (2020). Path Planning of Unmanned System using Carrot-chasing Algorithm. arXiv preprint arXiv:2012.13227.

[2] X. Jin, W. Mei and Y. Zhaolong, "Path Following Control for Unmanned Aerial Vehicle Based on Carrot Chasing Algorithm and PLOS," 2020 IEEE International Conference on Artificial Intelligence and Information Systems (ICAIIS), Dalian, China, 2020, pp. 571-576, doi: 10.1109/ICAIIS49377.2020.9194843.