-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboomPlotter.m
99 lines (65 loc) · 2.48 KB
/
boomPlotter.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
function boomPlotter(Platform ,Boom, Hip, Linkage, Phi)
%{
**** Be careful with multiple translations, the lenghts are not rotated
and therefore are not in the right frame. Need to make these adjustments
before the rotation occurs
%}
%% Data sorting
BoomAnglesGround = Boom.Theta;
BoomAnglesVertical = Boom.Phi; %CHECK THIS!
%https://en.wikipedia.org/wiki/Rotation_matrix
alphas = BoomAnglesGround;
betas = BoomAnglesVertical;
gammas = zeros(length(alphas), 1);
%% Platform
drawPlatform(Platform);
%% Boom Arm
armCoord = makeArm(Boom);
%% Hip
hipCoord = makeHip(Hip);
%% End Effecter
effectorCoord = makeEndEffector(Linkage);
%% Left Proximal Link
proximalLeftCoords = makeLeftProximal(Linkage);
%% Right Proximal Link
proximalRightCoords = makeRightProximal(Linkage);
%% Left Distal Link
distalLeftCoords = makeLeftDistal(Linkage, Phi);
%% Right Distal Link
distalRightCoords = makeRightDistal(Linkage, Phi);
%% Rotation Matrices
rotMatrices = boomFrame2WorldFrame(alphas, betas, gammas);
%% Moving the bodies
for i = 1:10:length(alphas)
axis([-2 2 -2 2 0 2]);
rotMatrix = rotMatrices(:, :, :, i);
% Add CoordLenght to the draw function!
CoordLength = size(armCoord, 1);
% Draw Arm
[h1, BoomXs, BoomYs, BoomZs] = drawBodyInWorld(rotMatrix, armCoord', zeros(CoordLength), zeros(CoordLength), Boom.VerticalDisplacement*ones(CoordLength), 1, 'black');
% Draw Hip
[h2, HipXs, HipYs, HipZs] = drawBodyInWorld(rotMatrix, hipCoord', BoomXs, BoomYs, BoomZs, 1, 'white');
% Draw Proximal Left
[h3, plXs, plYs, plZs] = drawBodyInWorld(rotMatrix, proximalLeftCoords, HipXs, HipYs, HipZs, i, 'blue');
% Draw Proximal Right
[h4, prXs, prYs, prZs] = drawBodyInWorld(rotMatrix, proximalRightCoords, HipXs, HipYs, HipZs, i, 'blue');
% Draw Distal Left
[h5, dlXs, dlYs, dlZs] = drawBodyInWorld(rotMatrix, distalLeftCoords, plXs, plYs, plZs, i, 'black');
% Draw Distal Right
[h6, drXs, drYs, drZs] = drawBodyInWorld(rotMatrix, distalRightCoords, prXs, prYs, prZs, i, 'black');
% Draw End Effector
% Should fix this so that it requires it to be in the middle of the two
% distal, quick fix for now
[h7, eeXs, eeYs, eeZs] = drawBodyInWorld(rotMatrix, effectorCoord', dlXs, dlYs, dlZs, 1, 'blue');
view(90+BoomAnglesGround(i)*180/pi, 10)
drawnow;
% Cleanup ----------------------------
pause(.1);
delete(h1)
delete(h2);
delete(h3);
delete(h4);
delete(h5);
delete(h6);
delete(h7);
end