|
| 1 | +#!/usr/bin/env python3 |
| 2 | +""" |
| 3 | +Demo 2: Complete pick-and-place cycle |
| 4 | +
|
| 5 | +Full cycle: |
| 6 | + 1. Pick object from pick location |
| 7 | + 2. Place it at place location |
| 8 | + 3. Return home |
| 9 | + 4. Pick it back up from place location |
| 10 | + 5. Bring it back to original pick location |
| 11 | +
|
| 12 | +Shows the proper approach pattern with Z offsets to avoid collisions. |
| 13 | +""" |
| 14 | + |
| 15 | +from urkit import URRobot |
| 16 | + |
| 17 | +robot = URRobot.from_config("config.yaml") |
| 18 | +robot.gripper.activate() |
| 19 | + |
| 20 | +print("Moving to home...") |
| 21 | +robot.move_to("home") |
| 22 | + |
| 23 | +# --- PICK --- |
| 24 | +print("\n--- PICK ---") |
| 25 | +print("Approaching pick (5cm above)...") |
| 26 | +robot.move_to("pick", offset_z=0.05) |
| 27 | + |
| 28 | +print("At pick position...") |
| 29 | +robot.move_to("pick") |
| 30 | + |
| 31 | +print("Closing gripper...") |
| 32 | +robot.gripper.close() |
| 33 | + |
| 34 | +print("Retracting...") |
| 35 | +robot.move_to("pick", offset_z=0.05) |
| 36 | + |
| 37 | +# --- PLACE --- |
| 38 | +print("\n--- PLACE ---") |
| 39 | +print("Approaching place (5cm above)...") |
| 40 | +robot.move_to("place", offset_z=0.05) |
| 41 | + |
| 42 | +print("At place position...") |
| 43 | +robot.move_to("place") |
| 44 | + |
| 45 | +print("Opening gripper...") |
| 46 | +robot.gripper.open() |
| 47 | + |
| 48 | +print("Retracting...") |
| 49 | +robot.move_to("place", offset_z=0.05) |
| 50 | + |
| 51 | +# --- RETURN HOME --- |
| 52 | +print("\nMoving to home...") |
| 53 | +robot.move_to("home") |
| 54 | + |
| 55 | +# --- PICK BACK UP --- |
| 56 | +print("\n--- PICK BACK UP ---") |
| 57 | +print("Approaching place (5cm above)...") |
| 58 | +robot.move_to("place", offset_z=0.05) |
| 59 | + |
| 60 | +print("At pick position...") |
| 61 | +robot.move_to("place") |
| 62 | + |
| 63 | +print("Closing gripper...") |
| 64 | +robot.gripper.close() |
| 65 | + |
| 66 | +print("Retracting...") |
| 67 | +robot.move_to("place", offset_z=0.05) |
| 68 | + |
| 69 | +# --- BRING BACK --- |
| 70 | +print("\n--- BRING BACK ---") |
| 71 | +print("Approaching pick (5cm above)...") |
| 72 | +robot.move_to("pick", offset_z=0.05) |
| 73 | + |
| 74 | +print("At place position...") |
| 75 | +robot.move_to("pick") |
| 76 | + |
| 77 | +print("Opening gripper...") |
| 78 | +robot.gripper.open() |
| 79 | + |
| 80 | +print("Retracting...") |
| 81 | +robot.move_to("pick", offset_z=0.05) |
| 82 | + |
| 83 | +# --- DONE --- |
| 84 | +print("\nMoving to home...") |
| 85 | +robot.move_to("home") |
| 86 | + |
| 87 | +print("\nDone! Full cycle complete.") |
0 commit comments