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

#SectionYou learn
1BasicsThe concept of raccoon, project and config structure, code generation, run configurations, missions, seq, parallel and background, wait_for_* steps, wait for light
2Drivingdrive, turn, arcs, strafing on mecanum, until conditions, absolute heading, line following, lineups, optimizing paths, wall alignment
3ActorsServos (config, offsets, positions, steps) and motors (chassis versus aux motors, config, steps)
4Sensorshardware.yml, IR sensors, sensor groups, buttons, analog and ET sensors
5CalibrationMaking the robot drive accurately and the IR sensors read reliably
6CameraThe camera service raccoon-cam: client API, backends and processors (work in progress)
7Custom StepsWriting 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

Written by Mario Scholze