Error message from sim.convexDecompose

Typically: "How do I... ", "How can I... " questions
Post Reply
allen0413
Posts: 7
Joined: 05 May 2020, 10:43

Error message from sim.convexDecompose

Post by allen0413 »

As I try to do exact the same thing about this post,
https://forum.coppeliarobotics.com/view ... 037#p32037

It seems working fine, but still gives me an error message :

Lua runtime error: [string "CHILD SCRIPT Mike"]:7: Invalid argument. (sim.convexDecompose)
stack traceback:
[C]: in function 'convexDecompose'
[string "CHILD SCRIPT Mike"]:7: in function


Looks like it's something wrong with the parameters I gave to the sim.convexDecompose function? But I thought the parameters are exactly same as the post using...

https://imgur.com/LVGhCSg

Here's my code :

Code: Select all

function sysCall_init()
    repeat until (simRemoteApi.start(19996,1300,false,true)~=-1)
    mike1 = sim.getObjectHandle('Mike')
    tIntParams = {0, 0, 0, 0, 0, 100000, 20, 4, 4, 64}
    tFloatParams = {0.0, 0.0, 0.0, 0.0, 0.0, 0.002, 0.05, 0.05, 0.001, 0.0001}
    convex = sim.convexDecompose(mike1, 129, tIntParams, tFloatParams)
    print(convex)
end
Error occurs so it don't compile the codes after "convex = sim.convexDecompose(mike1, 129, tIntParams, tFloatParams)"
What's the problem?

allen0413
Posts: 7
Joined: 05 May 2020, 10:43

Re: Error message from sim.convexDecompose

Post by allen0413 »

Or is there anyway to simply just skip the error?

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

Re: Error message from sim.convexDecompose

Post by coppelia »

Hello,

what CoppeliaSim version are you using? I can't reproduce your error.
To avoid errors triggering, you can do something like:

Code: Select all

function protectedFunc(a,b,c,d)
    convex = sim.convexDecompose(a,b,c,d)
    return convex
end

function sysCall_init()
    mike1 = sim.getObjectHandle('a')
    tIntParams = {0, 0, 0, 0, 0, 100000, 20, 4, 4, 64}
    tFloatParams = {0.0, 0.0, 0.0, 0.0, 0.0, 0.002, 0.05, 0.05, 0.001, 0.0001}
    local res,convex=pcall(protectedFunc,mike1, 129, tIntParams, tFloatParams)
    if res then
        -- success
    else
        -- Error happened in protectedFunc
    end
end
Cheers

Post Reply