Skip to content
Programming Robots

Overview


Your programs have moved game objects, responded to browser requests, and summarized measurements. A program can also control a robot: a machine with parts that move and interact with its surroundings. Here, you will explore those ideas through simulations.

We begin with a robot on a grid. Method calls move it to a destination or push a block into place. Loops and functions organize longer routes. A simulated car then introduces a setting that affects movement over time: its steering angle.

The arm simulation has two joints. Dictionaries describe its joint angles, and short movement routines transfer a token between prepared positions. You will then calculate a repeating target and use a finite loop to update it as simulated time advances. The final chapters introduce the SO101 arm through a supplied Python API. You will write a controller that combines guarded joint movements and gripper operations. The models and supporting code are supplied; you write the commands, calculations, functions, and methods that determine the behavior.

After working through this part, you should be able to write and explain short robot programs that combine commands, observations, joint positions, and timed movement.

The structure of this part is as follows:

Working with the Simulations

Predict the next position or action before running a short program. Compare the result with your prediction, and use print to inspect state records when the movement surprises you. Rerun edited programs from the same starting state when comparing them.

The browser examples and programming exercises supply everything needed to run the simulations. Complete the small notation exercises where they appear: each supplies a working Python program and asks for one small change before a larger task. Later exercises combine the commands with functions and loops you already know.

The LeRobot chapters do not currently have visual simulations. You can still run the supplied code and inspect the output, but you will not see a moving arm. The exercises are designed to be completed without a visual simulation.