Joint Position Change after Running RemApi in matlab

Report crashes, strange behaviour, or apparent bugs
Post Reply
umerhuzaifa
Posts: 20
Joined: 26 Feb 2015, 09:08

Joint Position Change after Running RemApi in matlab

Post by umerhuzaifa »

Hi,

I have made a structure in the VREP environment having two revolute joints. I connected to VREP from MATLAB using remApi functions. I have to update the joint positions from MATLAB. My MATLAB script successfully does that but as my script ends in MATLAB, the joint ("joint_right") acquires a -180 degree position in VREP and keeps that even if I change that manually from the joint properties dialog. My joint type is inverse kinematic with Hybrid Operation.
Kindly guide me what should I do.
Links to my files are as follows:
VREP file: https://drive.google.com/file/d/0B2w3mm ... sp=sharing
Matlab script: https://drive.google.com/file/d/0B2w3mm ... sp=sharing

Thanks,
Umer

umerhuzaifa
Posts: 20
Joined: 26 Feb 2015, 09:08

Re: Joint Position Change after Running RemApi in matlab

Post by umerhuzaifa »

I just performed the same angular position update using a childscript in the VREP scene and it works perfectly. This means the problem is with the remApi connection.

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

Re: Joint Position Change after Running RemApi in matlab

Post by coppelia »

Hello,

I am not really sure what you mean. But this is what I see in your Matlab code:

You are setting a joint value from the remote API via a streaming command. This doesn't make sense. You should use:

Code: Select all

vrep.simxSetJointPosition(id,rleg,traj(cnt),vrep.simx_opmode_oneshot)
Streaming values is only to retrieve values from V-REP.
Also, if you end the connection just after you set a value, that value has high chances not to arrive anymore (if you sent it via simx_opmode_oneshot).

Cheers

umerhuzaifa
Posts: 20
Joined: 26 Feb 2015, 09:08

Re: Joint Position Change after Running RemApi in matlab

Post by umerhuzaifa »

Thank you. Found my mistake.

Post Reply