% Reference paper parameters
% kf=3.13e-5
% km=7.5e-7
% m=0.0025
% Ixx=0.00104
% Iyy=0.00104
% Izz=0.0135
%Actual Hardware parameters
kf=9.8e-6 % thrust factor
km=1.6e-7 % drag factor
m=2 % mass of quadrotor
Ixx=0.0035 % Inertia along x-axis
Iyy=0.0035 % Inertia along y-axis
Izz=0.005 % Inertia along z-axis
l=0.225 % length of arm
w1=100 % max angular speed of rotor 1
w2=100 % max angular speed of rotor 2
w3=100 % max angular speed of rotor 3
w4=100 % max angular speed of rotor 4
u1=((w1^2)+(w2^2)+(w3^2)+(w4^2))*kf % thrust input to the quadrotor
% State space model: x' = Ax + Bu
% x[states] = [x y z x'y'z' phi theta zhi p q r]
A=[0 0 0 1 0 0 0 0 0 0 0 0;
0 0 0 0 1 0 0 0 0 0 0 0;
0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 u1/m 0 0 0 0;
0 0 0 0 0 0 -u1/m 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 1 0 0;
0 0 0 0 0 0 0 0 0 0 1 0;
0 0 0 0 0 0 0 0 0 0 0 1;
0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0]
B=[0 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0;
1/m 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0;
0 01/Ixx 0 0;
0 0 1/Iyy 0;
0 0 0 1/Izz]
C=[0 0 1 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 1 0 0 0 0 0;
0 0 0 0 0 0 0 1 0 0 0 0;
0 0 0 0 0 0 0 0 1 0 0 0]
D=[0 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0]
% LQR weight matrices
%q = [10 20 80 5 5 15 10 20 100 8 5 1]
q = [500 200 1.71 500 200 3 10 10 10 0.25 10 1]
Q = diag(q)
%r = [1 0.1 0.1 0.1]
r = [1 0.001 0.001 0.001]
R = diag(r)
N=0;
[K,S,e] = lqr(A,B,Q,R,N) % calculating the optimal gain matrix[K]
% Feedback conversion marices
H=[-kf -kf -kf -kf;
0 -kf*l 0 kf*l;
kf*l 0 -kf*l 0;
km -km km -km]
L=1/det(H)
J =[0 0 kf*l km;
0 -kf*l 0 -km;
0 0 -kf*l km;
0 kf*l 0 -km]
G=L*J
%set(gca,'FontSize',18);
基于PID与LQR控制的四旋翼飞行器MATLAB仿真模型
版权申诉
5星 · 超过95%的资源 76 浏览量
2024-03-28
22:21:35
上传
评论 1
收藏 299KB RAR 举报
学习不好的电气仔
- 粉丝: 1427
- 资源: 263
最新资源
- #P0015. 全排列 超级简单
- pta题库答案c语言之排序4统计工龄.zip
- pta题库答案c语言之树结构7堆中的路径.zip
- pta题库答案c语言之树结构3TreeTraversalsAgain.zip
- pta题库答案c语言之树结构2ListLeaves.zip
- pta题库答案c语言之树结构1树的同构.zip
- 基于C++实现民航飞行与地图简易管理系统可执行程序+说明+详细注释.zip
- pta题库答案c语言之复杂度1最大子列和问题.zip
- 三维装箱问题(Three-Dimensional Bin Packing Problem,3D-BPP)是一个经典的组合优化问题
- 以下是一些关于Linux线程同步的基本概念和方法.txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈