【无人机】多旋翼无人机横向飞行的轨迹优化(Matla代码实现)

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

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

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

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

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现


💥1 概述

一、引言

随着无人机技术的迅猛发展,多旋翼无人机以其灵活的操控性能、垂直起降能力和相对较低的成本,在航拍测绘、物流配送、环境监测、应急救援等众多领域得到了广泛应用。在实际任务执行中,多旋翼无人机常常需要进行横向飞行,其飞行轨迹的优化对于提升任务效率、降低能耗、保障飞行安全以及提高飞行质量等方面具有重要意义。因此,深入研究多旋翼无人机横向飞行的轨迹优化具有迫切的现实需求和广阔的应用前景。

二、多旋翼无人机横向飞行特点与挑战

多旋翼无人机在横向飞行时,其飞行特性与垂直起降和悬停状态有所不同。横向飞行过程中,无人机受到空气动力学、自身动力学特性以及外部环境因素的综合影响。空气阻力、风场干扰等会改变无人机的飞行姿态和速度,增加飞行控制的难度。同时,多旋翼无人机自身的结构特点和动力系统限制也对其横向飞行性能产生影响,如电机的功率限制、螺旋桨的转动惯量等。此外,在复杂环境中进行横向飞行时,还需要考虑障碍物的规避问题,以确保飞行安全。这些因素都给多旋翼无人机横向飞行的轨迹优化带来了诸多挑战。

三、轨迹优化的目标与意义

多旋翼无人机横向飞行轨迹优化的主要目标包括提高飞行效率、降低能耗、增强飞行稳定性和安全性等。通过合理规划飞行轨迹,可以使无人机在最短的时间内完成任务,减少飞行时间和能量消耗。同时,优化后的轨迹能够更好地适应外部环境变化,降低风场等因素对飞行的影响,提高飞行的稳定性和安全性。在一些特定任务中,如精准测绘和物流配送,精确的轨迹控制还可以提高任务执行的精度和质量。此外,轨迹优化对于延长无人机的续航时间、提高其工作效率以及拓展其应用领域都具有重要的推动作用。

四、常见的轨迹优化方法

(一)基于几何规划的方法 几何规划方法通过对无人机飞行空间进行几何建模,利用几何原理和算法来规划最优轨迹。例如,使用多边形、曲线等几何形状来描述无人机的飞行路径,通过优化几何参数来确定最佳轨迹。这种方法简单直观,计算效率较高,但对于复杂环境和动态变化的情况适应性较差。

(二)基于智能算法的方法 智能算法如遗传算法、粒子群优化算法、蚁群算法等在多旋翼无人机轨迹优化中得到了广泛应用。这些算法通过模拟自然界中的生物行为或进化过程,在搜索空间中寻找最优解。以遗传算法为例,它通过模拟生物进化中的选择、交叉和变异等操作,不断优化轨迹参数,以达到最优轨迹的目的。智能算法具有较强的全局搜索能力和适应性,能够处理复杂的约束条件和目标函数,但计算复杂度较高,收敛速度较慢。

(三)基于模型预测控制的方法 模型预测控制(MPC)方法是一种基于系统模型的控制策略,通过对系统未来状态的预测和优化,实时调整控制输入,以实现最优轨迹跟踪。在多旋翼无人机横向飞行轨迹优化中,MPC方法可以根据无人机的动力学模型和当前状态,预测未来一段时间内的飞行轨迹,并通过优化控制输入来使实际轨迹尽可能接近期望轨迹。该方法具有良好的实时性和鲁棒性,能够有效地处理系统的约束条件和外部干扰。

五、研究现状与发展趋势

目前,多旋翼无人机横向飞行轨迹优化的研究已经取得了一定的成果,但仍存在一些不足之处。一方面,现有的轨迹优化方法在处理复杂环境和动态变化的情况时,还需要进一步提高适应性和鲁棒性;另一方面,对于多无人机协同飞行的轨迹优化问题,研究还相对较少,需要进一步深入探索。未来,随着人工智能、机器学习、传感器技术等的不断发展,多旋翼无人机横向飞行轨迹优化将朝着更加智能化、自主化和协同化的方向发展。同时,结合虚拟现实、增强现实等技术,实现更加直观、高效的轨迹规划和控制,也将成为未来的研究热点之一。

六、结论

多旋翼无人机横向飞行的轨迹优化是无人机技术领域的重要研究内容,对于提升无人机的性能和应用能力具有关键作用。通过不断研究和改进轨迹优化方法,克服现有技术的不足,多旋翼无人机在横向飞行过程中能够实现更高的效率、更低的能耗、更好的稳定性和安全性。未来,随着相关技术的不断进步,多旋翼无人机横向飞行轨迹优化将在更多领域得到应用和发展,为社会带来更大的价值。

📚2 运行结果

主函数部分代码:


close all
clear all
clc

%% Rotational dynamics were considered in the trajectory optimization procedure (only used for video file naming purposes and zoomed out animation visualization)
rot_dyn = 0;    % 0: Dynamics do not consider rotational dynamics, 1: Dynamics consider rotational dynamics

%% Save animationn video option
saveAnimation = 0;  % 0: Do not save video file, 1: Save video file

%% Slow down option
slowDown = 0;
slow_factor = 5; % Slow down factor, play back speed is given by 1/slow_factor

%% Animation setup

if rot_dyn == 0
    load('Multicopter_horizontal_motion_and_flip.mat')
elseif rot_dyn == 1
    load('Multicopter_w_Rot_Dyn_horizontal_motion_and_flip.mat')
end

L = 0.2;                        % Multicopter arms length
fps = 60;                       % Frame per second
Tmax = ceil(max(tt)*fps)/fps;   % Obtain a multiple of the chosen fps as the maximum time

if rot_dyn == 0
    if slowDown == 0
        tt_Vid = 0:(1/fps):Tmax;
        name1 = "Multicopter_horizontal_motion_and_flip_zoomed";
        name2 = "Multicopter_horizontal_motion_and_flip";
    else
        tt_Vid = 0:(1/fps/slow_factor):Tmax;
        name1 = "Multicopter_horizontal_motion_and_flip_zoomed_slow";
        name2 = "Multicopter_horizontal_motion_and_flip_slow";
    end
elseif rot_dyn == 1
    if slowDown == 0
        tt_Vid = 0:(1/fps):Tmax;
        name1 = "Multicopter_w_Rot_Dyn_horizontal_motion_and_flip_zoomed";
        name2 = "Multicopter_w_Rot_Dyn_horizontal_motion_and_flip";
    else
        tt_Vid = 0:(1/fps/slow_factor):Tmax;
        name1 = "Multicopter_w_Rot_Dyn_horizontal_motion_and_flip_zoomed_slow";
        name2 = "Multicopter_w_Rot_Dyn_horizontal_motion_and_flip_slow";
    end
end

tt_Vid(end) = tt(end);
anim_steps = length(tt_Vid);
% Animation data is obtained by interpolating values from the obtained
% optimal trajectories at each time in the animation time vector
Xpos_Vid = interp1(tt,px,tt_Vid,'makima');
Zpos_Vid = interp1(tt,pz,tt_Vid,'makima');
theta_Vid = interp1(tt,theta,tt_Vid,'makima');

Xpos_Vid(end) = px(end);
Zpos_Vid(end) = pz(end);
theta_Vid(end) = theta(end);
theta_Vid = -theta_Vid;         % Adjusting for appropriate plotting

color_array = GetColorArray(tt_Vid,colormap('jet'));

% Setting up video saving parameters
if saveAnimation == 1
    v1 = VideoWriter(name1,'Motion JPEG AVI');
    v1.Quality = 100;
    v1.FrameRate = fps;
    open(v1);
    v2 = VideoWriter(name2,'Motion JPEG AVI');
    v2.Quality = 100;
    v2.FrameRate = fps;
    open(v2);
end

%% Animation of the multicopter trajectory zoomed in on the multicopter

figure(1)
set(gcf, 'color', [1 1 1])
set(gcf, 'position',[100,100,600,500])
ax = gca;
ax.FontSize = 17; 
set(gca,'TickLabelInterpreter','latex')

cc = colorbar("eastoutside",...
                'Ticks',[0 1],...
                'TickLabels',{'0', '$T$'}, ...          
                'Fontsize', 17, 'TickLabelInterpreter', 'latex');
    cc.Label.String = "$t$ (s)";
    cc.Label.Interpreter = 'latex';

grid on
box on
     
for kk = 1:anim_steps
    
    if (rem(kk-1,slow_factor)==0 || slowDown~=1)
        hold on
        plot([Xpos_Vid(kk)-L*cos(theta_Vid(kk)) Xpos_Vid(kk)+L*cos(theta_Vid(kk))], [Zpos_Vid(kk)-L*sin(theta_Vid(kk)) Zpos_Vid(kk)+L*sin(theta_Vid(kk))],'LineWidth',2,'Color',color_array(kk,:))
        plot([Xpos_Vid(kk)-L*cos(theta_Vid(kk)) Xpos_Vid(kk)-L*cos(theta_Vid(kk))-0.25*L*sin(theta_Vid(kk))], [Zpos_Vid(kk)-L*sin(theta_Vid(kk)) Zpos_Vid(kk)-L*sin(theta_Vid(kk))+0.25*L*cos(theta_Vid(kk))],'LineWidth',2,'Color',color_array(kk,:))
        plot([Xpos_Vid(kk)+L*cos(theta_Vid(kk)) Xpos_Vid(kk)+L*cos(theta_Vid(kk))-0.25*L*sin(theta_Vid(kk))], [Zpos_Vid(kk)+L*sin(theta_Vid(kk)) Zpos_Vid(kk)+L*sin(theta_Vid(kk))+0.25*L*cos(theta_Vid(kk))],'LineWidth',2,'Color',color_array(kk,:))
        if kk > 1
            plot(Xpos_Vid(1:kk), Zpos_Vid(1:kk),'LineWidth',2,'Color','k')
        end
        multicopterq1 = plot([Xpos_Vid(kk)-L*cos(theta_Vid(kk)) Xpos_Vid(kk)+L*cos(theta_Vid(kk))], [Zpos_Vid(kk)-L*sin(theta_Vid(kk)) Zpos_Vid(kk)+L*sin(theta_Vid(kk))],'LineWidth',2,'Color','k');
        multicopterq2 = plot([Xpos_Vid(kk)-L*cos(theta_Vid(kk)) Xpos_Vid(kk)-L*cos(theta_Vid(kk))-0.25*L*sin(theta_Vid(kk))], [Zpos_Vid(kk)-L*sin(theta_Vid(kk)) Zpos_Vid(kk)-L*sin(theta_Vid(kk))+0.25*L*cos(theta_Vid(kk))],'LineWidth',2,'Color','k');
        multicopterq3 = plot([Xpos_Vid(kk)+L*cos(theta_Vid(kk)) Xpos_Vid(kk)+L*cos(theta_Vid(kk))-0.25*L*sin(theta_Vid(kk))], [Zpos_Vid(kk)+L*sin(theta_Vid(kk)) Zpos_Vid(kk)+L*sin(theta_Vid(kk))+0.25*L*cos(theta_Vid(kk))],'LineWidth',2,'Color','k');
        hold off
    end

    xlim([-1+Xpos_Vid(kk) 1+Xpos_Vid(kk)])
    xlabel('$x$ (m)','Interpreter','latex','FontSize',17)
    
    ylim([-1+Zpos_Vid(kk) 1+Zpos_Vid(kk)])
    ylabel('$z$ (m)','Interpreter','latex','FontSize',17)
        
    rrTxt = sprintf('$t = %.2f$ s',tt_Vid(kk));
    rr = text(Xpos_Vid(kk)+0.4, Zpos_Vid(kk)+0.75, rrTxt, 'Interpreter', 'latex', 'FontSize', 17);

    set(gca,'position',[0.125,0.125,0.68,0.8])

    pause(1/fps)
    if saveAnimation == 1
        frame = getframe(gcf);
        writeVideo(v1,frame);
    end
    set(rr,'Visible','off')
    set(multicopterq1,'Visible','off')
    set(multicopterq2,'Visible','off')
    set(multicopterq3,'Visible','off')

🎉3 参考文献

文章中一些内容引自网络,会注明出处或引用为参考文献,难免有未尽之处,如有不妥,请随时联系删除。

[1]刘承相,熊俊杰,杨东平,等.四旋翼无人机飞行轨迹优化与控制研究[J/OL].计算机测量与控制,1-10[2025-03-16].http://kns.cnki.net/kcms/detail/11.4762.TP.20250116.1410.021.html.

[2]崔佳鹏,吴宇,苟进展.四轴八旋翼无人机入水轨迹优化方法研究[J].无人系统技术,2022,5(03):50-63.DOI:10.19942/j.issn.2096-5915.2022.3.027.

🌈4 Matlab代码实现

图片

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值