Page 1 of 1

Get the error: attempt to call a nil value (field 'getobjectMatrix')

Posted: 13 Apr 2024, 16:04
by Horizon
In my sysCall_thread() function, I use the code below to get the Tranform matrix between camera and end-effector. But I have got the error: [string "/Franka@childScript"]:139: attempt to call a nil value (field 'getobjectMatrix')

Code: Select all

tip=sim.getObject('/Franka/connection')
camera=sim.getObject('/Franka/blobTo3dPosition/sensor')
Anc=Matrix:vertcat(Matrix(3,4,sim.getobjectMatrix(camera,tip)),Matrix(1,4,{0,0,0,1}))
And in my previous attemption, I use getObjectFloatParam() and getObjectInt32Param() in the sysCall_thread() function will also appear the same error.

I don't know where the problems are. Can you give me some advise?

Re: Get the error: attempt to call a nil value (field 'getobjectMatrix')

Posted: 15 Apr 2024, 10:09
by fferri
Lua is a case-sensitive language, and so are API function names.

Refer to Regular API reference.

Re: Get the error: attempt to call a nil value (field 'getobjectMatrix')

Posted: 15 Apr 2024, 10:11
by fferri
Horizon wrote: 13 Apr 2024, 16:04

Code: Select all

Anc=Matrix:vertcat(Matrix(3,4,sim.getobjectMatrix(camera,tip)),Matrix(1,4,{0,0,0,1}))
Also, you can write that as simply:

Code: Select all

Anc=Matrix4x4(sim.getObjectMatrix(camera,tip))
Matrix4x4 initializes from either a 12 or 16 elements array.