【无人机】应用 FLC 来改善四轴飞行器的轨迹跟踪,并将结果与 PID 控制器进行比较(Matlab代码实现)

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

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

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

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

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

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码、文章讲解


💥1 概述

文献来源:

该项目的主要愿景是结合一个使用模糊逻辑的智能系统来改进四轴飞行器模型的轨迹跟踪。四轴飞行器是一种复杂的模型系统,它使用四个旋翼来稳定和控制其运动。旋翼的不同速度是四轴飞行器轨迹变化的主要原因。

根据运动要求控制电机转速是一个非常复杂和困难的问题。四轴飞行器总共有6个自由度。其中三个是由于它们在空间中的位置(坐标)——x(水平)、y(垂直)和z(高度)轴,另外三个是由于它们沿着这些轴的方向(角度)——滚转、俯仰和偏航。

开发并实现了所建立的模糊模型,目的是利用智能控制策略控制其轨迹,提高其效率。系统的输入是参考x, y和z点以及偏航角。输出是状态空间矩阵,给出了所达到的坐标值和根据四轴飞行器的力学计算出的其他参数。该输出帮助我们计算误差,使用模糊逻辑控制器减少误差以改善其轨迹。

原文摘要:

The main vision regarding this project is to incorporate an intelligent system using Fuzzy  Logics to improve the trajectory tracking of a model of Quadcopter. A quadcopter is a  complex model system which uses four rotors to stabilize and control its motion. The different speeds of the rotors are the main reason for the trajectory of the quadcopter. 
The control of the motor speeds according to the requirement of motion is very complex  and difficult. A quadcopter has a total of 6 degree of freedoms. Three of which are due to 
their position (coordinates) in the space – x(horizontal), y (vertical) and z (height) axis and  the other three is due to their orientation (angle) along these axis – roll, pitch and yaw.  The fuzzy model created is developed and implemented with the purpose to control its  trajectory and improve its efficiency using intelligent control strategy. The inputs to the  system are the reference x, y and z points and the yaw angle. The outputs are the state  space matrix giving the values of the coordinates reached and the other parameters calculated according to the mechanics of the quadcopter. This output helps us to calculate the errors which are reduced using the Fuzzy Logic Controller to improve its  trajectory. 

📚2 运行结果

 

结果图较多,就不一一展示。

 部分代码:

function TC = calculate_TC(Seconds, Throttle, RPM)
% This function calculates the time constant from a step change in throttle
% input. This function should only be run on data taken from the STEP TEST
% function of the motor testing program; do not use it on data generated by
% other meanse  as the results will be COMPLETELY incorrect!
%
% Output is given in the form of returned TC value and plot.
%
% See also calculate_CR_B, calculate_CT.

ThrottleU = unique(Throttle); % get unique throttle values (There should only be two!)
lowThrottle = ThrottleU(1); % get Initial Throttle Setting
highThrottle = ThrottleU(2); % get Step High Throttle Setting
highStepSeconds = Seconds(Throttle==highThrottle); % Time at Step Throttle
highRPMs = RPM(Throttle==highThrottle); % RPMs at high Throttle
highThrottles = Throttle(Throttle==highThrottle); % Throttles at high throttle
stepTime = highStepSeconds(1); % Find time at which step high command is issued
lowStepSeconds1 = Seconds(Seconds<stepTime); % time before step occurs
lowRPMs1 = RPM(Seconds<stepTime); % RPM values recorded before step time
lowStepSeconds2 = Seconds(Seconds>max(highStepSeconds)); % RPM values recorded 
RPMhigh = mean(highRPMs(highStepSeconds>=stepTime+1 & highStepSeconds<=stepTime+3));
RPMlow = mean(lowRPMs1(lowStepSeconds1>=stepTime-2));
RPMatTC = (RPMhigh-RPMlow)*(1-exp(-1))+RPMlow;
% Find closest points to target and interpolate between these
ptsB = find(highRPMs <= RPMatTC,2,'last'); % 2 pts just below or on target (not necessarily consecutive)
ptsA = find(highRPMs > RPMatTC,2,'first'); % 2 pts just above target (not necessarily consecutive)
secB =  highStepSeconds(ptsB); % Time value corresponding to ptsB
secA = highStepSeconds(ptsA);  % Time value corresponding to ptsA
RPMPtB = mean(highRPMs(ptsB)); % average RPM value corresponding to ptsB
RPMPtA = mean(highRPMs(ptsA)); % average RPM value corresponding to ptsA
SecPtB = mean(secB);           % average RPM value corresponding to ptsA
SecPtA = mean(secA);
SecAtTC = interp1([RPMPtB RPMPtA],[SecPtB SecPtA],RPMatTC);
SecPts = [secB; secA];
RPMPts = [highRPMs(ptsB); highRPMs(ptsA)];

TC = SecAtTC-stepTime;
a = 1/TC;
% Time Constant Plot
figure
plot(highStepSeconds,highRPMs,'k');
xlabel('Time (s)','FontSize',12)
ylabel('RPM (rev/min)','FontSize',12)
title(['Step Response from ' num2str(lowThrottle) '% to ' ...
    num2str(highThrottle) '% Throttle'],'FontSize',14)
hold on
x1 = min(highStepSeconds);
x2 = min(highStepSeconds(highStepSeconds>=stepTime+0.6));
y1 = RPMlow;
y2 = max(highRPMs);
plot([x1 x2],[RPMhigh RPMhigh],'r')
plot([x1 x2],[RPMlow RPMlow],'c')
plot([x1 x2],[RPMatTC RPMatTC],'y')
plot([SecAtTC SecAtTC],[min(highRPMs),y2],'b')
xlim([x1 x2])
ylim([min(highRPMs) y2])
legend('RPM', ['High RPM = ' num2str(RPMhigh)], ['Low RPM = ' num2str(RPMlow)],...
    ['RPM at TC = ' num2str(RPMatTC)],['TC = ' num2str(TC) ' s'],'Location','SouthEast')
hold off
end

🎉3 参考文献

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

🌈4 Matlab代码、文章讲解

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

荔枝科研社

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值