# Repeated Cycle Pick and Place

**URL:** <https://forum.universal-robots.com/t/repeated-cycle-pick-and-place/28729>\
**Category:** General Application Help: How do I?\
**Created:** [May 31, 2023, 5:52pm UTC](https://forum.universal-robots.com/t/repeated-cycle-pick-and-place/28729 "2023-05-31T17:52:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon14633334](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@anon14633334](https://forum.universal-robots.com/u/anon14633334)\
**Post date:** [May 31, 2023, 5:52pm UTC](https://forum.universal-robots.com/t/repeated-cycle-pick-and-place/28729/1 "2023-05-31T17:52:14Z")

</div>

I am trying to set up a pick and place operation using 17 individual pick locations and then place them in a bin.  
It will pick 17 of our finished products, from set locations, and place them in a bin.

I currently have the program with the 17 points for picking and placing set, but I am having an issue with trying to figure out the logic to get it to go back to the first pick position (where it will start on another 17 pieces) after it places the last one from the previous cycle. I currently am using the variable “RollCnt” to count how many product rolls have been picked, and the variable waypoints are intended to be “If there are X rolls picked, use this point”. Currently it will work fine for 1-17, but then I cannot figure out how to get back to 1.

I initially considered doing this as a depalletizing operation before switching to the method listed above as since there are no layers the robot would actually have to adjust for and I didn’t believe variable waypoints could be used in the template, so would it be possible/easier to do a depalletizing operation but have repeated “layers” on a single plane?

---

<div class="post-metadata">

**Author:** ![eric.feldmann](https://avatars.discourse-cdn.com/v4/letter/e/94ad74/32.png) [@eric.feldmann](https://forum.universal-robots.com/u/eric.feldmann)\
**Post date:** [May 31, 2023, 7:02pm UTC](https://forum.universal-robots.com/t/repeated-cycle-pick-and-place/28729/2 "2023-05-31T19:02:50Z")

</div>

I mean can’t you just assign RollCnt back to 0 or whatever after it’s done 17?

Something clunkly like:

```auto
if(RollCnt > 17):
  RollCnt = 1
end

```

would get the job done I’d imagine.

---

<div class="post-metadata">

**Author:** ![anon14633334](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@anon14633334](https://forum.universal-robots.com/u/anon14633334)\
**Post date:** [May 31, 2023, 7:49pm UTC](https://forum.universal-robots.com/t/repeated-cycle-pick-and-place/28729/3 "2023-05-31T19:49:42Z")

</div>

I had tried to do that, but I was having a problem as the roll count was also our variable which was being used as our total count.

I ended up using a modulus operator and it is working now.
