Skip to content

Commit fd1a9cb

Browse files
author
Kareem
committed
AD
1 parent 930febf commit fd1a9cb

File tree

8 files changed

+65
-8
lines changed

8 files changed

+65
-8
lines changed

Course-project.pdf

121 KB
Binary file not shown.

GetMaxTorque.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
function [retval] = GetMaxTorque (l1,l2,l3, MinQ1,MaxQ1,MinQ2,MaxQ2,MinQ3,MaxQ3,load)
2+
r=eye(3,3);
3+
r(3,1)=1;r(3,2)=1;r(3,3)=1;
4+
m=0;
5+
m2=0;
6+
m3=0;
7+
for i=MinQ1:10:MaxQ1
8+
for j=MinQ2:10:MaxQ2
9+
for k=MinQ3:10:MaxQ3
10+
r(1,1)=-l1*sind(i)-l2*sind(i+j)-l3*sind(i+j+k);
11+
r(1,2)=-l2*sind(i+j)-l3*sind(i+j+k);
12+
r(1,3)=-l3*sind(i+j+k);
13+
r(2,1)=l1*cosd(i)+l2*cosd(i+j)+l3*cosd(i+j+k);
14+
r(2,2)=l2*cosd(i+j)+l3*cosd(i+j+k);
15+
r(2,3)=l3*cosd(i+j+k);
16+
aa=-r'*load;
17+
if(abs(aa(1))>abs(m))
18+
m = aa(1);
19+
end
20+
if(abs(aa(2))>abs(m2))
21+
m2 = aa(2);
22+
end
23+
if(abs(aa(3))>abs(m3))
24+
m3 = aa(3);
25+
end
26+
end
27+
end
28+
end
29+
retval = [m m2 m3];
30+
endfunction

InverseKinematic.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
while(q33<0)
5353
q33=q33+360;
5454
end
55+
else
56+
printf("Cannot reach ,irony :V \n");
57+
return;
5558
end
5659
if(q1!=q11&&q2!=q22&&q3!=q33)
5760
[q1 q2 q3 q11 q22 q33]

PlotWorkingSpace.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
function [retval] = PlotWorkingSpace (l1, l2,l3,maxQ1,maxQ2,maxQ3)
2-
k=0:maxQ3;
3-
for i=0:maxQ1
4-
for j=0:maxQ2
1+
function [retval] = PlotWorkingSpace (l1, l2,l3,MinQ1,maxQ1,MinQ2,maxQ2,MinQ3,maxQ3)
2+
k=MinQ3:maxQ3;
3+
for i=MinQ1:maxQ1
4+
for j=MinQ2:maxQ2
55
plot(l1*cosd(i)+l2*cosd(i+j)+l3*cosd(i+j+k),l1*sind(i)+l2*sind(i+j)+l3*sind(i+j+k),'.y','markersize',10);
66
hold on;
77
end

Project_Main.m

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
fileID = fopen('input.txt','r');
22
formatSpec = '%f';
33
input = fscanf(fileID,formatSpec);
4-
InverseKinematic(input(7),input(8),input(9),input(10),input(11),input(12));
54
printf("\n");
6-
#printf("program passed , press anykey to continue to Plotting");
7-
#pause;
8-
#PlotWorkingSpace(input(1),input(2),input(3),input(4),input(5),input(6));
5+
printf("program passed , press anykey to continue to Calculating InverseKinematics");
6+
pause;
7+
printf("\n");
8+
9+
InverseKinematic(input(10),input(11),input(12),input(13),input(14),input(15));
10+
printf("\n");
11+
printf("program passed , press anykey to continue to Calculating Max Torque");
12+
pause;
13+
printf("\n");
14+
15+
GetMaxTorque(input(16),input(17),input(18),input(19),input(20),input(21),input(22),input(23),input(24),[input(25) input(26) input(27)]')
16+
printf("\n");
17+
printf("program passed , press anykey to continue to Plotting");
18+
pause;
19+
printf("\n");
20+
21+
PlotWorkingSpace(input(1),input(2),input(3),input(4),input(5),input(6),input(7),input(8),input(9));

input.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
1 1 1
2+
0 45
3+
0 45
4+
0 45
5+
100 100 100
6+
50 50 20
7+
1 1 1
8+
0 45
9+
0 45
10+
0 45
11+
1 1 1

inputFormat.txt

Whitespace-only changes.

octave-workspace

407 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)