error code 8 when using Remote API

Typically: "How do I... ", "How can I... " questions
Post Reply
jvitolla
Posts: 9
Joined: 14 Feb 2013, 16:50

error code 8 when using Remote API

Post by jvitolla » 01 Apr 2013, 16:10

Hi,

I have a problem. I'm running a very simple simulation where I need to set the position of a revolute joint from Matlab. I use the following code to do so:

Code: Select all

leg=vrep.simxGetObjectHandle('motor1',vrep.simx_opmode_oneshot);
     send=vrep.simxSetJointPosition(leg,90,vrep.simx_opmode_oneshot_wait);
I'm gettind an error code 8 (which I think means simx_error_remote_error_flag) and the joint doesn't move to the desired position. I only run the vrep.simxSetJointPosition command once, but I don't know if it is necessary to run it in a loop to work. Ideally in my case this should be done only once.

Can you help me with this? Thanks in advance!

jvitolla
Posts: 9
Joined: 14 Feb 2013, 16:50

Re: error code 8 when using Remote API

Post by jvitolla » 01 Apr 2013, 16:16

I have also tried with the simx_opmode_oneshot operation mode and I get error 1 (simx_error_novalue_flag)

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

Re: error code 8 when using Remote API

Post by coppelia » 01 Apr 2013, 18:49

Hello,

When retrieving the object handle, why are you using simx_opmode_oneshot? The simxGetObjectHandle function documentation recommends to use simx_opmode_oneshot_wait, which makes sense, since we need to wait until the server answers.

Also, when setting the joint position, use simx_opmode_oneshot, not simx_opmode_oneshot_wait.

Make sure to read and understand this section about the remote API.

Cheers

jvitolla
Posts: 9
Joined: 14 Feb 2013, 16:50

Re: error code 8 when using Remote API

Post by jvitolla » 01 Apr 2013, 20:31

Indeed, I made a mistake when setting the opmode for getting the handle of the joint. Now I can see that I have no error for that function and I do get the handle, but when I try to use the simxSetJointPosition command with the simx_opmode_oneshot I still get error code 1 and the joint doesn't move. However if I try the simSetJointPosition it works.

Do you have an idea what can be wrong? Thanks again for your help.

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

Re: error code 8 when using Remote API

Post by coppelia » 01 Apr 2013, 20:38

simxGetObjectHandle returns 2 values! The first is the error code, the second is the object handle

Cheers

jvitolla
Posts: 9
Joined: 14 Feb 2013, 16:50

Re: error code 8 when using Remote API

Post by jvitolla » 01 Apr 2013, 20:44

Yes I had already seen that from the documentation. Here is my code:

Code: Select all

[fff,leg]=vrep.simxGetObjectHandle('motor1',vrep.simx_opmode_oneshot_wait);
       
         send=vrep.simxSetJointPosition(leg,90,vrep.simx_opmode_oneshot);
When executed once, I don't see any movement of the joint.

Cheers!

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

Re: error code 8 when using Remote API

Post by coppelia » 01 Apr 2013, 21:03

Your code works here. Maybe your joint is not in the correct mode. Also always make sure that the handle is correct.
The return value of the second function call is 1, and it is normal, since the call is non-blocking and doesn't wait for a return value.

Cheers

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

Re: error code 8 when using Remote API

Post by coppelia » 01 Apr 2013, 21:09

Additionally:
  • Make sure you don't call simxFinish just after, otherwise your command might not get through
  • Make sure to use radians when specifying angular values
Cheers

Post Reply