# Robot has been moved

**URL:** <https://tech-community.robotics.abb.com/t/robot-has-been-moved/9174>\
**Category:** RAPID Programming\
**Created:** [October 29, 2019, 9:49am UTC](https://tech-community.robotics.abb.com/t/robot-has-been-moved/9174 "2019-10-29T09:49:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Greve](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@Martin\_Greve](https://tech-community.robotics.abb.com/u/Martin_Greve)\
**Post date:** [October 29, 2019, 9:49am UTC](https://tech-community.robotics.abb.com/t/robot-has-been-moved/9174/1 "2019-10-29T09:49:31Z")

</div>

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 … 😖

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 😃

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

---

<div class="post-metadata">

**Author:** ![jmf](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/jmf/32/762_2.png) [@jmf](https://tech-community.robotics.abb.com/u/jmf)\
**Post date:** [October 29, 2019, 10:32am UTC](https://tech-community.robotics.abb.com/t/robot-has-been-moved/9174/2 "2019-10-29T10:32:59Z")

</div>

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

Try this steps in the document.  
[World Zone.pdf](https://tech-community.robotics.abb.com/uploads/short-url/fhulVY0FTkRe4ohVlLVMKk2ES5M.pdf) (242 KB)

---

<div class="post-metadata">

**Author:** ![Martin\_Greve](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@Martin\_Greve](https://tech-community.robotics.abb.com/u/Martin_Greve)\
**Post date:** [October 29, 2019, 10:44am UTC](https://tech-community.robotics.abb.com/t/robot-has-been-moved/9174/3 "2019-10-29T10:44:42Z")

</div>

Unfortunately the robot is not equipped with the World Zone option.

---

<div class="post-metadata">

**Author:** ![jmf](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/jmf/32/762_2.png) [@jmf](https://tech-community.robotics.abb.com/u/jmf)\
**Post date:** [October 29, 2019, 1:02pm UTC](https://tech-community.robotics.abb.com/t/robot-has-been-moved/9174/4 "2019-10-29T13:02:27Z")

</div>

Can you supply your system type details?

Have you tried adding the option to your system?

---

<div class="post-metadata">

**Author:** ![Paba](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@Paba](https://tech-community.robotics.abb.com/u/Paba)\
**Post date:** [October 30, 2019, 8:09am UTC](https://tech-community.robotics.abb.com/t/robot-has-been-moved/9174/5 "2019-10-30T08:09:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Paba](https://avatars.discourse-cdn.com/v4/letter/p/a183cd/32.png) [@Paba](https://tech-community.robotics.abb.com/u/Paba)\
**Post date:** [October 30, 2019, 8:20am UTC](https://tech-community.robotics.abb.com/t/robot-has-been-moved/9174/6 "2019-10-30T08:20:49Z")

</div>

```auto
CheckHomePos;

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

```

Maybe something like this? please let me know if its a bad idea
