Page 1 of 1

Using sim.getObjectPosition(a,b) got error

Posted: 16 Apr 2021, 10:23
by Ashleycc
Hi guys,
I am using the exist scene "blobDetectionPickandPlace", and i am trying to use python to control the robots.
However when i run the simCallScriptFunction roo call setIkMode from irb360 script, it shows a error in Lua as :

[irb360@childScript:error] 9: One of the function's argument type is not correct. (in function 'sim.getObjectPosition').
[CoppeliaSim:error] External call to simCallScriptFunction failed (setIkMode@irb360): Error in script function.
[irb360@childScript:error] 6: One of the function's argument type is not correct. (in function 'sim.getObjectType').
[CoppeliaSim:error] External call to simCallScriptFunction failed (__getObjectPosition__@irb360): Error in script function.

python code as below:

res, setIkMode, retFloat, retStrings, retBuffer = vrep.simxCallScriptFunction(clientID, 'irb360',
vrep.sim_scripttype_childscript,
'setIkMode', [], [], [], emptyBuff,
vrep.simx_opmode_blocking)
res, getObjectPosition, retFloat, retStrings, retBuffer = vrep.simxCallScriptFunction(clientID, 'irb360',
vrep.sim_scripttype_childscript,
'__getObjectPosition__', [a,b], [], [], emptyBuff,
vrep.simx_opmode_oneshot_wait)

Thank you for your help!!

Re: Using sim.getObjectPosition(a,b) got error

Posted: 16 Apr 2021, 12:40
by coppelia
Hello,

so you are trying to call function setFkMode from your legacy remote API client, using simxCallScriptFunction? You can't, or you should change the arguments and return values of that function to something as described here, how to extend the remote API.

If you already did that, then you have to tell us more about what is wrong with the arguments... did you try to print them to the status bar before the error happens, to see what they are?

Cheers

Re: Using sim.getObjectPosition(a,b) got error

Posted: 16 Apr 2021, 16:34
by Ashleycc
Thank you for your reply!!
actually for FKmode after I input the arguments seems no error, however in setIkmode, because it use a function called __getObjectPosition__, and seems this function always remind me as [irb360@childScript:error] 6: One of the function's argument type is not correct. (in function 'sim.getObjectType').
So i don't know what happened there...

Re: Using sim.getObjectPosition(a,b) got error

Posted: 17 Apr 2021, 05:28
by coppelia
here again, it tells you that something is wrong with the function's argument... so did you try to print that argument? What does it say? The argument specifically needs to be an integer. Not a string, not a bool, not nil, etc.

Cheers