Re: Moving an Object with Lua Code
Posted: 01 Jun 2022, 08:24
Furthermore, I would like to just simply implement sim.movetoPose on its own - I wonder if it is possible. I would just like to initialize two poses like so
From examining how this works with the help of the API reference on the sim.movetoPose command, it seems like a lot of this needs to be changed...
How can I change this code in order to implement the command without the for-loop if it is possible?
Thanks In Advance.
Code: Select all
pose1 = {x,y,x,qx,qy,qz,qw}
pose2 = {x,y,x,qx,qy,qz,qw}
and implement smooth controlled motion simply just using sim.movetoPose without the need of the loop in the sample algorithm you sent me before as seen above...
for n=1,100 do
for i=1,#waypoints do
local from,to=waypoints[i],waypoints[i%4+1]
sim.moveToPose(-1,from,{0.8},{0.02},{0.01},to,function(currentPose,currentVel,currentAccel,auxData)
sim.setObjectPose(self,-1,currentPose)
end,nil,{1,1,1,0.1})
end
end
end
Code: Select all
sim.moveToPose(-1,from,{0.8},{0.02},{0.01},to,function(currentPose,currentVel,currentAccel,auxData)
sim.setObjectPose(self,-1,currentPose)
end,nil,{1,1,1,0.1})
Thanks In Advance.