CrackRobotics

You haven't finished Step 1: Joints, targets & PD control yet. This step builds on it.

Step 5

Clear the table

Generalise your program: perceive every ball, pick each one, verify, retry, and survive a new layout on every run.

From a script to a skill

Step 4's program only worked for one ball at one position. Real robots face a new scene every time, so this step reshuffles the balls on every run. Hard-coded coordinates won't survive.

Robust manipulation code follows a loop that roboticists call sense → plan → act → verify:

  1. Sense: ask the world where things are (world.balls()).
  2. Plan: compute the pre-grasp, grasp and place poses from those measurements.
  3. Act: run the phases.
  4. Verify: did gripper.close() return True? If not, back off, re-sense (the ball may have been nudged) and try again, up to a limit.

Wrap Step 4 in a function:

def pick_and_place(name) -> bool:
    ...

Then call it for each ball.

Stacking

The cup fills up. Three balls fit on the floor and the fourth sits on top, so release a little higher than before. That way a new ball never lands on a finger.

Your task

Get all four balls into the cup. For a bonus, drop them in rainbow order: red, yellow, green, blue.

The layout changes on every run, so press Run a few times to make sure your program really generalises.

Goals

  • Program runs without errors
  • All four balls are in the cup
  • Gripper released the ball
  • Bonus: dropped in rainbow order (red → yellow → green → blue)
Loading physics…
Loading 3D view…
0.0 / 0.0 s

Python is loading. It takes a few seconds the first time.