Folding Sequences

Record and manage custom folding sequences for different garments

Learn how to record custom folding sequences using the 4-button interface

Understanding Folding Sequences

A folding sequence is a series of panel movements that fold a piece of clothing. Each sequence consists of multiple steps, where each step defines the position of all panels.

1. Position Garment

Place clothing flat on panels at home position

2. Record Steps

Manually position panels, save each step

3. Replay Sequence

Robot automatically folds using recorded positions

Recording Mode

Enter Configuration Mode

Configuration mode allows you to manually position panels and record their positions:

# Connect to Pico via REPL
mpremote

# Enter configuration mode
import sequence_manager
sm = sequence_manager.SequenceManager()
sm.enter_config_mode()

# Output:
>>> Configuration Mode Active
>>> LED will blink slowly
>>> Servos unlocked - you can move panels by hand
>>> Type 'sm.save_step()' to record each position

Note: In config mode, servos are disabled so you can move panels manually without resistance. The system reads servo positions after you move them.

Record a T-Shirt Folding Sequence

Let's record a simple 4-step sequence for folding a t-shirt:

1

Start Position (Home)

# Start new sequence
sm.new_sequence("tshirt_basic")

# Record home position
sm.save_step()
# Step 1 saved: All panels at 90°

Place t-shirt flat with arms extended

2

Fold Sides In

# Manually move panels 1 and 2 inward (to fold sleeves)
# Move them to approximately 45°

# Record this position
sm.save_step()
# Step 2 saved: Panels 1,2 at 45°, others at 90°

Side panels fold sleeves inward

3

Fold Bottom Up

# Move panel 3 (bottom) upward to 135°

# Record position
sm.save_step()
# Step 3 saved: Panels 1,2 at 45°, Panel 3 at 135°

Bottom panel folds lower half up

4

Fold Top Down

# Move panel 4 (top) downward to 135°

# Record final position
sm.save_step()
# Step 4 saved: Complete fold achieved

# Exit config mode
sm.exit_config_mode()
# Sequence saved to: /sequences/tshirt_basic.json

Top panel completes the fold

✓ Sequence Saved Successfully

Your sequence is now stored on the Pico and can be replayed anytime!

Playing Sequences

Load and Play a Sequence

# List available sequences
sm.list_sequences()
# Output: ['tshirt_basic', 'towel_fold', 'pants_fold']

# Load a sequence
sm.load_sequence("tshirt_basic")
# Sequence 'tshirt_basic' loaded (4 steps)

# Play the sequence
sm.play_sequence()

# The robot will:
# 1. Move to home position
# 2. Wait 3 seconds (for you to place garment)
# 3. Execute each step with smooth transitions
# 4. Return to home when complete

Playback Options

Speed Control

# Play at 50% speed (slower)
sm.play_sequence(speed=0.5)

# Play at 150% speed (faster)
sm.play_sequence(speed=1.5)

# Default speed
sm.play_sequence(speed=1.0)

Step-by-Step Mode

# Play one step at a time
sm.play_step(0)  # Execute step 1
# Wait for input...
sm.play_step(1)  # Execute step 2
# And so on...

Loop Mode

# Repeat 5 times
sm.play_sequence(repeat=5)

# Infinite loop (Ctrl+C to stop)
sm.play_sequence(repeat=-1)

Reverse Playback

# Unfold (play in reverse)
sm.play_sequence(reverse=True)

# Useful for removing clothing

Managing Sequences

Common Operations

List All Sequences

sequences = sm.list_sequences()
for seq in sequences:
    info = sm.get_sequence_info(seq)
    print(f"{seq}: {info['steps']} steps, {info['duration']}s")

Delete a Sequence

sm.delete_sequence("old_sequence")
# Sequence 'old_sequence' deleted

Rename a Sequence

sm.rename_sequence("tshirt_basic", "tshirt_v2")
# Sequence renamed to 'tshirt_v2'

Export/Import Sequences

# Export sequence to computer
mpremote cp :/sequences/tshirt_basic.json ./tshirt_basic.json

# Import sequence from computer
mpremote cp ./tshirt_basic.json :/sequences/

Example Folding Sequences

📱 T-Shirt (Basic)

  • Steps: 4
  • Duration: ~8 seconds
  • Panels: 4 required

Folds sleeves in, then folds in half twice. Results in compact rectangle.

🧣 Towel Fold

  • Steps: 3
  • Duration: ~6 seconds
  • Panels: 2-4 required

Simple thirds fold. Works for towels, blankets, and rectangular fabrics.

👖 Pants (Long Fold)

  • Steps: 5
  • Duration: ~10 seconds
  • Panels: 6-8 required

Folds legs together, then accordion-style. Requires extended panel configuration.

👕 Button-Down Shirt

  • Steps: 6
  • Duration: ~12 seconds
  • Panels: 4-6 required

Careful sleeve folding with button-side consideration. Results in retail-style fold.

📦 Download Pre-Made Sequences

Find community-contributed sequences on GitHub:

Browse Sequence Library →

Tips for Better Sequences

💡 Start Simple

Begin with 2-3 step sequences. Add complexity gradually as you understand the robot's capabilities.

📐 Consistent Placement

Always place garments in the same position relative to panels for repeatable results.

⚡ Test at Slow Speed

Use speed=0.5 when testing new sequences to catch issues before they cause problems.

🔄 Add Pauses

Include 0.5-1s delays between steps to let fabric settle and servos reach position.

Ready to Customize! 🎨

You now know how to record and play folding sequences. Next, learn how to customize your robot with additional panels, sensors, and features.