Tuff

Tutorial tinkerer about 35 min

Teach Mode and Poses

Program the arm with your hands: record poses in free-drive, replay them, and save a routine to disk.

The fastest motion planner in your house is your own hand. Teach mode releases the arm's servos just enough that you can move it freely, then records any pose you like. String a few poses together and you have a routine — no coordinates, no math, no guessing.

Enter teach mode

With the arm connected and homed, drop it into free-drive:

import tuff

arm = tuff.Arm.connect("auto")
arm.home()

with arm.teach() as t:
    input("Move the arm over the pencil cup, then press Enter... ")
    t.record("over_cup")
    input("Now touch the tip down inside the cup, press Enter... ")
    t.record("in_cup")
    input("Lift it somewhere out of the way, press Enter... ")
    t.record("rest")

Inside the with block the arm is compliant — it holds its own weight but follows your hand. Each record() call snapshots every joint angle under a name. Leaving the block re-engages the servos and holds the last pose.

Replay what you taught

Recorded poses become destinations for goto_pose():

arm.goto_pose("over_cup")
arm.goto_pose("in_cup", speed=0.3)   # slower for the delicate bit
arm.goto_pose("rest")

speed is a fraction of the arm's maximum, and it applies to the whole move. The arm interpolates all joints together, so motion between poses is one smooth gesture rather than a joint-by-joint robot shuffle.

Save the routine

Poses live in the arm's session until you write them out:

arm.poses.save("pencil_routine.toml")
# pencil_routine.toml — generated by tuff 0.9
[over_cup]
joints = [42.5, 18.0, 96.3, -12.1]

[in_cup]
joints = [42.5, 44.7, 121.9, -12.1]

The file is plain TOML on purpose. You can read it, diff it, tweak an angle by half a degree in a text editor, and load it back next session with arm.poses.load("pencil_routine.toml").

Teach mode is how most real Tuff projects begin: rough in the motion by hand, refine the numbers later. You will use it again in Pick and Place, where the gripper joins in.