Saving a location within a loop

Hi, I’m programming a robot to be able to pick up parts, then show it to a set position and then it place the part back to where it picked it up from. (in polyscope 5)

The parts are in a tray that holds each part a set distance away from each other.

I wrote my program in a loop to allow for the robot to be able to do this for multiple of the parts by moving over by a distance of say 10 cm and then repeating the same loop. However, I am unsure as to how to code the robot within Polyscope to be able to place the part back down where it picked it up from at the end of the loop.

Is there a way to save a position in space the robot was in so that I can reference back to it within the same loop?
This is so that I can make the robot go back to that position within the loop so that the robot can place part back where it picked it up from

You can assign a variable the current position of the TCP (in the Base frame). You can find the script function in the dropdown menu in the expression editor when assigning a variable (get_actual_tcp_pos() ) as far as I remember). :slight_smile:
Then you can make a waypoint a Variable Type (upper right corner dropdown menu) and assign your variable to that waypoint.

1 Like

for the same project, I have a program in python that will take pictures of the part. Is there a way to plug in my cobot to python or somehow get it to send an signal to my computer to run my script in python?