forked from auralius/my-matlab-robotics-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo_scara.m
40 lines (32 loc) · 837 Bytes
/
demo_scara.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
%%
clc;
clear all;
close all;
%% Add path to `my-matlab-robotics-toolbox`
addpath(".\my-matlab-robotics-toolbox\")
%% Graphic
g = ncgr_graphic();
%% Scara robot DH-Parameters
global N_DOFS;
N_DOFS = 4;
theta = [0 0 0 0];
alpha = [0 0 0 0];
offset = [0 0 0 0];
a = [0 0.45 0.72 0];
d = [0.21 0 0 0];
type = ['r' 'r' 'r' 'p'];
base = [0; 0; 0];
scara = cgr_create(theta, d, a, alpha, offset, type, base);
scara = cgr_self_update(scara, [0 0 0 0]);
g = ncgr_plot(g, scara);
pause(1);
scara = cgr_self_update(scara, [0 0 0 -0.2]);
g = ncgr_plot(g, scara);
pause(1);
scara = cgr_self_update(scara, [0 0 0 0]);
g = ncgr_plot(g, scara);
%% Demo inverese kinematics
[q, k, err]= cgr_ikine1(scara, [0.5; 0.5; -0.5], 0.01, 100);
scara = cgr_self_update(scara, q);
g = ncgr_plot(g, scara);
pause(0.1);