Cannot set initial velocity though Matlab API
Re: Cannot set initial velocity though Matlab API
Hello, I have the same problem as you. I want to use Python API to control the Velocity of an object. But it doesn't work. I want to know how do you solve your problem? Thanks~
Re: Cannot set initial velocity though Matlab API
Hello,
for instance, add a dynamically enabled sphere to the scene. Then attach a non-threaded child script to it with following content:
from an external application, use a function in the same child script, e.g.:
then correctly call above function with simxCallScriptFunction.
cheers
for instance, add a dynamically enabled sphere to the scene. Then attach a non-threaded child script to it with following content:
Code: Select all
function sysCall_init()
h=sim.getObjectAssociatedWithScript(sim.handle_self)
sim.setObjectFloatParameter(h,sim.shapefloatparam_init_ang_velocity_x,0.5)
end
Code: Select all
function setVelocity(inInts,inFloats,inStrings,inBuffer)
local h=inInts[1]
local vel=inFloats
sim.resetDynamicObject(h)
sim.setObjectFloatParameter(h,sim.shapefloatparam_init_ang_velocity_x,vel[1])
sim.setObjectFloatParameter(h,sim.shapefloatparam_init_ang_velocity_y,vel[2])
sim.setObjectFloatParameter(h,sim.shapefloatparam_init_ang_velocity_z,vel[3])
return {},{},{},''
end
cheers