基于多级适应方法的无人机(UAV)在发动机输出情况下的导航和路径规划(Matlab代码实现)

简介: 基于多级适应方法的无人机(UAV)在发动机输出情况下的导航和路径规划(Matlab代码实现)

💥1 概述

文献来源:

@article{gu2022multi,
  title={Multi-level Adaptation for Automatic Landing with Engine Failure under Turbulent Weather},
  author={Gu, Haotian and Jafarnejadsani, Hamidreza},
  journal={arXiv preprint arXiv:2209.04132},
  year={2022}
}


运行MASC示例

1.打开定义引擎输出纬度、经度和高度的程序。然后首先把飞机放到发动机坏掉的地方。然后单击右上角的停止按钮×平面窗口的角落。

2在故障位置配置块中设置发动机输出全局位置


3.在simulink框架中设置机场坐标

4.单击运行按钮,首先启动模拟模型。


📚2 运行结果

部分代码:

tic
e = zeros(1,8000);
c = zeros(1,8000);
aileron_e = zeros(1,8000);
psi_ref = zeros(1,8000);
gamma_ref = zeros(1,8000);
%% This function is for testing for converge to planned straight line
xb = 31018;
yb = -23100;
xf = 34018;
yf = -27100;
Rl = 1016; % R value can not be small otherwise, the path following result is not good
psif = 0;
xl         =   xf + 4 * Rl * cos(psif - pi);
yl         =   yf + 4 * Rl * sin(psif - pi);
xu = xl + Rl * cos(psif - pi);
yu = yl + Rl * sin(psif - pi);
%Ru         =   sqrt((xl + Rl * cos(psif - pi) - xi)^2 + (yl + Rl * sin(psif - pi) - yi)^2);
%thetau     =   atan2( yi - yl - Rl * sin(psif - pi), xi - xl - Rl * cos(psif - pi));
%%
r = Rl; %radius of loiter curve
O = [xl yl]; %center of loiter or circular orbit
g = 9.81;%gravitational acceleration
%p = [curr_x curr_y];
p = [96900/3.2808 -84870/3.2808]; %UAV start position
psi = 4; %start heading
delta = 0.3; %look ahead position
%^^^^^^^^^^^^^^^^definition of controller parameters^^^^^^^^^^^^^^^^^^^^^^^
k_p=0.8;    %proportional gain
k_i=0.01;   %integral gain
k_d=1;      %derivative gain
%^^^^^^^^^^^^^^^^^^Specification of time step^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dt=0.1  % this is a time unit which shoud match simulator x-plane
U_0=400; %initial UAV speed
U_d=435.9;%desired UAV speed
theta = atan2((p(2)-O(2)),(p(1)-O(1)));%Calculation of LOS angle
%^^^^^^^^^^^^^^^^^^^^^^^Definition of the look ahead point^^^^^^^^^^^^^^^^^
x_i = ((r*(cos(theta+delta)))+O(1));
y_i = ((r*(sin(theta+delta)))+O(2));
psi_d = atan2((y_i-p(2)),(x_i-p(1))); %commanded heading angle
u = (psi_d-psi); %controller input for changing heading angle
%^^^^^^^^^^^^^^^^^^^^^^^^^^^Motion of UAV^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
x_d=U_0*(cos(psi_d))*dt;
y_d=U_0*(sin(psi_d))*dt;
%^^^^^^^^^^^^^^^estimation of heading angle and position^^^^^^^^^^^^^^^^^^^
P_new = [(p(1)+x_d),(p(2)+y_d)];
psi_new = (psi+u);
%^^^^^^^^^^^^^^^^^^^^^over time positioning and heading of UAV^^^^^^^^^^^^^
X=[p(1)];
Y=[p(2)];
S=511; %area of  UAV wing
rho=0.3045; %density of air
b=59.64; %span of wing
mass = 333400  %mass of UAV 
I_xx=0.247e8; %inertial moment
L_p=-1.076e7; %rolling moment
Cl_da=0.668e-2;  %roll moment due to aileron deflection coefficient
Q_dS=1/2*rho*U_0^2*S; %dynamic pressure
L_da=Q_dS*b*Cl_da; %roll moment due to aileron
%^^^^^^^^^^^^^^^^^^^^^^^^^initialising controller^^^^^^^^^^^^^^^^^^^^^^^^^^
roll_ref=0; %initial UAV roll position
rollrate_ref=0; %initial UAV rollrate
t_ei=0; %thrust PI integrator
ei=0; %aileron PID integrator
%^^^^^^^^^^^^^^^^^^^estimation of stability derivatives^^^^^^^^^^^^^^^^^^^^
a=L_p/I_xx;
beta=L_da/I_xx;
roll_d=atan(u*U_0/g); %desired roll calculation
if abs(roll_d) > 1.5;
   if roll_d < 0;
      roll_d = -1.5;
   else if roll_d>0;
      roll_d = 1.5;
       end
   end
end
rollrate_d=roll_d*dt; %desired rollrate
aileron = k_p*(roll_d-roll_ref)+(k_i*ei)+k_d*(rollrate_d-rollrate_ref);
%deflection of aileron
rollrate_new = (((a*rollrate_ref)+(beta*aileron))*dt); %new roll rate output
roll_new = (rollrate_new/dt)+roll_ref; %new roll output
roll_old=roll_ref; %initialising old roll for feedback
rollrate_old=rollrate_ref; %initiallising old rollrate for feedback
%^^^^^^^^^^^^^^^^^^^^^^^^^control of thurst^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
t_ei=t_ei+(U_d-U_0)*dt;
thrust=k_p*(U_d-U_0)+(k_i*t_ei);
V_new=U_0+(thrust*dt);
V_old=V_new;
count = 0
while count<1000
Ru = abs ((((P_new(1) - O(1))^2) + ((P_new(2) - O(2))^2)) ^(1/2)-r);
%Calculation of UAV distance from center
theta_new = atan2((P_new(2)-O(2)),(P_new(1)-O(1))); %new path angle calculation
x_i = ((r*(cos(theta_new+delta)))+O(1));
y_i = ((r*(sin(theta_new+delta)))+O(2));
psi_d = atan2((y_i-P_new(2)),(x_i-P_new(1)));%calculation of desired heading angle
u = wrapToPi(psi_d-psi_new); %controller input for changing heading angle
ei=ei+((roll_d-roll_old)*dt); %updating the integrator
roll_d=atan(u*V_old/g); %desired roll calculation
if abs(roll_d) > 1.5; %limit of roll
    if roll_d < 0;
       roll_d = -1.5;
    else if roll_d>0;
       roll_d = 1.5;
        end
    end
end
rollrate_d=(roll_d-roll_old)*dt; %calculation of desired rollrate
aileron = (k_p*(roll_d-roll_old)+(k_i*ei)+(k_d*(rollrate_d-rollrate_old))); %calculation of deflection of aileron
rollrate_new = (((a*rollrate_old)+(beta*aileron))*dt); %new rollrate calculation
roll_new = (rollrate_new/dt)+roll_old; %new roll angle calculation
rollrate_old=rollrate_new; %rollrate as feedback
roll_old=roll_new; %roll angle as feedback
psi_old = psi_new; %UAV heading as feedback
psi_b=g/V_old*(tan(roll_new));
%due to new roll change in heading
psi_new = wrapToPi(psi_new+psi_b); %calculation of new heading angle
gamma_new = -15*pi/180;
Q_dS=1/2*rho*V_old^2*S; %calculation of dynamic pressure
L_da=Q_dS*b*Cl_da;
%due to aileron calculation of roll moment
beta=L_da/I_xx;
a=L_p/I_xx;
%^^^^^^^^^^^^^^^^^^^^^Calculation of UAV movements^^^^^^^^^^^^^^^^^^^^^^^^^
x_d=V_old*(cos(psi_new))*dt;
y_d=V_old*(sin(psi_new))*dt;
P_new = [(P_new(1)+x_d) (P_new(2)+y_d)];
%^^^^^^^^^^^^^^^^^^^^^^^^^contorl of thrust^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
t_ei=t_ei+(U_d-V_old)*dt;
thrust=k_p*(U_d-V_old)+(k_i*t_ei);
V_new=V_old+(thrust*dt);
V_old=V_new;
figure(1)
Y=[ Y P_new(2)];
X=[ X P_new(1)];
plot(X,Y)
hold on
Q = 0 : 0.01 : 2*pi;
W_c = (r * (cos(Q)))+O(1);
A_c = (r * (sin(Q)))+O(2);
plot(W_c,A_c,':')
xlim([xl-2*Rl xl+2*Rl])
ylim([yl-2*Rl yl+2*Rl])
xlabel('x-direction in ft')
ylabel('y-direction in ft')
title('Followed path using carrot chasing algorithm')
drawnow
count = count+1
hold on
for j = count;
%array of measurements
d = (abs(((O(1)-P_new(1))^2)+((O(2)-P_new(2))^2))^(1/2)) ;
e(1,j) = u;
c(1,j) = Ru;
aileron_e(1,j) = aileron;
if psi_d >=0
    psi_ref(1,j) = psi_d;
elseif psi_new < 0
    psi_ref(1,j) = psi_d+2*pi;
end
%psi_ref(1,j) = psi_new;
DesiredHeading = psi_ref(1,j);
disp(DesiredHeading)
gamma_ref(1,j) = gamma_new;
DesiredFlightPath = gamma_ref(1,j);
disp(DesiredFlightPath)
end
hold off
end
toc
%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^measurment plots^^^^^^^^^^^^^^^^^^^^^^^^^^^^
figure(2)
f = [1:1:count];
plot(f,e)
xlabel('time in (sec/100)')
ylabel('Change in heading in radian')
title('Variation in controller effort with time')
figure(3)
plot(f,c)
xlabel('time in (sec/100)')
ylabel('cross track deviation(ft)')
title('Variation of cross track deviation with time')
figure(4)
plot(f,aileron_e)
xlabel('time in (sec/100)')
ylabel('Deflection of aileron in radian')
title('Variation in aileron control with time')
figure(5)
plot(f,psi_ref)
xlabel('time in (sec/100)')
ylabel('heading new in radian')
title('Variation in controller effort with time')
figure(6)
plot(f,gamma_ref)
xlabel('time in (sec/100)')
ylabel('pitch angle in radian')
title('Variation in controller effort with time')
time=count*dt


🎉3 参考文献

部分理论来源于网络,如有侵权请联系删除。

@article{gu2022multi,
  title={Multi-level Adaptation for Automatic Landing with Engine Failure under Turbulent Weather},
  author={Gu, Haotian and Jafarnejadsani, Hamidreza},
  journal={arXiv preprint arXiv:2209.04132},
  year={2022}
}


🌈4 Matlab代码实现

相关文章
|
10月前
|
算法 数据安全/隐私保护 计算机视觉
基于二维CS-SCHT变换和LABS方法的水印嵌入和提取算法matlab仿真
该内容包括一个算法的运行展示和详细步骤,使用了MATLAB2022a。算法涉及水印嵌入和提取,利用LAB色彩空间可能用于隐藏水印。水印通过二维CS-SCHT变换、低频系数处理和特定解码策略来提取。代码段展示了水印置乱、图像处理(如噪声、旋转、剪切等攻击)以及水印的逆置乱和提取过程。最后,计算并保存了比特率,用于评估水印的稳健性。
|
2月前
|
算法 Serverless
基于魏格纳函数和焦散线方法的自加速光束matlab模拟与仿真
本项目基于魏格纳函数和焦散线方法,使用MATLAB 2022A模拟自加速光束。通过魏格纳函数法生成多种自加速光束,并设计相应方法,展示仿真结果。核心程序包括相位和幅度的计算、光场分布及拟合分析,实现对光束传播特性的精确控制。应用领域涵盖光学成像、光操控和光束聚焦等。 关键步骤: 1. 利用魏格纳函数计算光场分布。 2. 模拟并展示自加速光束的相位和幅度图像。 3. 通过拟合分析,验证光束加速特性。 该算法原理基于魏格纳函数描述光场分布,结合数值模拟技术,实现对光束形状和传播特性的精确控制。通过调整光束相位分布,可改变其传播特性,如聚焦或加速。
|
4月前
|
机器学习/深度学习 存储 算法
基于Actor-Critic(A2C)强化学习的四旋翼无人机飞行控制系统matlab仿真
基于Actor-Critic强化学习的四旋翼无人机飞行控制系统,通过构建策略网络和价值网络学习最优控制策略。MATLAB 2022a仿真结果显示,该方法在复杂环境中表现出色。核心代码包括加载训练好的模型、设置仿真参数、运行仿真并绘制结果图表。仿真操作步骤可参考配套视频。
207 0
|
6月前
|
算法
基于ACO蚁群优化的UAV最优巡检路线规划算法matlab仿真
该程序基于蚁群优化算法(ACO)为无人机(UAV)规划最优巡检路线,将无人机视作“蚂蚁”,巡检点作为“食物源”,目标是最小化总距离、能耗或时间。使用MATLAB 2022a版本实现,通过迭代更新信息素浓度来优化路径。算法包括初始化信息素矩阵、蚂蚁移动与信息素更新,并在满足终止条件前不断迭代,最终输出最短路径及其长度。
|
7月前
|
存储 算法 Serverless
【matlab】matlab基于DTW和HMM方法数字语音识别系统(源码+音频文件+GUI界面)【独一无二】
【matlab】matlab基于DTW和HMM方法数字语音识别系统(源码+音频文件+GUI界面)【独一无二】
115 4
|
7月前
|
计算机视觉
【图像处理】基于灰度矩的亚像素边缘检测方法理论及MATLAB实现
基于灰度矩的亚像素边缘检测方法,包括理论基础和MATLAB实现,通过计算图像的灰度矩来精确定位边缘位置,并提供了详细的MATLAB代码和实验结果图。
194 6
|
8月前
|
算法
基于kalman滤波的UAV三维轨迹跟踪算法matlab仿真
本文介绍了一种使用卡尔曼滤波(Kalman Filter)对无人飞行器(UAV)在三维空间中的运动轨迹进行预测和估计的方法。该方法通过状态预测和观测更新两个关键步骤,实时估计UAV的位置和速度,进而生成三维轨迹。在MATLAB 2022a环境下验证了算法的有效性(参见附图)。核心程序实现了状态估计和误差协方差矩阵的更新,并通过调整参数优化滤波效果。该算法有助于提高轨迹跟踪精度和稳定性,适用于多种应用场景,例如航拍和物流运输等领域。
591 12
|
7月前
|
算法 数据安全/隐私保护
基于星座图整形方法的QAM调制解调系统MATLAB误码率仿真,对比16,32,64,256四种QAM调制方式
本MATLAB 2022a仿真展示了不同QAM阶数下的星座图及误码率性能,通过星座图整形技术优化了系统性能。该技术利用非均匀分布的星座点提高功率效率,并通过合理布局增强抗干扰能力。随着QAM阶数增加,数据传输速率提升,但对信道质量要求也更高。核心程序实现了从比特生成到QAM映射、功率归一化、加噪及解调的全过程,并评估了系统误码率。
161 0
|
8月前
|
算法 vr&ar
基于自适应波束成形算法的matlab性能仿真,对比SG和RLS两种方法
```markdown - MATLAB2022a中比较SG与RLS自适应波束成形算法。核心程序实现阵列信号处理,强化期望信号,抑制干扰。RLS以其高效计算权重,而SG则以简单和低计算复杂度著称。[12345] [6666666666] [777777] ```
|
10月前
|
算法 数据安全/隐私保护 C++
基于二维CS-SCHT变换和扩频方法的彩色图像水印嵌入和提取算法matlab仿真
该内容是关于一个图像水印算法的描述。在MATLAB2022a中运行,算法包括水印的嵌入和提取。首先,RGB图像转换为YUV格式,然后水印通过特定规则嵌入到Y分量中,并经过Arnold置乱增强安全性。水印提取时,经过逆过程恢复,使用了二维CS-SCHT变换和噪声对比度(NC)计算来评估水印的鲁棒性。代码中展示了从RGB到YUV的转换、水印嵌入、JPEG压缩攻击模拟以及水印提取的步骤。