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

Typically: "How do I... ", "How can I... " questions
Post Reply
Horizon
Posts: 6
Joined: 15 Nov 2023, 08:27

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

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

fferri
Posts: 1231
Joined: 09 Sep 2013, 19:28

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

Post by fferri »

Lua is a case-sensitive language, and so are API function names.

Refer to Regular API reference.

fferri
Posts: 1231
Joined: 09 Sep 2013, 19:28

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

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

Post Reply