Use of API InsertPathCtrlPoints

Typically: "How do I... ", "How can I... " questions
Post Reply
jsjannej
Posts: 2
Joined: 02 Feb 2021, 12:23

Use of API InsertPathCtrlPoints

Post by jsjannej »

Hello,

I have been developing an algorithm that would enable to define an area (for example with coordinate systems) and automatically do the pathing with spesific criteria to that area. Recently, I have been trying to create a path and add points to that path. Path creation was fine but I haven't been able to insert a single point to it. API script that I have been using is "sim.insertPathCtrlPoints" (Lua) and some argument is giving a type error and I do not know which. I have been trying a with most values at default values (which I got from https://www.coppeliarobotics.com/helpFi ... Export.htm) and just adding 1 point at the beginning.

Example:
sim.insertPathCtrlPoints(pathHandle, 2, 0, 1, 0.5, 0.250, 0.0, 0.0, 0.0, 90.0, 1.0, 1.0, 1, 0.5, 0.5, 0, 0.0, 0.0, 0.0, 0.0)

And it gives:
"One of the function's argument type is not correct. (in function 'sim.insertPathCtrlPoints')"

Can anyone figure out what parameter type I have set wrong or what could I try? There are a bit too many arguments to be just guessing the "wrong one"..

https://www.coppeliarobotics.com/helpFi ... Points.htm

Thank you in advance.

BR,
Janne

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

Re: Use of API InsertPathCtrlPoints

Post by coppelia »

Hello Janne,

please try with following:

Code: Select all

sim.insertPathCtrlPoints(pathHandle,2,0,1,{0.5, 0.250, 0.0, 0.0, 0.0, 90.0, 1.0, 1.0, 1, 0.5, 0.5, 0, 0.0, 0.0, 0.0, 0.0})
i.e. the last argument is a table.

Cheers

jsjannej
Posts: 2
Joined: 02 Feb 2021, 12:23

Re: Use of API InsertPathCtrlPoints

Post by jsjannej »

Hello,

That worked and now that I think about, it makes total sense.

Thanks a lot.

BR,
Janne

Post Reply