Get 1st position in Direction

Hello,

I have motions to drop parts to a location using Direction. I would like to keep track of the CurrentCount and stop the stacking when it reaches 10. How do I grab the info of when the TCP is on the very bottom currently dropping the 1st part? My concern is if something happen, I want to keep track of the currentcount so that the operator does not have to clear the surface if anything happens and if they restart the program.

Thank you for checking

var_1=get_actual_tcp_pose()
tcp_z = var_1[2]
if (tcp_z < YOUR_VALUE)
{
  //TCP is identified as being "at the bottom" so do something
}

Here’s the pseudocode for reading TCP values. By extracting just the Z component, you can tell when the TCP is below a certain threshhold. That said, I’m not seeing why you can’t just make a variable and increment it after each cycle and just check if that var == 10, but you do you.

1 Like

Thank you Eric. The reason I wanted to track when the TCP is on the very bottom is to make sure that I can reset a variable if for some reason the stack was moved even if the stack hasn’t reached 10 pcs. But if you’re able to come up with a much less complicated solution I’d like to see it. I am so new to this, my apologies
Thank you so much.

Nope that sounds like a perfectly good reason to do it this way. If a human can come in and “disrupt” normal flow, this is a great way to account for that. Alternatively you could not care about keeping a count at all, and just look at the TCP’s z coordinate to be at the 10-piece-height. So basically just “do work until the last drop point was THIS high.” Either way would work I imagine

1 Like

It sounds like you can just add another “Until” to your Direction with a Distance. :slight_smile: You can then add an Action to that Distance, where you can reset your counter.

1 Like

Wow! Didn’t realize this. Thank you so much!