I am using RTDE protocol.
For pausing the control package:
MATLAB script:
function pauseRTDEControlPackage(obj)
% disp(“RTDE_CONTROL_PACKAGE_PAUSE…Starts”)
%Sending message to robot…
fwrite(obj,3,‘uint16’) % Message size (header + command) in bytes
fwrite(obj,80,‘uint8’) %RTDE_CONTROL_PACKAGE_PAUSE = 80 (or ASCII - ‘P’)
%Reading responce from robot…
msgSize = fread(obj,1,‘uint16’); %Size of the response message
command = fread(obj,1,‘uint8’); %Command recived
check = fread(obj,1,‘uint8’); %Output check response
%Validity checks
if command ~= 80
disp(“Command is not matching as per the request”)
return;
elseif check ~= 1
disp(“Package pause request is not accepted by robot”)
return;
end
% disp(“RTDE_CONTROL_PACKAGE_PAUSE…Ends”);
end
I am getting “Command is not matching as per the request”.
Why replied command is coming as 85 and not 80?
I tried the same with the start control package and it is returning 83 as a command only.
For your reference:
function startRTDEControlPackage(obj)
% disp(“RTDE_CONTROL_PACKAGE_START…Starts”)
%Sending message to robot…
fwrite(obj,3,‘uint16’) % Message size (header + command) in bytes
fwrite(obj,83,‘uint8’) %RTDE_CONTROL_PACKAGE_START = 83 (or ASCII - ‘S’)
%Reading responce from robot…
msgSize = fread(obj,1,‘uint16’); %Size of the response message
command = fread(obj,1,‘uint8’); %Command recived
check = fread(obj,1,‘uint8’); %Output check response
%Validity checks
if msgSize ~= 4
disp(“Message size is not as expacted”)
return;
elseif command ~= 83
disp(“Command is not matching as per the request”)
return;
elseif check ~= 1
disp(“Package start request is not accepted by robot”)
return;
end
% disp(“RTDE_CONTROL_PACKAGE_START…Ends”);
end