ich have built a Safety Light Curtain modell with laserpointer.
And the work situation is described as follows:
1 if the worker walks through the laserpointer, then the robot should stop.
2 And at the same time when the worker in the area of Safety Light Curtain and the light is not interrupted by the worker, the robot keep the stopped Status,
3 and when the worker finished the job and go through the Safety Light Curtain again and the robot moved again.
but i use the function
sim.handleProximitySensor()
to get the data of distance. The code is listed as follows:
Code: Select all
function sysCall_actuation()
--local scannerData=sim.getStringSignal("measuredDataAtThisTime")
--local activateStatus = false
for i=1,zCnt,1 do
res={}
distance={}
pt={}
res,distance,pt=sim.handleProximitySensor(sensor_pointer[i])
end
if distance <0.9 then
counter=counter+1
end
if distance < 0.9 then
sim.setStringSignal("SafetyStop","1")
elseif counter%2 ~= 0 then
sim.setStringSignal("SafetyStop","0")
else
sim.setStringSignal("SafetyStop","1")
end
end
any advice ?
thanks
Jian