use 'sim.moveToPose' to control two object move with different position
Posted: 28 Nov 2021, 08:00
Hello, I want to control two or more dummies to move along different direction and different distance at the same time. I read the instruction about the API function 'sim.moveToPose' , but it seems that this API function can not do this. Maybe Prismatic joints can do this, but I am preferring the 'sim.moveToPose'. Here is the simplified code:
Thanks for anyone who can help me.
Code: Select all
function callback(m,vel,accel,auxData)
sim.setObjectMatrix(auxData[1],auxData[2],m)
end
function moveToPose(obj,relObj,pos,euler,vel,accel)
local auxData={obj,relObj}
local mStart=sim.getObjectMatrix(obj,relObj)
local mGoal=sim.buildMatrix(pos,euler)
sim.moveToPose(-1,mStart,{vel},{accel},{0.1},mGoal,callback,auxData,{1,1,1,0.1})
end
--------------
initialP[3]=initialP[3]+0.03*sizeFactor_Z
moveToPose(dummyHandle1,antBase,initialP,initialO,vel_Z,accel)
moveToPose(dummyHandle2,antBase,initialP,initialO,vel_Z,accel)
moveToPose(dummyHandle3,antBase,initialP,initialO,vel_Z,accel)----three dummies can only move one by one rather than simultaneous, this is not what I want.