stage1-6 remote API <<
Previous Next >> w13~w14
stage2-7 remote API
function sysCall_init()
corout=coroutine.create(coroutineMain)
end
function sysCall_actuation()
if coroutine.status(corout)~='dead' then
local ok,errorMsg=coroutine.resume(corout)
if errorMsg then
error(debug.traceback(corout,errorMsg),2)
end
end
end
function sysCall_cleanup()
-- do some clean-up here
end
function coroutineMain()
-- Put some initialization code here
-- Put your main loop here, e.g.:
--
-- while true do
-- local p=sim.getObjectPosition(objHandle,-1)
-- p[1]=p[1]+0.001
-- sim.setObjectPosition(objHandle,-1,p)
-- sim.switchThread() -- resume in next simulation step
-- end
end
-- See the user manual or the available code snippets for additional callback functions and details
-- Put some initialization code here:
sim.setThreadSwitchTiming(2) -- Default timing for automatic thread switching
-- Here we execute the regular thread code:
res,err=xpcall(threadFunction,function(err) return debug.traceback(err) end)
if not res then
sim.addStatusbarMessage('Lua runtime error: '..err)
end
-- Put some clean-up code here:
simRemoteApi.start(19999)
stage1-6 remote API <<
Previous Next >> w13~w14