Choosing a Strategy
Which homing strategy fits each kind of mechanism, the questions that decide it, a checklist for a reliable zero, and how to test it before competition.
Every strategy in this section works. The right one depends on the mechanism, on what can go wrong with it, and on how much complexity the team wants to maintain. In short:
- Start from the mechanism. Flywheels need no zero. Arms want an absolute encoder on the axle. Elevators and deployments zero against a hard stop. Turrets need a sensor or two encoders. Swerve steering uses an absolute encoder in each module.
- Use the simplest strategy that can't fail silently. Every sensor is one more part that can break. Add one when it removes a bigger risk, such as a belt that can slip.
- Plan for a lost zero. Decide how the robot notices it, and how it recovers during a match.
6.1 By mechanism
| Mechanism | Common choice | Also works | Notes |
|---|---|---|---|
| Flywheel, rollers | None | They hold a speed, not a position. | |
| Arm or pivot | Absolute encoder on the axle, 1:1 | Start on a hard stop | Gravity feedforward needs the true angle. Keep the wrap point outside the travel (§3.4). |
| Wrist on an arm | Absolute encoder on the wrist's axle | Start on a hard stop | It reads the angle relative to the arm. Gravity acts on the arm's angle plus the wrist's (Mechanisms that need extra care). |
| Elevator | Start on the bottom stop, and re-zero there in the match | Stall homing. A limit switch or hall effect sensor at the bottom. | The drum turns many times, so a 1:1 absolute encoder doesn't fit. |
| Linear deployment (intake slide, hopper) | Start on a hard stop, or home against it | A limit switch | It often runs into its stop in normal use, which is a free chance to re-zero. |
| Hood | Start on its hard stop, or home against it | Absolute encoder | Short travel between two stops. |
| Climber | Start on a hard stop | A limit switch at the stowed end | Heavy loads make slips more likely. Re-zero when it is stowed. |
| Turret, less than one turn | Absolute encoder, geared to turn less than once over the travel | Hall effect sensor | If it has hard stops, stall homing also works. |
| Turret, more than one turn | Hall effect sensor plus rotor angle (§4.4), or two encoders (CRT) | A known starting angle | Usually no hard stop to home against. |
| Swerve steering | Absolute encoder in each module (Anatomy) | Turns forever, so it can't home against anything. |
6.2 Questions that decide it
| If the mechanism... | Then |
|---|---|
| Rests on a hard stop at the start of every match | Zero at a known starting position. Add a homing routine or a re-zero button as a backup. |
| Has to recover by itself if its motor controller reboots during a match | Use an absolute encoder as its feedback sensor (FusedCANcoder, SyncCANcoder, or RemoteCANcoder), or re-home during the match. |
| Moves less than one turn of a shaft you can reach | Put an absolute encoder on that shaft. |
| Has a belt, chain, or hub that can slip between the motor and the mechanism | Add a sensor on the mechanism's side: an absolute encoder, or an index sensor to re-zero against. |
| Has no hard stops and travels more than one turn | Use a hall effect sensor plus rotor angle, or two encoders. |
| Travels more than one turn and must know its angle the moment it powers up | Use two encoders. |
6.3 A checklist for a reliable zero
- Hard stops on every limited mechanism, with soft limits a little inside them (§2.3).
- A homed flag for every mechanism that can lose its zero, shown on the dashboard and in the logs.
- No motion on its own until homed. Only the homing routine runs before then.
- A way to re-zero from the driver station, behind a two-button combination.
- A watch for motor controller reboots. Check each motor's
hasResetOccurred()every loop, and clear the homed flag when it returns true (§1.5). - Absolute readings checked against the motor's position, with large disagreements logged.
- A pre-match checklist that includes "every mechanism on its stop" and "every homed indicator on".
6.4 Testing the zero
- Power-cycle test. Turn the robot off and on with each mechanism on its stop, in the middle of its travel, and near each end. Check the position it reports each time. Absolute encoders should be right everywhere. Mechanisms zeroed at a known start should only be trusted on their stop.
- Reboot test. With the robot disabled, restart one motor controller. Check that the code notices and clears the homed flag, or that the position recovers from the absolute encoder.
- Repeatability test. Home a mechanism ten times in a row. After each, move it to the same setpoint and measure where it really is. The spread is how repeatable the zero is.
- Margin test. For two encoders, log the miss in teeth across the whole travel (§5.6). For a hall effect sensor and rotor angle, check that the window plus backlash is well under one rotor turn of travel.
- Match logs. Log every zeroing event with its time and the size of the correction. A correction that is suddenly large means something slipped.
Two Encoders and the Chinese Remainder Theorem
How two absolute encoders on pinions with different tooth counts read a turret's angle over more than one turn, how to choose the tooth counts, how much error the solve tolerates, and how to run it safely.
Vision
Foundations of camera-based localization in FRC. Why vision matters, relative and global positioning, AprilTags, the math of pose estimation, and camera calibration.