RobotStudio event

Robot has been moved

Martin_Greve
edited October 2019 in RAPID Programming
Hello,

I have a small robot setup with an IRB140. 

I would like to be able to check if the robot is in the home position, in the rapid code.
If the robot is not in the home pos, the robot should reset, and run to the home pos.

The problem is that sometimes the operator for some reason will go in to the robot, push the release brake button and move the robot manually. We have tried telling them that they shouldn't do this, but they keep doing it .......  :confounded:  

I have attached the code I use right now. it works actually really great.

But if they move the robot after the this program have been run once, the "pndo4_Resat" will be 1, and therefore it wont run the routine again.

BTW i'm pretty new to programming, and if this way of doing it, is totally wrong, please let me know  :smiley:

Thanks in advanced.

Martin Greve




        IF pndo4_Resat=0 THEN
            SR7_ResetRoutine;
        ENDIF




    PROC SR7_ResetRoutine()
        pCurrentRobotPos_01:=CJointT();
        MotionSup\On\TuneValue:=250;
        pRobotResetTarget:=CRobT(\Tool:=Gripper\WObj:=wobj0);

        IF pCurrentRobotPos_01.robax.rax_5<-10 THEN
            pRobotResetTarget.trans.x:=550;
            MoveL pRobotResetTarget,vVerySlow,fine,Gripper\WObj:=wobj0;
            MoveJ p00Home,vVerySlow,fine,Gripper\WObj:=Conveyor;
            IF nGripperFull=1 THEN
                SR6_Reset_Dropoff;
            ENDIF
            nGripperFull:=0;
            SetDO pndo4_Resat,1;
        ELSE
            pRobotResetTarget.trans.z:=300;
            MoveL pRobotResetTarget,vVerySlow,fine,Gripper\WObj:=wobj0;
            MoveJ p00Home,vVerySlow,fine,Gripper\WObj:=Conveyor;
            IF nGripperFull=1 THEN
                SR6_Reset_Dropoff;
            ENDIF
            nGripperFull:=0;
            SetDO pndo4_Resat,1;

        ENDIF
        MotionSup\On\TuneValue:=150;
        Stop;
    ENDPROC



Martin Greve
Denmark

Comments

  • Create a Event Routine which is linked to a world zone (specifically HomeJointWZ).

    Try this steps in the document.


  • Unfortunately the robot is not equipped with the World Zone option.  
    Martin Greve
    Denmark
  • Can you supply your system type details?

    Have you tried adding the option to your system?
  • I'm also new in programming and dont know if its clever, but you could compare current x,y,z coordinates with excepted coordinates in home position ? or compare joint angles with a defined tolerance
  • Paba
    Paba
    edited October 2019

    <code> Abs(tempJoints.rax_2-homePos.rax_2)>10 OR ...<br> !reset robot and move home<br> Else !already in home position<br> ENDIF<br>ENDPROC<br>CheckHomePos;<br><br>PROC CheckHomePos()<br> var jointtarget tempJoints;<br> tempJoints:=CJointT();<br> IF Abs(tempJoints.rax_1-homePos.rax_1)>10 OR

    Maybe something like this? please let me know if its a bad idea
    Post edited by Paba on