# How to lift random weight at certain distance?

**URL:** <https://forum.universal-robots.com/t/how-to-lift-random-weight-at-certain-distance/41229>\
**Category:** General Application Help: How do I?\
**Created:** [September 22, 2025, 3:40pm UTC](https://forum.universal-robots.com/t/how-to-lift-random-weight-at-certain-distance/41229 "2025-09-22T15:40:40Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Ivory](https://avatars.discourse-cdn.com/v4/letter/i/b487fb/32.png) [@Ivory](https://forum.universal-robots.com/u/Ivory)\
**Post date:** [September 23, 2025, 2:54pm UTC](https://forum.universal-robots.com/t/how-to-lift-random-weight-at-certain-distance/41229/3 "2025-09-23T14:54:15Z")

</div>

Yes, this is to accommodate for the varying payloads. I did some digging around the forum for any other ideas and you came up with this code (link to topic: [Dynamic Payload setting in UR E series to pick the dynamic payload - #2 by sya](https://forum.universal-robots.com/t/dynamic-payload-setting-in-ur-e-series-to-pick-the-dynamic-payload/12130/2) )

```auto
Wait 0.2
zero_ftsensor()
Pick_Part
Wait 0.2
Var_1 = force()
Var_2 = Var_1/10 //Newton to kg
set_payload_mass(Var_2)

```

So I put that in my code to look something like this:

```auto
Before Start
Weight_Shift:= False
Wait 2.0
...
Robot Program
Weight_Shift:= False
MoveL
 First_Pose
 Above_Bin_1
 Trap_Handle
 Gripper Close
 Wait: 0.3
 Weight_Shift:= True
 Wait: 0.3
 Weigh_Bin
 Wait: 3.0
 Lift_Up
 Wait: 1.0
 Weight_Shift:= False
 ...

Thread_1
If Weight_Shift =? True
 zero_ftsensor()
 var_1:= force()
 var_2:= var_1/10
 set_payload_mass(var_2)
 sync()

 

```

I ran this in the simulator and it seems to work fine but there are no real life external forces acting on it so I’m a bit skeptical if I uploaded this to my Cobot. The idea is that the thread is monitoring the code and when Weight\_Shift goes to True, it will change the payload constantly until the variable is set to False again. Is this a bad approach? I don’t have much experience coding such large robots..

---

_[View the full topic](https://forum.universal-robots.com/t/how-to-lift-random-weight-at-certain-distance/41229)._
