Programming Guide
This guide teaches you how to program a robot with raccoon-lib. It follows the order in which a new team usually needs things: first how a project is built and run, then driving, the things that move (servos and motors), sensors, calibration, the camera, and finally how to write your own steps.
You write missions: Python classes whose sequence() describes step by step what the robot does. The library takes care of kinematics, PID control, odometry and talking to the hardware.
from raccoon import *
class M010DriveToZone(Mission):
def sequence(self) -> Sequential:
return seq([
drive_forward(cm=40),
turn_right(degrees=90),
drive_forward().until(on_black(Defs.front.left)),
])
New here? Finish Getting Started first. You need a running project and a connected robot to try anything in this guide. The exact signature of every step is in the Steps Reference .
The learning path
| # | Section | You learn |
|---|---|---|
| 1 | Basics | The concept of raccoon, project and config structure, code generation, run configurations, missions, seq, parallel and background, wait_for_* steps, wait for light |
| 2 | Driving | drive, turn, arcs, strafing on mecanum, until conditions, absolute heading, line following, lineups, optimizing paths, wall alignment |
| 3 | Actors | Servos (config, offsets, positions, steps) and motors (chassis versus aux motors, config, steps) |
| 4 | Sensors | hardware.yml, IR sensors, sensor groups, buttons, analog and ET sensors |
| 5 | Calibration | Making the robot drive accurately and the IR sensors read reliably |
| 6 | Camera | The camera service raccoon-cam: client API, backends and processors (work in progress) |
| 7 | Custom Steps | Writing your own steps with run, defer and step classes |
IMU, localization, table maps, arm kinematics, UI steps, the simulator, two robots and the competition checklist are in Advanced .
Where things live
- Concepts and architecture: How Raccoon works
explains the project model,
Defsand the mission lifecycle. The full layer diagram is in Advanced → Architecture . - Command line tools: Raccoon CLI and the visual WebIDE .
- Every step with its signature: Steps Reference .