forked from Modi1987/KST-Kuka-Sunrise-Toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tutorial_move_ptp.m
48 lines (34 loc) · 1.28 KB
/
Tutorial_move_ptp.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
%% 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
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
%% PTP motion
jPos={}
homePos={}
[ jPos ] = getJointsPos( t_Kuka ) % get current joints position
for ttt=1:7 % home position
homePos{ttt}=0;
end
pause(0.1)
relVel=0.15;
movePTPJointSpace( t_Kuka , homePos, relVel); % go to home position
pause(0.1)
movePTPJointSpace( t_Kuka , jPos, relVel); % return back to original position
%% turn off the server
net_turnOffServer( t_Kuka );
fclose(t_Kuka);
end