当前位置: 首页 > news >正文

基于PD控制器的四旋翼无人机群飞行控制系统simulink建模与仿真

目录

1.课题概述

2.系统仿真结果

3.核心程序

4.系统原理简介

5.参考文献

6.完整工程文件


1.课题概述

       使用simulink建模四旋翼无人机,然后结合MATLAB实现基于PD控制器的四旋翼无人机群飞行控制系统,仿真输出无人机的飞行模拟,无人机位置变化曲线,速度变化曲线,角度变化曲线等指标。

2.系统仿真结果

3.核心程序

matlab2024b


out = sim("tops.slx");func_plots(out, simkey, ['b'])load position1.mat
t1=ans.Time;
for i = 1:length(t1)posx1(i)=ans.Data(1,:,i);posy1(i)=ans.Data(2,:,i);posz1(i)=ans.Data(3,:,i);
end
load position2.mat
t2=ans.Time;
for i = 1:length(t2)posx2(i)=ans.Data(1,:,i);posy2(i)=ans.Data(2,:,i);posz2(i)=ans.Data(3,:,i);
end
load position3.mat
t3=ans.Time;
for i = 1:length(t1)posx3(i)=ans.Data(1,:,i);posy3(i)=ans.Data(2,:,i);posz3(i)=ans.Data(3,:,i);
endfigure;
subplot(321);
plot(t1,posx1,'LineWidth',2);
hold on
plot(t1,posy1,'LineWidth',2);
hold on
plot(t1,posz1,'LineWidth',2);
grid on
xlabel('time');
ylabel('position');
legend('X','Y','Z');
subplot(322);
plot3(posx1,posy1,posz1,'LineWidth',2);
grid on
xlabel('x');
ylabel('y');
zlabel('z');
title('无人机1')subplot(323);
plot(t2,posx2,'LineWidth',2);
hold on
plot(t2,posy2,'LineWidth',2);
hold on
plot(t2,posz2,'LineWidth',2);
grid on
xlabel('time');
ylabel('position');
legend('X','Y','Z');
subplot(324);
plot3(posx2,posy2,posz2,'LineWidth',2);
grid on
xlabel('x');
ylabel('y');
zlabel('z');
title('无人机2')subplot(325);
plot(t3,posx3,'LineWidth',2);
hold on
plot(t3,posy3,'LineWidth',2);
hold on
plot(t3,posz3,'LineWidth',2);
grid on
xlabel('time');
ylabel('position');
legend('X','Y','Z');
subplot(326);
plot3(posx3,posy3,posz3,'LineWidth',2);
grid on
xlabel('x');
ylabel('y');
zlabel('z');
title('无人机3')load body_velocity1.mat
t1=ans.Time;
for i = 1:length(t1)Vx1(i)=ans.Data(1,:,i);Vy1(i)=ans.Data(2,:,i);Vz1(i)=ans.Data(3,:,i);
end
load body_velocity2.mat
t2=ans.Time;
for i = 1:length(t2)Vx2(i)=ans.Data(1,:,i);Vy2(i)=ans.Data(2,:,i);Vz2(i)=ans.Data(3,:,i);
end
load body_velocity3.mat
t3=ans.Time;
for i = 1:length(t3)Vx3(i)=ans.Data(1,:,i);Vy3(i)=ans.Data(2,:,i);Vz3(i)=ans.Data(3,:,i);
endfigure;
subplot(131);
plot(t1,Vx1,'LineWidth',2);
hold on
plot(t1,Vy1,'LineWidth',2);
hold on
plot(t1,Vz1,'LineWidth',2);
grid on
xlabel('time');
ylabel('velocity');
legend('X','Y','Z');
title('无人机1')subplot(132);
plot(t1,Vx2,'LineWidth',2);
hold on
plot(t1,Vy2,'LineWidth',2);
hold on
plot(t1,Vz2,'LineWidth',2);
grid on
xlabel('time');
ylabel('velocity');
legend('X','Y','Z');
title('无人机2')subplot(133);
plot(t1,Vx3,'LineWidth',2);
hold on
plot(t1,Vy3,'LineWidth',2);
hold on
plot(t1,Vz3,'LineWidth',2);
grid on
xlabel('time');
ylabel('velocity');
legend('X','Y','Z');
title('无人机3')load acceleration1.mat
t1=ans.Time;
for i = 1:length(t1)accx1(i)=ans.Data(1,:,i);accy1(i)=ans.Data(2,:,i);accz1(i)=ans.Data(3,:,i);
end
load acceleration2.mat
t2=ans.Time;
for i = 1:length(t2)accx2(i)=ans.Data(1,:,i);accy2(i)=ans.Data(2,:,i);accz2(i)=ans.Data(3,:,i);
end
load acceleration3.mat
t3=ans.Time;
for i = 1:length(t3)accx3(i)=ans.Data(1,:,i);accy3(i)=ans.Data(2,:,i);accz3(i)=ans.Data(3,:,i);
endfigure;
subplot(131);
plot(t1,accx1,'LineWidth',2);
hold on
plot(t1,accy1,'LineWidth',2);
hold on
plot(t1,accz1,'LineWidth',2);
grid on
xlabel('time');
ylabel('acceleration');
legend('X','Y','Z');
title('无人机1')subplot(132);
plot(t2,accx2,'LineWidth',2);
hold on
plot(t2,accy2,'LineWidth',2);
hold on
plot(t2,accz2,'LineWidth',2);
grid on
xlabel('time');
ylabel('acceleration');
legend('X','Y','Z');
title('无人机2')subplot(133);
plot(t3,accx3,'LineWidth',2);
hold on
plot(t3,accy3,'LineWidth',2);
hold on
plot(t3,accz3,'LineWidth',2);
grid on
xlabel('time');
ylabel('acceleration');
legend('X','Y','Z');
title('无人机3')
122

4.系统原理简介

       四旋翼无人机通常采用"十"字形或"X"形布局,四个旋翼对称分布在机体的四个臂上。以"X"形布局为例,四个电机分别安装在机体的前、后、左、右四个方向,其中两两旋翼的旋转方向相反。具体来说:

前、后电机:通常为顺时针旋转(CW)

左、右电机:通常为逆时针旋转(CCW)

       四旋翼无人机通过调节四个旋翼的转速来实现六个自由度的运动控制,但实际控制中主要关注以下四个方向的运动:

垂直运动(高度控制):通过同时增加或减小四个旋翼的转速,改变总升力的大小,实现上升或下降。

俯仰运动(前后倾斜):通过调节前、后旋翼的转速差,使机体产生俯仰力矩,实现向前或向后倾斜飞行。

滚转运动(左右倾斜):通过调节左、右旋翼的转速差,使机体产生滚转力矩,实现向左或向右倾斜飞行。

偏航运动(旋转):通过调节顺时针和逆时针旋转旋翼的转速差,利用反扭矩差使机体产生偏航力矩,实现顺时针或逆时针旋转。

无人机旋转矩阵:

绕Z轴旋转ψ角的矩阵:

绕Y轴旋转θ角的矩阵:

绕X轴旋转ϕ角的矩阵:

总旋转矩阵为:R=RZ​(ψ)*RY​(θ)*RX​(ϕ)展开后得到:

PD控制器的基本原理

PD(比例 - 微分)控制器是一种经典的线性控制器,其控制规律为:

基于PD控制器的四旋翼飞行控制系统设计

四旋翼无人机的PD控制通常采用内外环控制结构:

外环(位置环):控制无人机的空间位置(x, y, z)

内环(姿态环):控制无人机的姿态角(ϕ,θ,ψ)

这种架构的优势在于将复杂的非线性耦合系统分解为相对独立的控制环节,便于设计和调试。

控制无人机的滚转角ϕ和俯仰角θ,实现水平方向的倾斜运动,间接控制位置(x, y,z)。

5.参考文献

[1]丁少宾,肖长诗,刘金根,等.X型四旋翼无人机建模及四元数控制[J].系统仿真学报, 2015(12):6.DOI:CNKI:SUN:XTFZ.0.2015-12-027.

[2]王福,鲜斌,黄国平,等.四旋翼无人机自主悬停控制研究[C]//第三十二届中国控制会议.0[2025-07-01].

6.完整工程文件

v

v

http://www.lryc.cn/news/611129.html

相关文章:

  • Crawl4AI:开源的AI友好型网页爬虫与数据抓取工具
  • MyBatis实现SQL
  • DM8日常运维命令总结(四)
  • jenkins插件Active Choices的使用通过参数动态控制多选参数的选项
  • 聚焦智能穿戴“下一代消费终端”之争,Meta/微美全息借AI+AR积淀定义行业未来
  • Swift 实战:用队列巧解 LeetCode 346 数据流中的移动平均数
  • 【RabbitMQ】高级特性—持久性、重试机制详解
  • 栈的输入与输出方式
  • 《算法导论》第 4 章 - 分治策略
  • Python Day23程序、进程、线程及多线程实现全解析 例题分析
  • 星图云开发者平台赋能商储油安全管控数字化转型
  • 为什么要选择时序数据库IoTDB?
  • Python爬虫08_Requests聚焦批量爬取图片
  • Pandas 入门:数据分析的得力工具
  • 嵌入式硬件中运放内部底层分析
  • 基于深度学习的医学图像分析:使用CycleGAN实现医学图像风格转换
  • 后量子时代已至?中国量子加密技术突破与网络安全新基建
  • 关于npx react-native run-android下载进程缓慢以及进程卡壳等问题的解决方案。
  • Java 大视界 -- Java 大数据在智能医疗电子病历数据分析与临床决策支持中的应用(382)
  • iOS混淆工具有哪些?技术演进与选型趋势全景解析
  • 企业如何用现代数仓架构挖掘新业务盈利点?AllData产品从目标、路径、结果给出答案
  • Go语言实战案例:使用sync.Mutex实现资源加锁
  • 查看 Redis 某个数据库的内存占用
  • 【前端】网站favicon图标制作
  • 力扣-208.实现Trie(前缀树)
  • C++ - 仿 RabbitMQ 实现消息队列--服务端核心模块实现(六)
  • Linux-Day11.WEB服务,虚拟主机
  • VUE丢失long类型精度,使用 json-bigint 库解析大整数
  • 人工智能领域、图欧科技、IMYAI智能助手2025年7月更新月报
  • 暑期算法训练.14