旋翼类无人机相对于固定翼无人机具有能够垂直起降,空中悬停等优点,而四旋翼无人机作为其中一个典型的代表,不仅结构简单还具有良好的带载能力,也易于操控,在军事领域,民用领域,都有着广泛的应用,常见的包括航天拍摄,灾害救援,物资运输等.飞行控制系统是四旋翼飞行器的关键,其中,如何控制飞行器的姿态,是整个飞行控制的核心问题.要保证四旋翼无人机在各种飞行环境下都具有良好的飞行状态,飞行控制算法极为重要.
function sdot = quadEOM(t, s, qn, controlhandle, trajhandle, params)
% QUADEOM Wrapper function for solving quadrotor equation of motion
% quadEOM takes in time, state vector, controller, trajectory generator
% and parameters and output the derivative of the state vector, the
% actual calcution is done in quadEOM_readonly.
%
% INPUTS:
% t - 1 x 1, time
% s - 13 x 1, state vector = [x, y, z, xd, yd, zd, qw, qx, qy, qz, p, q, r]
% qn - quad number (used for multi-robot simulations)
% controlhandle - function handle of your controller
% trajhandle - function handle of your trajectory generator
% params - struct, output from crazyflie() and whatever parameters you want to pass in
%
% OUTPUTS:
% sdot - 13 x 1, derivative of state vector s
%
% NOTE: You should not modify this function
% See Also: quadEOM_readonly, crazyflie
% convert state to quad stuct for control
qd = stateToQd(s);
% Get desired_state
desired_state = trajhandle(t);
% The desired_state is set in the trajectory generator
qd.pos_des = desired_state.pos;
qd.vel_des = desired_state.vel;
qd.acc_des = desired_state.acc;
qd.yaw_des = desired_state.yaw;
qd.yawdot_des = desired_state.yawdot;
% get control outputs
[F, M] = controlhandle(qd, t, params);
% compute derivative
sdot = quadEOM_readonly(t, s, F, M, params);
end
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删