Legacy api to zmq api

Typically: "How do I... ", "How can I... " questions
Post Reply
pr2001
Posts: 4
Joined: 20 Mar 2024, 23:13

Legacy api to zmq api

Post by pr2001 »

Hello guys
I use to have this function to get the joint values in the old api
Right now i am trying to change to the new zmq api but i dont know how to do this part (res ~= obj.vrep.simx_return_ok && res ~= obj.vrep.simx_return_novalue_flag)
I used it to see if everything went well.
Can someone tell me how to do this ?

Complete function:

Code: Select all

function [error,armJoints] = get_joints(obj)
    error = 0;
    for i = 1:obj.number_of_joints
        %Read from joints
        [res,armJoints(i)]=obj.vrep.simxGetJointPosition(obj.clientID, obj.jointHandle{i},obj.vrep.simx_opmode_buffer);
        if (res ~= obj.vrep.simx_return_ok && res ~= obj.vrep.simx_return_novalue_flag)
            disp('ERROR: Failed read Joint value!');
            error = 1;
            return;
        end
    end
end

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: Legacy api to zmq api

Post by coppelia »

Hello,

simply this:

Code: Select all

    for i = 1:obj.number_of_joints
        %Read from joints
        armJoints(i) = sim.getJointPosition(obj.jointHandle{i})
    end
Cheers

Post Reply