How to interact with robot through a laserpointer ?

Typically: "How do I... ", "How can I... " questions
Post Reply
jianye
Posts: 46
Joined: 16 Oct 2019, 13:58

How to interact with robot through a laserpointer ?

Post by jianye »

hello guys,

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
but this code didn't work.
any advice ?

thanks
Jian

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: How to interact with robot through a laserpointer ?

Post by coppelia »

Hello Jian,

the simplest would be to modify the existing laser pointer model (I suppose you used the one available in the model library?). In the child script attached to it, in the sensing section, simply focus on the first line:

Code: Select all

    res,dist,pt=sim.handleProximitySensor(sensor)
If res>0, then dist is the distance measured to the next obstacle. Otherwise nothing is detected.

If you are using ray-type proximity sensors, it is the same.

Cheers

jianye
Posts: 46
Joined: 16 Oct 2019, 13:58

Re: How to interact with robot through a laserpointer ?

Post by jianye »

hello,

thank you for the reply.(^-^)

I have used the code you mentioned. And now i can only use the change of distance to identify that the person go through the Safety Light Curtain. Only in this moment i can let the robot-arm to stop. But when the person entirely get in this area and the light of pointer is not interrupted. Then the robot-arm move again.

but i want to know how can i control the robot that , when the person stands in the safe area and robot-arm don't also move?

And the next step what i want is that the robot-arm will move again when the person entirely leave the safe area ?

Thanks again for your reply.
Jian

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: How to interact with robot through a laserpointer ?

Post by coppelia »

You will have to set-up a switch. But that will not be reliable, since counting detections might wrongly assume the person has gone in or come out (maybe turned around in mid-way).

Better would be to have a large sensor for the whole aera.

Cheers

Post Reply