forked from s-kajita/IntroductionToHumanoidRobotics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscrew_motion.m
48 lines (38 loc) · 806 Bytes
/
screw_motion.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
%%% forward dynamics by unit vector method
clear
close all
global uLINK G
ToRad = pi/180;
G = 9.8;
WAIST = 1;
uLINK = struct('name','BODY' , 'm', 10, 'sister', 0, 'child', 0, 'b',[0 0 0]','a',[0 0 1]','q',0);
uLINK.mother = 0;
% Inertia tensor
lx = 0.1;
ly = 0.4;
lz = 0.9;
[uLINK(1).vertex,uLINK(1).face] = MakeBox([lx ly lz] ,[lx/2 ly/2 lz/2] ); % BODY
%%%%%%%%%%%%%%%%%%
%% body state
uLINK(WAIST).p = [0, 0, 0]';
uLINK(WAIST).R = eye(3);
uLINK(WAIST).w = [1, 0, 0]';
uLINK(WAIST).vo = [0.3 0 1]';
for n=1:length(uLINK)
uLINK(n).u = 0.0;
end
global Dtime
Dtime = 0.3;
time = 0:Dtime:10.0;
tsize = length(time);
figure
for n = 1:tsize
DrawAllJoints(1);
[uLINK.p, uLINK.R] = SE3exp(1, Dtime);
end
view(3)
axis equal
grid on
xlabel('x')
ylabel('y')
zlabel('z')