Bill of Materials
Code: Analyzing the Arm Length for the Motor
%% Reset
clc, clear all
%% Presetting
% All values corresponding to the first quadrant propeller arm.
% _____ Lengths [mm] _____
% _____ Links _____
l_fix = 200; % Fixed link
l_1 = zeros(100,1);
l_2 = zeros(100,1);
l_1_matrix = zeros(100, 1);
% _____ Disks [radius] _____
l_d1 = 15; % Disk 1
l_d2 = 15; % Disk 2
l_dd = 30; % Distance between two disks
% _____ Height of the propeller from the bottom of the drone _____
h_p = 50;
% _____ Distance between end tip of the links
k = zeros(100,1);
% _____ Angles (Sperical: [theta, phi]) [deg] _____
% _____ Disks configuration _____
theta_dd = [135, 0];
% _____ Links configuration _____
p_e_l_fix = [45, 10];
% p_link_1 = [];
% p_link_2 = [];
% _____ Turning angle of disks _____
t_d1 = 225;
t_d2 = t_d1 + 120; % Phase shift of 120 degrees between 'disk 1' and 'disk 2'
while t_d2 >= 270
t_d2 = t_d2 -360;
end
% _____ Position vector _____
% _____ Origin point _____
% The origin is located on the line connecting centers of the two disks.
p_ori = [0; 0; 0]; % Origin
% _____ Disks _____
% _____ Center of the disks _____
p_c_d1 = [ cosd(theta_dd(1)) * ( l_d1 + l_dd/2 ) ; sind(theta_dd(1)) * ( l_d1 + l_dd/2 ) ; 0 ];
p_c_d2 = [ cosd(theta_dd(1) + 180) * ( l_d2 + l_dd/2 ) ; sind(theta_dd(1) + 180) * ( l_d2 + l_dd/2 ) ; 0 ];
% _____ End point of the disks _____
p_e_d1 = [ p_c_d1(1) + l_d1 * cosd(t_d1); p_c_d1(2) + l_d1 * sind(t_d1); p_c_d1(3) ];
p_e_d2 = [ p_c_d2(1) + l_d2 * cosd(t_d2); p_c_d2(2) + l_d2 * sind(t_d2); p_c_d2(3) ];
% _____ Links _____
% _____ Fixed link _____
p_e_l_fix = end_vec_a(l_fix, p_ori, p_e_l_fix);
% _____ Moving link _____
p_link_1 = [];
p_link_2 = [];
% _____ Error _____
error = zeros(100,1);
%% Composite 3 by 3 matrices vector of each link
% Column 1: Positional vector of starting point of the link [x, y, z]
% Column 2: Positional vector of ending point of the link [x, y, z]
% Column 3: Angles[ existence of the angle( 0 or 1 ), theta, phi]
%% Loop for the matching x, y, and z deviation in the cycle