-
Notifications
You must be signed in to change notification settings - Fork 81
/
PLANAR_main_3DOF.m
61 lines (53 loc) · 1.67 KB
/
PLANAR_main_3DOF.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
%%
% Author: Yash Bansod
%
% GitHub: <https://github.com/YashBansod>
%
% This is the main program.
%% Clear the environment and the command line
clear;
clc;
close all;
%% Add the directory containing relevant functions to the path variables
addpath('./INV-functions/')
%% Define the input parameters and simulate
% Set the length of the links of the manipulator robot.
L1 = 5;
L2 = 5;
L3 = 5;
% Set the initial orientation of the robot.
theta1 = 10;
theta2 = 0;
theta3 = 15;
% Define the radius of the circle the end effector should follow
radius = 10;
r_sq = radius ^ 2;
hold on;
% Code for drawing a circle
for i = -radius: radius/10: radius
expX = i;
expY = sqrt(r_sq - expX^2);
cla;
images.roi.Circle(gca,'Center',[0 0],'Radius',radius, 'Facealpha', 0.05);
% You can modify the Kp value defined in PLANAR_INV_KIN_3DOF to modify
% the inverse jacobian controller behavior.
[expPoint, Joint, Theta] = PLANAR_INV_KIN_3DOF(L1, L2, L3, expX, ...
expY, theta1, theta2, theta3);
scatter(Joint(end,1), Joint(end,2));
theta1 = Theta(1, 1);
theta2 = Theta(2, 1);
theta3 = Theta(3, 1);
end
for i = radius: -radius/10: -radius
expX = i;
expY = -sqrt(r_sq - expX^2);
cla;
images.roi.Circle(gca,'Center',[0 0],'Radius',radius, 'Facealpha', 0.05);
% You can modify the Kp value defined in PLANAR_INV_KIN_3DOF to modify
% the inverse jacobian controller behavior.
[expPoint, Joint, Theta] = PLANAR_INV_KIN_3DOF(L1, L2, L3, expX, ...
expY, theta1, theta2, theta3);
theta1 = Theta(1, 1);
theta2 = Theta(2, 1);
theta3 = Theta(3, 1);
end