-
Notifications
You must be signed in to change notification settings - Fork 0
/
CalcDesTrajectory.m
executable file
·61 lines (52 loc) · 2.04 KB
/
CalcDesTrajectory.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
function [q_d,dq_d,ddq_d]=CalcDesTrajectory(type,t)
switch type
case 'teste'
raio = 0.5;
w=0.3;
q_d = [raio*cos(w*t);
raio*sin(w*t);
raio*cos(w*t);
pi/2+w.*t];
dq_d = [-raio*w*sin(w*t);
raio*w*cos(w*t);
-raio*w*sin(w*t);
w*ones(1,length(t))];
ddq_d = [-raio*w^2*cos(w*t);
-raio*w^2*sin(w*t);
-raio*w^2*cos(w*t);
zeros(1,length(t))];
case 'circle'
raio = 0.5;
w=0.3;
q_d = [raio*cos(w*t);
raio*sin(w*t);
ones(1,length(t));
zeros(1,length(t))];
dq_d = [-raio*w*sin(w*t);
raio*w*cos(w*t);
zeros(1,length(t));
zeros(1,length(t))];
ddq_d = [-raio*w^2*cos(w*t);
-raio*w^2*sin(w*t);
zeros(1,length(t));
zeros(1,length(t))];
case 'LemniscataBernoulli'
a=1;
q_d = [a*cos(t).*sqrt(2.*cos(2*t));
a*sin(t).*sqrt(2.*cos(2*t));
ones(1,length(t));
zeros(1,length(t))];
dq_d = [-(2^(1/2)*a.*sin(3.*t))./cos(2.*t).^(1/2);
(2^(1/2)*a.*cos(3.*t))./cos(2.*t).^(1/2);
zeros(1,length(t));
zeros(1,length(t))];
ddq_d =[-(2^(1/2)*a.*(cos(5.*t) + 2.*cos(t)))./cos(2.*t).^(3/2);
-(2^(1/2)*a.*(sin(5.*t) + 2.*sin(t)))./cos(2.*t).^(3/2);
zeros(1,length(t));
zeros(1,length(t))];
otherwise
q_d = zeros(4,length(t));
dq_d = zeros(4,length(t));
ddq_d = zeros(4,length(t));
end
end