forked from Modi1987/KST-Kuka-Sunrise-Toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getJointsPos.m
39 lines (30 loc) · 803 Bytes
/
getJointsPos.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
function [ jPos ] = getJointsPos( t )
%% This function is used to get the joints positions of the KUKA iiwa 7 R 800.
%% Syntax:
% [ jPos ] =getJointsPos( t )
%% About:
% This function is used to get the joints positions of the KUKA iiwa 7 R 800.
%% Arregumetns:
% t: is the TCP/IP connection
% jPos: is 1x7 cell array of the joints' angles of the robot (unit
% Radians).
% Copyright, Mohammad SAFEEA, 3rd of May 2017
theCommand='getJointsPositions';
fprintf(t, theCommand);
message=fgets(t);
jPos=getDoubleFromString(message);
end
function jPos=getDoubleFromString(message)
n=max(max(size(message)));
j=0;
numString=[];
for i=1:n
if message(i)=='_'
j=j+1;
jPos{j}=str2num(numString);
numString=[];
else
numString=[numString,message(i)];
end
end
end