# OffSet workobject Z with a digital input sensor

**URL:** <https://tech-community.robotics.abb.com/t/offset-workobject-z-with-a-digital-input-sensor/10641>\
**Category:** RAPID Programming\
**Created:** [March 15, 2022, 4:49pm UTC](https://tech-community.robotics.abb.com/t/offset-workobject-z-with-a-digital-input-sensor/10641 "2022-03-15T16:49:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ollitap](https://avatars.discourse-cdn.com/v4/letter/o/71c47a/32.png) [@ollitap](https://tech-community.robotics.abb.com/u/ollitap)\
**Post date:** [March 15, 2022, 4:49pm UTC](https://tech-community.robotics.abb.com/t/offset-workobject-z-with-a-digital-input-sensor/10641/1 "2022-03-15T16:49:33Z")

</div>

I have the same parts with variable heights. I am applying glue. I would like to use a simple digital input similar to what you would do using SearchL to offset the Z of my work object. I I know how to do offsets. I just want the robot to move down to the part establish the height, offset the Z and run the program.

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [March 15, 2022, 6:57pm UTC](https://tech-community.robotics.abb.com/t/offset-workobject-z-with-a-digital-input-sensor/10641/2 "2022-03-15T18:57:09Z")

</div>

So why not just use the SearchL?

---

<div class="post-metadata">

**Author:** ![ollitap](https://avatars.discourse-cdn.com/v4/letter/o/71c47a/32.png) [@ollitap](https://tech-community.robotics.abb.com/u/ollitap)\
**Post date:** [March 15, 2022, 7:02pm UTC](https://tech-community.robotics.abb.com/t/offset-workobject-z-with-a-digital-input-sensor/10641/3 "2022-03-15T19:02:12Z")

</div>

To the best of my knowledge having used SearchL in the past, SearchL will offset one robTarget. If I could use SearchL to establish my Z height and use it to do a pose offset, I would. If there is a way, I do not know how to do it.

Thank you

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [March 15, 2022, 7:15pm UTC](https://tech-community.robotics.abb.com/t/offset-workobject-z-with-a-digital-input-sensor/10641/4 "2022-03-15T19:15:06Z")

</div>

So you will have a baseline Z height, say the tallest part. SearchL until the part is found. The Search stores the found current position in a robtarget. Compare the Z value in the found robtarget to your baseline and shift the workobject oframe by the difference.

---

<div class="post-metadata">

**Author:** ![graemepaulin](https://avatars.discourse-cdn.com/v4/letter/g/258eb7/32.png) [@graemepaulin](https://tech-community.robotics.abb.com/u/graemepaulin)\
**Post date:** [March 15, 2022, 7:16pm UTC](https://tech-community.robotics.abb.com/t/offset-workobject-z-with-a-digital-input-sensor/10641/5 "2022-03-15T19:16:30Z")

</div>

From the Rapid manual to displace many moves:

SearchL \Stop, di1, sp, p10, v100, tool1;  
MoveL sp, v100, fine \Inpos := inpos50, tool1;  
PDispOn p10, tool1;  
MoveL p100, v100, z10, tool1;  
MoveL p110, v100, z10, tool1;  
MoveL p120, v100, z10, tool1;  
PDispOff;  
The TCP of tool1 is moved linearly towards the position p10.  
When the value of the signal di1 changes to active, the position is stored in sp.  
The robot is moved back to this point using an accurately defined stop point.  
Using program displacement (the difference between sp and p10) , the robot then moves relative to the searched position, sp.

---

<div class="post-metadata">

**Author:** ![ollitap](https://avatars.discourse-cdn.com/v4/letter/o/71c47a/32.png) [@ollitap](https://tech-community.robotics.abb.com/u/ollitap)\
**Post date:** [March 15, 2022, 7:43pm UTC](https://tech-community.robotics.abb.com/t/offset-workobject-z-with-a-digital-input-sensor/10641/6 "2022-03-15T19:43:36Z")

</div>

I will try it tomorrow 3-16-22. and thank you

---

<div class="post-metadata">

**Author:** ![ollitap](https://avatars.discourse-cdn.com/v4/letter/o/71c47a/32.png) [@ollitap](https://tech-community.robotics.abb.com/u/ollitap)\
**Post date:** [March 16, 2022, 9:44pm UTC](https://tech-community.robotics.abb.com/t/offset-workobject-z-with-a-digital-input-sensor/10641/7 "2022-03-16T21:44:27Z")

</div>

OKay, this is just a random mess that I made to test the the SearchL

LINE

1. MoveL MvToRS12, v2500, z200, GUN1\WObj:=R2\_CNTR;
2. SearchL\Stop, PosWarn1FromRob1, Temp1, PTP1\_1a10, v100, GUN1\WObj:=R2\_CNTR;
3. PDispOn PTP1\_1a10, gun1\WObj:=R2\_CNTR;
4. MoveL Temp1, v100, fine\Inpos:=inpos50, gun1\WObj:=R2\_CNTR;
5. MoveL Temp11, v100, fine, GUN1\WObj:=R2\_CNTR;
6. MoveL Temp21, v100, fine, GUN1\WObj:=R2\_CNTR;
7. MoveL Temp31, v100, fine, GUN1\WObj:=R2\_CNTR;
8. MoveL Temp41, v100, fine, GUN1\WObj:=R2\_CNTR;
9. PDispOff

Works fine. I noticed that I have 3 and 4 flip flopped compared to the manual. However, it works and I will flip them and try again just to test the results.  
Its on to the next thing.

Thank you for your input
