Team 5113's code for Perry, our retired competition bot. Perry's code is written in Python and is based on Robotpy's TimedRobot control system with an order-independent robot architecture for readability.
- Full control over execution - no architecture-based restrictions, so the user has complete flexilibity
- Simplicity - programming with TimedRobot is dead simple, making it easy to reason about and debug
- Predictability - nothing happens unless you make it happen
- Framework minimalism - avoids hidden schedulers and implicit behavior
| Principle | Description |
|---|---|
| Order independence | Loop execution order does not affect behavior. Each file handles its logic independently. |
| Definite state | The bot is fully controlled by states to prevent unintended actions. |
| Clear ownership | Every file or package has one job. For example, 'Arm' controls the arm, and nothing else. |
| Public APIs only | Components interact only via defined interfaces. No components peek at motors or sensors directly. |
| Explicit over implicit | Units are clearly specified (meters, radians, percent output) to avoid error. |
| Comments | Public methods include docstrings explaining each function / reasoning. |
- Initializes all components of the program and controls overall program flow.
- Contains only highest-level robot control logic.
- Robot loops are order-independent, so sequence doesn’t matter.
- Coordinates simulation updates across all simulated components.
- Changes to real robot behavior are mirrored here for accurate testing.
- Holds all controller input logic and executes behavior based on it.
- Defines high-level robot behaviors as finite state machines (FSMs).
- Each control manages exactly one active behavior per loop via an enum.
- Controls interact with components exclusively through public APIs.
- Manages low-level ("dumb") hardware interfaces: motors, sensors, encoders, etc.
- Provides clean methods for reading state and issuing commands.
- Stores hardware constants, PID/FF values, robot info, deadbands, and more.
- Centralizes configuration to avoid magic numbers.
- Contains general-purpose helper functions and shared utilities.
- Provides reusable logic that does not belong to a specific robot subsystem.
- Contains all simulated components and virtual hardware.
- Updates the real component objects for ease of testing.
- Simulated values should typically be accessed via the real objects themselves.
- Contains all autonomous routines for the robot.
- Each section follows an abstract base class pattern.
manager.py– Orchestrates autonomous routines as commanded by robot.py.routines/– Contains all autonomous routines, each composed of a sequence of steps.steps/– Contains individual, low-level tasks for specific robot components.
- Includes unit tests and built-in checks for validating robot code behavior.
Python 3.11.x
All Python dependencies are listed in:
requirements.txt
robotpy test
robotpy sim
robotpy deploy
This style is for teams who:
- Prefer full control over execution order
- Prefer explicit state machines over command schedulers
- Value clarity and debuggability over abstraction
- Are willing to enforce structural discipline
- Want code that is understandable for new members
| Command-based | TimedRobot |
|---|---|
| Scheduler | No scheduler. robot.py must update all components. |
| Implicit behavior | Explicit behavior. You can see everything happening in your program - no behind the scenes. This alone significantly improves debuggibility and readability. |
| Structure requirements | Fully dynamic. You can structure your programs however you want. It's up to you to maintain good structure. |
- This repository is both comp-ready code and a teaching reference.
- The best way to understand the flow is to look at the actual program - it's an example in itself.
- Reduce confusing bugs caused by implicit schedulers.
- Onboard new members faster from transparent code flow.
- Maintain long-term code quality across multiple seasons.
Thank you for reading through this repository. This takes a lot of time, so I'd love if you could share this with others or give feedback on it.
# Perry - FRC 5113 Robot Code
# Copyright (c) 2026 Jacob Taylor (igowu) <https://github.com/igowuu>
#
# Licensed under the MIT License.
# See https://opensource.org/licenses/MIT for details.