2702 Recipes

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

  1. Create an .mdx file under content/docs/. Folders become sidebar groups, and the file path becomes the URL: content/docs/training/hunt-woozle.mdx is served at /docs/training/hunt-woozle.

  2. Start it with frontmatter:

    ---
    title: How to hunt a Woozle
    description: A practical guide on hunting and nearly catching a Woozle or... two.
    ---
  3. Add the page to the folder's meta.json so 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 &lt;, and keep braces inside math or code.

Interactive components

Interactive widgets live in components/interactive/. The current set:

ComponentUsed onWhat it teaches
ExpoExplorerMotion Magic ExpoHow Expo_kV and Expo_kA shape the profile, and where a trapezoid outruns the motor
MotorCurvesMotor Constants, Torque-Current ControlHow back-EMF and the stator current limit set the available current at each speed, and the supply current it draws
GravityCalculatorVoltage Control, Torque-Current ControlkG and kA from arm or elevator geometry, in Volts and Amps
BracketingSimulatorTorque-Current ControlFinding kG and kS with the bracketing test
TuningSandboxTorque-Current ControlWhy torque mode needs kD, and where kD meets the latency limit
OdometryDriftWhy VisionHow odometry drifts, and how vision measurements pull a fused estimate back
RelativeVsGlobalRelative vs. Global PositioningBias 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
PinholeExplorerPose EstimationHow a tag projects into the image, and the second solution of a single-tag solve
PoseScatterPose EstimationHow 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
DistortionGridCamera CalibrationWhat radial distortion does to straight lines
CalibrationErrorCamera CalibrationPose 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
OdometryIntegrationLocalization BasicsOdometry 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
KalmanFilter1DKalman FiltersHow a Kalman filter's gain and ±2σ band change with noise, measurement rate, and a gap in tags
EstimatorGainWPILib Pose EstimatorsWPILib's fixed gain next to a Kalman filter: noise, measurement rate, and recovery from a shove
FactorGraphSmootherFactor Graphs and GTSAMA Kalman filter, a live smoother, and the hindsight trajectory, with robust losses, bad measurements, a gate, and a shove
SwerveKinematicsSwerve KinematicsModule speeds and angles from a chassis velocity, field- or robot-relative, with the center of rotation, desaturation, and the path the robot drives
SwerveSkewSwerve KinematicsHow 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
SwerveGearingSpeed, Acceleration, and TractionHow drive ratio, wheel size, mass, tread grip, and the stator current limit set top speed, acceleration, and slip current
SuperstructureMovesThe SuperstructureWhy 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
DetectionPlaygroundPipeline PlaygroundA 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
HallHomingLimit Switches and Hall Effect SensorsHow 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
CrtTurretTwo Encoders and the CRTSolving 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
RollingShutterCamera CalibrationA 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:

  1. Create components/interactive/my-widget.tsx, starting with "use client".
  2. Build it from the shared parts in controls.tsx (Widget, Slider, Segmented, Readout) and plot.tsx (LinePlot), so every widget looks the same.
  3. Take motor numbers from lib/motors.ts instead of repeating them. It holds the Kraken constants used across the guide.
  4. Put any simulation in a pure function under lib/ (see lib/turret-sim.ts or lib/vision.ts), separate from the React code, so it can be checked on its own.
  5. Use theme colors only: fd-* Tailwind tokens for UI, and var(--color-plot-*) (defined in app/global.css) for plot lines, so light and dark mode both work.
  6. Register it in the widgets list in components/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 in useState and useRef inside 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).

On this page