I am changing my code from remAPI to ZeroMQ and I am facing an error when I try to write it in Object Oriented Programming style
Code: Select all
classdef VrepConnectorZMQ
properties
sim; %Similar to fd
client; %Used for server connection and server requests
robot_joints = [] %List of joint handles
%Integration step used for simulation
end
methods
function obj = VrepConnectorZMQ()
addpath vrep_lib/; %Adding the APIs to the path
client = RemoteAPIClient();
client.setStepping(true);
obj.sim = client.getObject('sim'); %RemoteAPI object
obj.sim.startSimulation();
for i = 1:7
[~,obj.robot_joints(i)] = obj.sim.getObject(strcat('/LBR_iiwa_14_R820_joint',int2str(i)));
end
for i = 1:7
[~, joint_pos] = obj.sim.simxGetJointPosition(obj.clientID, obj.robot_joints(i), obj.sim.simx_opmode_streaming);
end
% When simulation is not running, ZMQ message handling could be a bit
% slow, since the idle loop runs at 8 Hz by default. So let's make
% sure that the idle loop runs at full speed for this program:
defaultIdleFps = sim.getInt32Param(sim.intparam_idle_fps);
sim.setInt32Param(sim.intparam_idle_fps, 0);
end
function q = GetState(obj)
q = zeros(7,1);
for i=1:7
[~, q(i)] = obj.sim.simxGetJointPosition(obj.robot_joints(i));
end
end
end
end
Code: Select all
Output argument "varargout{2}" (and possibly others) not assigned a value in the execution with "RemoteAPIObject/subsref"
function.
Error in VrepConnectorZMQ (line 21)
[~,obj.robot_joints(i)] = obj.sim.getObject(strcat('./LBR_iiwa_14_R820_joint',int2str(i)));
Error in main (line 78)
robot = VrepConnectorZMQ();
I should add that it is not clear, how to install the ZeroMQ library on Matlab from the link https://www.coppeliarobotics.com/helpFi ... erview.htm
It is only mentioned what to do for Octave , and I had to copy and paste the files RemoteAPIObject.m and cbor.m and RemoteAPIClient.m to the running directory. But only out of guessing. Should I add it to another certain directory that is not explained in help?