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:

  1. YAML config (raccoon.project.yml and config/*.yml) — describes your hardware, drive geometry, and mission list. The CLI reads this and generates Python.
  2. Mission files (src/missions/*.py) — describe what the robot does, step by step. You own these entirely.
  3. 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 objects
  • src/hardware/robot.py — the Robot class 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:

  1. Your First Robot Program — hands-on, no prerequisites
  2. Project Structure — understand what files do what
  3. Robot Definition — configure your specific hardware
  4. Missions — write real competition code
  5. Stop Conditions + Calibration — make it accurate

Want the full picture first? Read Architecture & Project Model and Architecture Overview before anything else.

Sections

PageWhat You’ll Learn
Architecture OverviewThe full layer stack, how pieces connect
Your First Robot ProgramHands-on tutorial: drive, servos, sensors, first mission
Architecture & Project ModelDeep dive: layered stack, YAML→codegen→runtime, mission lifecycle
Project StructureFiles, folders, and configuration
Robot DefinitionDeclaring hardware, kinematics, and drive
MissionsWriting and sequencing missions
Synchronizing Two RobotsMulti-robot coordination over the network
Steps DSLThe motion/action building blocks
Stop ConditionsCombining conditions with OR, AND, THEN
Custom StepsWriting your own reusable steps
SensorsIR, analog, digital, and camera sensors
Drive SystemKinematics, velocity control, PID tuning
OdometryPosition tracking and heading reference
ServosServo control and presets
Motor StepsDirect motor control for arms, conveyors, and mechanism actuators
CalibrationMotor and sensor calibration workflow
Advanced TopicsAsync, timing, transport, debugging
UI Steps & ScreensTouchscreen UI, widgets, custom screens
Configuration ReferenceComplete reference for every YAML configuration key
IMUInertial measurement unit integration and heading reference
Competition ReadyChecklist and tuning guide for competition day
Simulator And TestingRunning missions in the built-in simulator and writing pytest fixtures
Table MapsField map format, coordinate conventions, and IDE integration
YAML Includes!include and !include-merge semantics and write-back behavior
Motion Flow and KinematicsHow motion profiles, drive control, kinematics, HAL, and firmware fit together
Arm Kinematics and Code GenerationThe actual ArmChain pipeline: IK, servo mapping, guards, and runtime behavior
Smooth Path and Spline MotionContinuous fluid motion across waypoints using smooth_path() and spline()
Localization and ResyncParticle-filter localization, drift correction, and resync step injection

Deep Dives

PageWhat It Does
Line FollowingPID-based edge tracking with profiled and directional variants
LineupSingle-pass geometric line alignment
IR Sensor Calibration (K-Means)Clustering-based threshold detection for IR sensors
Wait for LightKalman-filtered start lamp detection with test/arm workflow