Contributing
How to add a recipe or training page, write math, and build interactive components.
The site is built with Fumadocs on Next.js and published to GitHub Pages on every push to main. Pages are MDX: Markdown that can also contain React components.
Run it locally
You need Node 24 or newer and pnpm.
pnpm install
pnpm dev # http://localhost:3000, reloads as you edit
pnpm lint # eslint + type-check
pnpm build # static site in out/Add a page
-
Create an
.mdxfile undercontent/docs/. Folders become sidebar groups, and the file path becomes the URL:content/docs/training/hunt-woozle.mdxis served at/docs/training/hunt-woozle. -
Start it with frontmatter:
--- title: How to hunt a Woozle description: A practical guide on hunting and nearly catching a Woozle or... two. --- -
Add the page to the folder's
meta.jsonso it appears where you want it in the sidebar. Pages not listed there are appended at the end.
Use ## for top-level sections. The page title is already the # heading. Link to other pages with absolute paths such as /docs/guides/ctre/voltage#23-arm-position.
Callouts, cards, and tabs
Fumadocs components are available in every page without an import:
<Callout type="warn" title="Check the zero first">
A wrong encoder zero skews kG in either direction.
</Callout>
<Cards>
<Card title="Voltage Control" href="/docs/guides/ctre/voltage" description="Tuning in Volts." />
</Cards>Tuning procedures
Wrap the body of every tuning procedure in <Procedure>, and keep its heading outside so links to it keep working:
### 2.3.5 Tuning Procedure
<Procedure mechanism="Arm" mode="voltage">
1. **Set the zero.** ...
2. **Set `StaticFeedforwardSign`.** ...
</Procedure>mode is voltage (teal panel) or torque (violet panel). Leave it out for procedures that apply to both. Leave a blank line after the opening tag and before the closing one, or the Markdown inside won't render. Steps keep counting across a display equation, so a list interrupted by $$...$$ doesn't restart at 1. Keep interactive widgets outside the panel.
Mechanism procedures are also listed in lib/procedures.ts, which builds the Tuning Procedures index and the jump links under each mechanism heading (<ProcedureLinks mechanism="Arm" mode="voltage" />). Update it when you add or rename a procedure heading. Every panel gets a Print button automatically, and <PrintProcedures /> adds a button that prints every procedure on the page.
Math
Write LaTeX between $...$ for inline math and $$...$$ on their own lines for display math:
Torque is $\tau = k_t \cdot I$, so:
$$
\tau = \frac{k_t}{R}\,(V - k_e \cdot \omega)
$$Use plain LaTeX (\,, \_). The doubled backslashes needed for GitHub's Markdown renderer are not needed here.
MDX gotchas
Outside code and math, < starts a component and { starts a JavaScript expression. Write "less than" or use
<, and keep braces inside math or code.
Interactive components
Interactive widgets live in components/interactive/. The current set:
| Component | Used on | What it teaches |
|---|---|---|
ExpoExplorer | Motion Magic Expo | How Expo_kV and Expo_kA shape the profile, and where a trapezoid outruns the motor |
MotorCurves | Motor Constants, Torque-Current Control | How back-EMF and the stator current limit set the available current at each speed, and the supply current it draws |
GravityCalculator | Voltage Control, Torque-Current Control | kG and kA from arm or elevator geometry, in Volts and Amps |
BracketingSimulator | Torque-Current Control | Finding kG and kS with the bracketing test |
TuningSandbox | Torque-Current Control | Why torque mode needs kD, and where kD meets the latency limit |
OdometryDrift | Why Vision | How odometry drifts, and how vision measurements pull a fused estimate back |
RelativeVsGlobal | Relative vs. Global Positioning | Bias and spread of relative and global positioning when a tag is off its layout position, on a top-down scene with a zoomed view of the scoring point |
PinholeExplorer | Pose Estimation | How a tag projects into the image, and the second solution of a single-tag solve |
PoseScatter | Pose Estimation | How corner noise spreads the solved pose, for one or two tags, with and without gyro heading. Top-down scene of the camera and tags, with a zoomed inset |
DistortionGrid | Camera Calibration | What radial distortion does to straight lines |
CalibrationError | Camera Calibration | Pose error from wrong focal length, principal point, or ignored distortion. Top-down view of the true and estimated robot as it drives toward a tag |
OdometryIntegration | Localization Basics | Odometry error from integrating with the start heading or the pose exponential, at different update rates. Animated top-down view of the true robot and each estimate, with errors drawn to scale or ×10 |
KalmanFilter1D | Kalman Filters | How a Kalman filter's gain and ±2σ band change with noise, measurement rate, and a gap in tags |
EstimatorGain | WPILib Pose Estimators | WPILib's fixed gain next to a Kalman filter: noise, measurement rate, and recovery from a shove |
FactorGraphSmoother | Factor Graphs and GTSAM | A Kalman filter, a live smoother, and the hindsight trajectory, with robust losses, bad measurements, a gate, and a shove |
SwerveKinematics | Swerve Kinematics | Module speeds and angles from a chassis velocity, field- or robot-relative, with the center of rotation, desaturation, and the path the robot drives |
SwerveSkew | Swerve Kinematics | How holding a command for a whole loop while spinning drives the robot off course, and how discretization fixes it, with an animated top-down view |
SwerveGearing | Speed, Acceleration, and Traction | How drive ratio, wheel size, mass, tread grip, and the stator current limit set top speed, acceleration, and slip current |
SuperstructureMoves | The Superstructure | Why an elevator and an arm must be sequenced: moving both at once, one at a time, or with an interlock, on an animated side view with the 2025 reef heights |
DetectionPlayground | Pipeline Playground | A color pipeline and a simulated neural network detector run on a ray-traced camera image, stage by stage: lighting and exposure, HSV thresholds, morphology, blob filters, model input size, confidence and NMS thresholds, and the angle and distance to the chosen target |
HallHoming | Limit Switches and Hall Effect Sensors | How a hall effect sensor's window and the motor's absolute rotor angle together give a turret's exact angle, and why the window must be narrower than one rotor turn of turret travel |
CrtTurret | Two Encoders and the CRT | Solving a turret's angle from two encoders on pinions with different tooth counts: the candidates from encoder A, how far encoder B misses each, the unique range, and what happens as the encoders disagree |
RollingShutter | Camera Calibration | A tag captured by a rolling or global shutter while the robot turns or drives, with the skew, blur, and pose errors that follow |
Static diagrams that are not interactive live in components/diagrams/ (for example FrameChain and AprilTagAnatomy on the Vision pages, FactorGraphDiagram on the Factor Graphs page, RobotLayouts and MechanismTypes on the Robot Mechanisms pages, DetectionPipelineDiagram and GroundRangeDiagram on the Object Detection pages, HomingStrategies, LimitMargins, and EncoderWrap on the Homing and Zeroing pages, and DrivetrainComparison and DrivetrainLayout on the Swerve Drive pages). They are server components, drawn as inline SVG with the same theme tokens. A diagram can also use an image from public/images/, as MK3Drawing does with the vendor's layout drawing. Prefix its path with NEXT_PUBLIC_BASE_PATH, and give line drawings a transparent background with dark:invert so they work in both themes.
To add a new one:
- Create
components/interactive/my-widget.tsx, starting with"use client". - Build it from the shared parts in
controls.tsx(Widget,Slider,Segmented,Readout) andplot.tsx(LinePlot), so every widget looks the same. - Take motor numbers from
lib/motors.tsinstead of repeating them. It holds the Kraken constants used across the guide. - Put any simulation in a pure function under
lib/(seelib/turret-sim.tsorlib/vision.ts), separate from the React code, so it can be checked on its own. - Use theme colors only:
fd-*Tailwind tokens for UI, andvar(--color-plot-*)(defined inapp/global.css) for plot lines, so light and dark mode both work. - Register it in the
widgetslist incomponents/mdx.tsx, then use it in any page as<MyWidget />. The list wraps each widget so the Reset button in its header restores the defaults. Reset remounts the widget, so keep all its state inuseStateanduseRefinside the component.
Keep each widget focused on one idea, give it defaults that match an example in the text, and say what the model leaves out (friction, current limits, and so on).