-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercise_4.m
66 lines (50 loc) · 1.12 KB
/
exercise_4.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
% Clean workspace
clear
clc
hold off
% Initial posture
L = [0.4, 0.1]'; % [m]
q = deg2rad([80, 30])'; % [rad]
phi = deg2rad([0, 0])'; % [rad]
r = L./q;
x = compute_arc_points(q,r,phi);
% Draw arc
figure(1)
draw_arc(x,'c')
x_max = 0.4;
y_max = 0.4;
xlim([0 x_max])
ylim([0 y_max])
axis equal
L = % TO FILL
m = % TO FILL
x_ref = [0.3; 0.05];
x_ee = [x(end,1), x(end,3)]';
gamma = 0.5; % Proportional gain
dT = 0.05;
e = % TO FILL
while sqrt(e'*e) > 0.001
% Display the norm of the error
disp(sqrt(e'*e));
% Compute control command
J = get_jacobian(q,L);
dq = % TO FILL
% Update the agle
q = % TO FILL
% Compute the mapping and find the PCC parameters
r = % TO FILL
% Recompute the arc points for the new robot posture
x = compute_arc_points(q,r,phi);
% Update the end-effector current position and the error
x_ee = % TO FILL
e = % TO FILL
% Redraw the scene
hold off
draw_arc(x,'r')
% Draw the target point
scatter(x_ref(1),x_ref(2),'g','filled')
xlim([0 x_max])
ylim([0 y_max])
drawnow
pause(dT)
end