【无人机】基于遗传算法调整PID控制器增益研究【无人机(UAV)上使用的PID控制器】(Matlab代码实现)

 👨‍🎓个人主页:研学社的博客  

💥💥💞💞欢迎来到本博客❤️❤️💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码、Simulink仿真、文章详细讲解


💥1 概述

本文主要研究一种固定翼无人机俯仰姿态PID控制器增益的自整定解决方案。调整无人机系统的PID增益是一个困难和漫长的过程,如果做得不正确可能会有严重的后果。研究人员试图用许多不同的方法来解决这个问题,但没有确凿的证据。在这个项目中,无人机俯仰动力学建模为二阶传递函数。对于本研究的目的来说,这是一个足够的简化,因为主要目的是创建一个概念验证解决方案。文献综述的结论表明,分析调优方法,如Ziegler-Nichols,不适合用于无人机系统。因此,启发式技术领域得到了进一步的探索。本研究的主要输出是一个元启发式算法,能够调整PI控制器的增益。该算法是一种遗传算法的变体,具有额外的元素,具体到无人机系统,包括在内。控制器的调优基于用户定义的一组初始条件。自动调整算法不了解系统的动态,能够在95%以上的所有模拟中计算出满足用户定义标准的增益。此外,该算法获得的增益与Matlab内置PID整定函数对同一系统计算的理想增益相比,在55%的范围内。

这些结果突出了自动调整算法的通用性,但在将算法移植到自动驾驶仪之前,还需要进一步的工作。

原文摘要:

This study focuses on the development of an autotuning solution for the  gains of the pitch attitude PID controller of a fixed wing UAV. Tuning the PID  gains of a UAV system is a difficult and lengthy process, which if done incorrectly could have serious consequences. Researchers have attempted to tackle this problem from many different approaches but no conclusive evidence have been presented. In this project, the pitch dynamics of a UAV 
are modelled as a second order transfer function. This is a simplification that is sufficient for the purposes of this study, as the primary aim is to create a proof-of-concept solution. The conclusions of the literature review suggested that analytical tuning methods, like Ziegler-Nichols, are not appropriate for use in UAV systems. Consequently, the field of heuristic techniques was further explored. The main output of this study is a metaheuristic algorithm 
that is able to tune the gains of a PI controller. The algorithm is a variation of a Genetic Algorithm with additional elements, specific to UAV systems, included. The tuning of the controller is based on a set of initial criteria defined by the user. The autotuning algorithm, which has no knowledge of the system’s dynamics, was able to calculate gains that satisfied the user-defined criteria in more than 95% of all simulations. Furthermore, the gains obtained from the algorithm were within a 55% range of the ideal gains calculated from the Matlab built-in PID tuning function for the same system. Those results highlight the versatility of the autotuning algorithm, but further work is required before the algorithm can be ported to autopilots.     

📚2 运行结果

 

 

 

 

 

 

 

部分代码:

% Calculating the values of the nominator and denominator of the TF
a = b0*(natural_freq(i)^2);
b = 2*natural_freq(i)*damping_ratio(j);
c = natural_freq(i)^2;

k =1;

%Simulink model required
model = 'reference_tracking';
load_system(model)

max_prop_gain = 1;
max_int_gain = 1;
% kp_initial = rand*max_prop_gain;
% ki_initial = rand*max_int_gain;
 
kp_initial = 3;
ki_initial = 3;

%population creation
gains = [ kp_initial ki_initial;
    0.5*kp_initial ki_initial;
    kp_initial 0.5*ki_initial;
    0.5*kp_initial 0.5*ki_initial
    2*kp_initial 2*ki_initial];

disp(gains);
kp = kp_initial;
ki = ki_initial;

kp_p1 = num2str(kp);
ki_p2 = num2str(ki);
s_kp_p1 = strcat('Initial P Gain: ', kp_p1);
s_ki_p2  = strcat('Initial I Gain: ',ki_p2);
initial_gains = [s_kp_p1 char(10) s_ki_p2]; % textbox element


sim(model);
fig1 = figure;
plot(tout,simout.signals.values(:,1),tout,simout.signals.values(:,2));
xlabel('Time (s)');
ylabel('Amplitude');
title('');
legend('Reference Signal', 'Initial Response');
annotation('textbox',[0 0 1 1],'String',initial_gains,'Fontsize',13);

fig2 = figure;
hold on;

while true
    iter_counter = 1;
    sum(1:5) = 0;
    input(1:5) = 0;
  %  response(1:5) = 0;
    
    for i=1:size(gains,1)
        kp = gains(i,1);
        ki = gains(i,2);
        sim(model);
        input = simout.signals.values(:,1);
        response = simout.signals.values(:,2);
        plot(tout,input,tout,response);
        xlabel('Time (s)');
        ylabel('Amplitude');
        title('');

        % fitness function definition
        for j=1:size(response,1)
            sum(iter_counter) = sum(iter_counter) + abs(input(j)-response(j));
        end
        iter_counter = iter_counter + 1;
    end
    
    [sum_sorted,index] = sort(sum);
    sgra(k) = sum_sorted(1);
    kpgr(k) = gains(index(1),1);
    kigr(k) = gains(index(1),2);

    if sum_sorted(1)<= 5
        disp('System Tuned');
        kp = gains(index(1),1);
        ki = gains(index(1),2);
        %%%%
        kp_p1 = num2str(kp);
        ki_p2 = num2str(ki);
        s_kp_p1 = strcat('Final P Gain: ', kp_p1);
        s_ki_p2  = strcat('Final I Gain: ',ki_p2);
        final_gains = [s_kp_p1 char(10) s_ki_p2]; % textbox element
        %%%
        sim(model);
        fig3 = figure;
        plot(tout,simout.signals.values(:,1),tout,simout.signals.values(:,2));
        xlabel('Time (s)');
        ylabel('Amplitude');
        title('');
        legend('Reference Signal', 'Final Response');
        annotation('textbox',[0 0 1 1], 'String',final_gains,'Fontsize',13);
        

        disp(gains(index(1),1));
        disp(gains(index(1),2));
        break;
    end
    
    kp_new = gains(index(1),1);
    ki_new = gains(index(1),2);
    
    if k>2
        if last_kp == kp_new
            kp_new = (rand)*kp_new;
        end
        if last_ki == ki_new
            ki_new = (rand)*ki_new;
        end

🎉3 参考文献

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

[1]Aliyu, B. et al., 2015. Oscillation Analysis for Longitudinal Dynamics of a 
Fixed-Wing UAV Using PID Control Design. Advances in Research, 
5(3), pp.1–13. Available at: http://sciencedomain.org/abstract/9899. 
[2]Catena, A., Melita, C.D. & Muscato, G., 2013. Automatic Tuning Architecture 
for the Navigation Control Loops of Unmanned Aerial Vehicles. Journal 
of Intelligent & Robotic Systems, 73(1-4), pp.413–427. Available at: 
http://link.springer.com/10.1007/s10846-013-9919-2. 
[3]Cook, V.M., 2007. Flight Dynamics Principles 2nd ed., Elsevier Ltd. 
Fadil, M.A. et al., Iterative Learning Auto-tuned PID Controller for Micro-
Unmanned Air Vehicle. , (1), pp.153–160. 
[4]Fadil, M.A., Jalil, N.A. & Mat Darus, I.Z., 2013. Intelligent PID controller using 
iterative learning algorithm for active vibration controller of flexible beam. 
2013 IEEE Symposium on Computers & Informatics (ISCI), (4), pp.80–
85. Available at: http://www.scopus.com/inward/record.url?eid=2-s2.0-
84886468777&partnerID=tZOtx3y1. 

🌈4 Matlab代码、Simulink仿真、文章详细讲解

  • 31
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值