forked from Modi1987/KST-Kuka-Sunrise-Toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tutorial_move_lin.m
78 lines (58 loc) · 2.24 KB
/
Tutorial_move_lin.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
66
67
68
69
70
71
72
73
74
75
76
77
78
%% Example
% An example script, it is used to show how to use the different
% functions of the KUKA iiwa matlab toolbox
% First start the server on the KUKA iiwa controller
% Then run the following script in Matlab
% Mohammad SAFEEA, 3rd of May 2017
close all,clear all,clc
warning('off');
ip='172.31.1.147'; % The IP of the controller
% start a connection with the server
t_Kuka=net_establishConnection( ip );
if ~exist('t_Kuka','var') || isempty(t_Kuka) || strcmp(t_Kuka.Status,'closed')
warning('Connection could not be establised, script aborted');
return;
else
%% move to initial position
pinit={0,pi*20/180,0,-pi*70/180,0,pi*90/180,0}; % initial confuguration
relVel=0.15; % relative velocity
movePTPJointSpace( t_Kuka , pinit, relVel); % point to point motion in joint space
%% Get position roientation of end effector
disp('Cartesian position')
Pos=getEEFPos( t_Kuka )
relVel=50; % velocity of the end effector, mm/sec
disp=50;
%% Move the endeffector in the X direction
index=1;
Pos{index}=Pos{index}+disp;
movePTPLineEEF( t_Kuka , Pos, relVel)
pause(0.1)
Pos{index}=Pos{index}-disp;
movePTPLineEEF( t_Kuka , Pos, relVel)
%% Move the endeffector in the z direction
index=3;
Pos{index}=Pos{index}+disp;
movePTPLineEEF( t_Kuka , Pos, relVel)
pause(0.1)
Pos{index}=Pos{index}-disp;
movePTPLineEEF( t_Kuka , Pos, relVel)
%% Move the endeffector to a distination frame,
Pos={400,0,580,-pi,0,-pi}; % first configuration
% the coordinates are:
% x=400mm, y=0mm, z=580 mm.
% the rotation angles are:
% alpha=-180 degrees, beta=0 degrees, gama=-180 degrees
movePTPLineEEF( t_Kuka , Pos, relVel)
Pos={500,0,580,-pi,0,-pi+pi/4}; %% second configuration
% the coordinates are:
% x=400mm, y=0mm, z=580 mm.
% the rotation angles are:
% alpha=-180 degrees, beta=0 degrees, gama=-165 degrees,
setBlueOn(t_Kuka);
movePTPLineEEF( t_Kuka , Pos, relVel)
setBlueOff(t_Kuka);
%% turn off the server
net_turnOffServer( t_Kuka );
fclose(t_Kuka);
end
warning('on');