Programming Guide
This section covers everything you need to program robots with the raccoon SDK — from writing your first mission to tuning low-level motor controllers.
The Mental Model
raccoon is a layered framework. You write missions in Python using a high-level DSL; the control loops, kinematics, and hardware drivers run in compiled C++ underneath. You never need to write C++ to build a competition robot.
Three things you touch directly:
- YAML config (
raccoon.project.ymlandconfig/*.yml) — describes your hardware, drive geometry, and mission list. The CLI reads this and generates Python. - Mission files (
src/missions/*.py) — describe what the robot does, step by step. You own these entirely. - Custom step files (
src/steps/*.py) — reusable behaviors you package as functions or classes.
Two things the CLI generates for you — do not edit by hand:
src/hardware/defs.py— every motor, servo, and sensor as Python objectssrc/hardware/robot.py— theRobotclass with kinematics, drive, and odometry wired together
The YAML is the single source of truth for hardware. Change hardware in YAML, run raccoon run, and the generated files update automatically.
graph TD
A["Your Mission Code (Python)"] --> B["Step DSL"]
B --> C["Motion Controller"]
C --> D["Drive + Kinematics"]
D --> E["HAL (Hardware Abstraction)"]
E --> F["Wombat Platform Driver"]
F --> G["Motors / Servos / Sensors"]
style A fill:#4CAF50,color:#fff
style B fill:#66BB6A,color:#fff
style C fill:#42A5F5,color:#fff
style D fill:#42A5F5,color:#fff
style E fill:#AB47BC,color:#fff
style F fill:#AB47BC,color:#fff
style G fill:#FF7043,color:#fff
Suggested Reading Path
New to raccoon? Read in this order:
- Your First Robot Program — hands-on, no prerequisites
- Project Structure — understand what files do what
- Robot Definition — configure your specific hardware
- Missions — write real competition code
- Stop Conditions + Calibration — make it accurate
Want the full picture first? Read Architecture & Project Model and Architecture Overview before anything else.
Sections
| Page | What You’ll Learn |
|---|---|
| Architecture Overview | The full layer stack, how pieces connect |
| Your First Robot Program | Hands-on tutorial: drive, servos, sensors, first mission |
| Architecture & Project Model | Deep dive: layered stack, YAML→codegen→runtime, mission lifecycle |
| Project Structure | Files, folders, and configuration |
| Robot Definition | Declaring hardware, kinematics, and drive |
| Missions | Writing and sequencing missions |
| Synchronizing Two Robots | Multi-robot coordination over the network |
| Steps DSL | The motion/action building blocks |
| Stop Conditions | Combining conditions with OR, AND, THEN |
| Custom Steps | Writing your own reusable steps |
| Sensors | IR, analog, digital, and camera sensors |
| Drive System | Kinematics, velocity control, PID tuning |
| Odometry | Position tracking and heading reference |
| Servos | Servo control and presets |
| Motor Steps | Direct motor control for arms, conveyors, and mechanism actuators |
| Calibration | Motor and sensor calibration workflow |
| Advanced Topics | Async, timing, transport, debugging |
| UI Steps & Screens | Touchscreen UI, widgets, custom screens |
| Configuration Reference | Complete reference for every YAML configuration key |
| IMU | Inertial measurement unit integration and heading reference |
| Competition Ready | Checklist and tuning guide for competition day |
| Simulator And Testing | Running missions in the built-in simulator and writing pytest fixtures |
| Table Maps | Field map format, coordinate conventions, and IDE integration |
| YAML Includes | !include and !include-merge semantics and write-back behavior |
| Motion Flow and Kinematics | How motion profiles, drive control, kinematics, HAL, and firmware fit together |
| Arm Kinematics and Code Generation | The actual ArmChain pipeline: IK, servo mapping, guards, and runtime behavior |
| Smooth Path and Spline Motion | Continuous fluid motion across waypoints using smooth_path() and spline() |
| Localization and Resync | Particle-filter localization, drift correction, and resync step injection |
Deep Dives
| Page | What It Does |
|---|---|
| Line Following | PID-based edge tracking with profiled and directional variants |
| Lineup | Single-pass geometric line alignment |
| IR Sensor Calibration (K-Means) | Clustering-based threshold detection for IR sensors |
| Wait for Light | Kalman-filtered start lamp detection with test/arm workflow |