Using sim.getObjectPosition(a,b) got error

Typically: "How do I... ", "How can I... " questions
Post Reply
Ashleycc
Posts: 3
Joined: 15 Apr 2021, 10:43

Using sim.getObjectPosition(a,b) got error

Post 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!!

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

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

Post 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

Ashleycc
Posts: 3
Joined: 15 Apr 2021, 10:43

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

Post 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...

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

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

Post 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

Post Reply