The WALL RESET's pure core (chunk L6-A1, 2026-10-29; the L6 brief, the team lead's answers of 2026-10-22): the geometry that turns one side distance sensor's reading into ONE field coordinate, the gates that REFUSE rather than guess, the verdict, and the on…
This header declares 16 types (144 members), 17 free functions, and 6 constants.
Extracted from include/shulib/localization/wall_reset.hpp — this page is that header's documentation, reformatted, so it cannot disagree with the code. Prose about how to think about the API lives in How it works; worked recipes live in Recipes; this page is the complete, mechanical list of what exists.
kWallDegToRad— constantkPublishedCloseAccuracyInches— constantkPublishedFarAccuracyFraction— constantenum class WallSidewallSideWord— free functionenum class WallFrameenum class KeepOutKindstruct WallKeepOutkMaxWallKeepOuts— constantstruct FieldWallstruct SideMountstruct WallResetLimitsstruct WallResetRequeststruct WallSamplekMaxWallSamples— constantkMaxWallWindowSeconds— constantenum class WallResetVerdictwallResetVerdictWord— free functionstruct WallResetReportverdictaxissiderequiredbeforemeasuredappliedmaxCorrectionmedianspreadsampleswindowSpanoffSquareexpectedRangealongbeamHalfWidthkeepOutMarginalongUncertaintyconeceilingheadingToleranceerrorBoundspeedSeenturnSeensampleIndexsampleDistancesampleConfidencedetailcleanFoundcleanFromcleanTofaultChannelseatedcontinues
struct WallSensorstruct WallResetLogstruct WallSensorsreadingAccuracy— free functionaxisFromReading— free functionaxisErrorBound— free functionheadingTolerance— free functioneffectiveCone— free functionbeamCeiling— free functionwallResetProblem— free functionstruct WallAimkeepOutActive— free functionaimAt— free functionpreCheck— free functionsampleVerdict— free functionwallStill— free functiondescribeWallReset— free functionevaluateWallReset— free functionclass WallSamplerappendWallResetLine— free function
inline constexpr double kWallDegToRad = math::Angle::kPi / 180.0Degrees to radians, as a constexpr factor: the wall reset's angle defaults are written 5.0 * kWallDegToRad because the _deg literal builds a non-constexpr math::Angle.
constant, declared at include/shulib/localization/wall_reset.hpp:79.
inline constexpr double kPublishedCloseAccuracyInches = 15.0 / 25.4VEX's published accuracy of the V5 Distance Sensor below 200 mm — "approximately ±15 mm" — in inches. With kPublishedFarAccuracyFraction it gives the accuracy the reset assumes until a measured SideMount::rangeAccuracy replaces it: max(15 mm, 5 % of the reading) at EVERY range, never a step at 200 mm (a step would put a cliff in the precision gate). A4 register HA-204.
constant, declared at include/shulib/localization/wall_reset.hpp:85.
inline constexpr double kPublishedFarAccuracyFraction = 0.05VEX's published accuracy above 200 mm — "about 5 %" of the reading. A4 register HA-204.
constant, declared at include/shulib/localization/wall_reset.hpp:88.
enum class WallSide : std::uint8_tWhich of the robot's two side sensors a reset reads (one per side, facing straight out — the team lead's 2026-10-08 ruling for both robots).
enum class, declared at include/shulib/localization/wall_reset.hpp:92.
LeftThe sensor on the robot's LEFT side (facing +90 degrees from forward, typically).
enumerator, declared at include/shulib/localization/wall_reset.hpp:94.
RightThe sensor on the robot's RIGHT side (facing -90 degrees from forward, typically).
enumerator, declared at include/shulib/localization/wall_reset.hpp:96.
[[nodiscard]] constexpr const char* wallSideWord(WallSide side) noexceptThe side's word in the log line: "LEFT" or "RIGHT" (printed "(LEFT sensor)" — a sensor, never a direction). Exhaustive, no default.
free function, declared at include/shulib/localization/wall_reset.hpp:101.
enum class WallFrame : std::uint8_tWhose coordinates a wall is in.
enum class, declared at include/shulib/localization/wall_reset.hpp:112.
FieldA SEASON wall in the field frame (F1) — localization::override2026's. Meaningful only when the estimate is in field coordinates, i.e. the auton declared a FIELD start.
enumerator, declared at include/shulib/localization/wall_reset.hpp:115.
OwnAn author's OWN line (FieldWall::line), in whatever frame the author's code uses, with the author's own keep-outs or none — the explicit, Tier-3 form's.
enumerator, declared at include/shulib/localization/wall_reset.hpp:118.
enum class KeepOutKind : std::uint8_tWhat lifts a keep-out span (rule 3).
enum class, declared at include/shulib/localization/wall_reset.hpp:122.
FixedNever lifted: the Toggle's brackets, the Loaders, the corners, the VEX U Load Zones.
enumerator, declared at include/shulib/localization/wall_reset.hpp:124.
ToggleThe Toggle's BODY: lifted per side only by the mount's MEASURED toggleChecked (that sensor, at its height, was seen to read the wall beneath a real Toggle on a field).
enumerator, declared at include/shulib/localization/wall_reset.hpp:127.
PieceZoneWhere single game pieces are KNOWN to stand (the start pieces): applies while the mount's cone is UNMEASURED and lifts once a measured coneHalfAngle is typed, because the beam-height gate (rule 4) then rests on a measured cone.
enumerator, declared at include/shulib/localization/wall_reset.hpp:131.
struct WallKeepOutOne stretch of a wall a beam must not land on, as coordinates ALONG the wall (from <= to; the along axis is the one the wall does not measure).
struct, declared at include/shulib/localization/wall_reset.hpp:136.
units::Length from{}The span's lower end along the wall (inches).
field, declared at include/shulib/localization/wall_reset.hpp:138.
units::Length to{}The span's upper end along the wall (inches); >= from.
field, declared at include/shulib/localization/wall_reset.hpp:140.
KeepOutKind kind = KeepOutKind::FixedWhat lifts it (KeepOutKind).
field, declared at include/shulib/localization/wall_reset.hpp:142.
const char* why = ""The span's name in the log line ("Loader", "Load Zone", "Toggle", ...) — a stable literal.
field, declared at include/shulib/localization/wall_reset.hpp:144.
inline constexpr std::size_t kMaxWallKeepOuts = 12The most keep-out spans one wall carries (the red and blue walls need 11).
constant, declared at include/shulib/localization/wall_reset.hpp:148.
struct FieldWallA wall: the line axis = coord, with the field on its inward side (+1: the field is at larger coordinates, as for the left wall at x = -70.2; -1: at smaller), and the spans along it a beam must not land on.
struct, declared at include/shulib/localization/wall_reset.hpp:153.
const char* name = ""The wall's name in the log line ("left wall") — a stable literal.
field, declared at include/shulib/localization/wall_reset.hpp:155.
Axis axis = Axis::XThe axis this wall measures.
field, declared at include/shulib/localization/wall_reset.hpp:157.
units::Length coord{}The wall's inner face, as a coordinate on axis (inches).
field, declared at include/shulib/localization/wall_reset.hpp:159.
std::int8_t inward = +1+1 or -1: the side of the line the field (and the robot) is on. Anything else is refused BadRequest.
field, declared at include/shulib/localization/wall_reset.hpp:162.
WallFrame frame = WallFrame::FieldWhose coordinates the wall is in (WallFrame).
field, declared at include/shulib/localization/wall_reset.hpp:164.
std::array<WallKeepOut, kMaxWallKeepOuts> keepOut{}The keep-out spans; the first keepOutCount are used.
field, declared at include/shulib/localization/wall_reset.hpp:166.
std::uint8_t keepOutCount = 0How many of keepOut are used.
field, declared at include/shulib/localization/wall_reset.hpp:168.
[[nodiscard]] static constexpr FieldWall line(const char* name, Axis axis, units::Length coord, std::int8_t inward, std::span<const WallKeepOut> keepOuts = {})An author's OWN wall line (frame Own) — for hand-wired Tier-3 code and tests that know their frame: the line axis = coord, the field on the inward side, and the author's keep-outs (none by default — a line with none has none: the reset then cannot tell a Loader from the wall). More than kMaxWallKeepOuts spans is a programming error (a precondition).
function, declared at include/shulib/localization/wall_reset.hpp:174.
[[nodiscard]] constexpr std::span<const WallKeepOut> keepOuts() const noexceptThe used keep-out spans, as a view into this wall.
function, declared at include/shulib/localization/wall_reset.hpp:193.
struct SideMountOne side sensor's place on the robot, in the BODY frame, MEASURED with a tape on the robot — every number with its tolerance, and a provenance string. measured == false (the default) makes every reset with this sensor REFUSE MountUnset; a placeholder "so the reset works" is the defect this project has paid for before.
struct, declared at include/shulib/localization/wall_reset.hpp:203.
bool measured = falseFalse = UNSET: every reset with this sensor refuses MountUnset (never the robot).
field, declared at include/shulib/localization/wall_reset.hpp:205.
units::Length forward{}The lens's offset FORWARD of the robot's centre (the turning centre on a tank), inches. The fore-aft centre (0) is load-bearing for precision: the axis error from a heading error is this offset times the heading error.
field, declared at include/shulib/localization/wall_reset.hpp:209.
units::Length left{}The lens's offset to the LEFT of the robot's centre, inches (negative = right).
field, declared at include/shulib/localization/wall_reset.hpp:211.
units::Length height{}The lens centre's height above the floor, inches — decides the beam-height ceiling (rule 4).
field, declared at include/shulib/localization/wall_reset.hpp:213.
units::AngleDim facing{}The beam's direction, counter-clockwise from forward: 90.0 * kWallDegToRad = straight out the left side, -90.0 * kWallDegToRad the right.
field, declared at include/shulib/localization/wall_reset.hpp:216.
units::Length positionTolerance{0.25}How well forward and left were measured (inches, +/-). PROVISIONAL default (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:218.
units::AngleDim facingTolerance{2.0 * kWallDegToRad}How square the sensor was found (+/-). PROVISIONAL default (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:220.
units::Length rangeBias{}Subtracted from every reading; 0 = none measured. Typed ONLY when this sensor's readings at taped distances from a wall show a consistent offset (A4 register HA-204).
field, declared at include/shulib/localization/wall_reset.hpp:223.
units::Length rangeAccuracy{}This sensor's +/- accuracy, measured from readings at taped distances from a wall; 0 = unmeasured, and the reset assumes VEX's published max(15 mm, 5 % of the reading) — A4 register HA-204.
field, declared at include/shulib/localization/wall_reset.hpp:227.
units::AngleDim coneHalfAngle{}The beam's half-angle, measured (how far to the side of the beam a target is still seen); 0 = UNMEASURED: the limits' 18 degrees is used and the start-piece zones stay kept out (A4 register HA-205).
field, declared at include/shulib/localization/wall_reset.hpp:231.
bool toggleChecked = falseTrue only when this sensor, at its height, was seen to read the WALL beneath a real Toggle's BODY on a field — then the Toggle body's keep-out lifts for it (its brackets never do — A4 register HA-208).
field, declared at include/shulib/localization/wall_reset.hpp:235.
const char* provenance = ""Who measured what, how and when — a stable literal; printed by nothing, read by people.
field, declared at include/shulib/localization/wall_reset.hpp:237.
struct WallResetLimitsThe sensor-physics and geometry gates — PROVISIONAL library defaults (A4: HA-211), overridable per robot. The ONE policy number, maxCorrection, is not here: the author states it in every request.
struct, declared at include/shulib/localization/wall_reset.hpp:242.
units::Length rangeMin{2.0}The shortest bias-corrected reading accepted (inches): VEX's 20-mm floor with room for the unpublished close-range behaviour. PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:245.
units::Length rangeMax{16.0}The longest (inches): where the published accuracy alone (5 % = 0.8 in) leaves no room under the 1.0-in precision gate. PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:248.
units::AngleDim squareWithin{5.0 * kWallDegToRad}The beam's largest angle off the wall's normal (rule 2). PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:250.
units::Length spreadMax{0.5}The window's largest max - min reading (rule 7). PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:252.
int minSamples = 5The fewest samples a window needs (rule 7); at most kMaxWallSamples. PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:254.
units::Time window{0.15}The shortest window (rule 7) — the TIME is the real guard: reads inside one sensor update repeat (A4 register HA-209). Also the span rule 5 measures the speed over. Above 0 and at most kMaxWallWindowSeconds. PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:258.
units::Time windowMax{0.5}The longest a window may run — the explicit form's frozen-wait lateness bound (at most 1 s). PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:261.
double minConfidence = 0.5The lowest confidence a sample may carry (rule 6). Synthetic below 200 mm: the adapter reports 1.0 there. PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:264.
units::Velocity stillSpeed{1.0}The fastest the estimate may move during the window (rule 5): its displacement over the trailing window, divided by that time — never one tick's finite difference, which turns a still IMU's heading noise into phantom speed on offset tracking wheels. PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:269.
units::AngularVelocity stillTurn{3.0 * kWallDegToRad}The fastest it may turn during the window (rule 5), on every tick (the IMU's own rate). PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:272.
units::Length errorBoundMax{1.0}The largest worst-case error of the answer (rule 8) — F2's ~1.0-in pose target. PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:275.
units::Length keepOutMargin{3.0}The keep-out margin (rule 3): start-pose placement + a field element's place + the beam centre's aim, summed (~2.1) and rounded up. PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:278.
double alongDriftRate = 0.10The along-wall drift rate (rule 3): the keep-outs widen by this times the travel since the along axis was last set (robot two's saved scale reads ~8 % short). PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:281.
units::AngleDim coneHalfAngle{18.0 * kWallDegToRad}The beam half-angle while the mount's is unmeasured (rules 3, 4) — an unofficial figure (A4 register HA-205). PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:284.
units::Length pieceTop{6.5}The tallest single game piece the ceiling keeps the cone above (inches): a standing Pin or Cup (A4 register HA-212). PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:287.
units::Length beamMargin{0.5}The clearance above that piece (inches). PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:289.
units::AngleDim headingFloor{2.0 * kWallDegToRad}The heading tolerance's floor (rule 8): HA-20's drift over a run, doubled. PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:292.
double headingPerTurn = 0.02The heading tolerance's growth per radian turned since the heading was set: HA-84's 1 %, doubled. PROVISIONAL (A4: HA-211).
field, declared at include/shulib/localization/wall_reset.hpp:295.
struct WallResetRequestOne reset, as an auton states it: the wall, the side, how far it may move the coordinate, and whether a refusal fails the step.
struct, declared at include/shulib/localization/wall_reset.hpp:300.
FieldWall wall{}The wall to reset against — a season wall (localization::override2026::kLeftWall, ...) or an author's own line (FieldWall::line).
field, declared at include/shulib/localization/wall_reset.hpp:303.
WallSide sensor = WallSide::LeftWhich side's sensor faces it.
field, declared at include/shulib/localization/wall_reset.hpp:305.
units::Length maxCorrection{0.0}How far this wall may move the coordinate (inches). NO DEFAULT: 0 is UNSET and refused by name (maxCorrection UNSET: say how far this wall may move x) — the largest drift the author has taped at this point plus ~1 in, never near the gap to anything a wrong seat could mistake for the wall.
field, declared at include/shulib/localization/wall_reset.hpp:310.
bool required = falseTrue: a refusal FAILS the step (through then() the chain stops). False: a refusal leaves the estimate as it was and the auton goes on.
field, declared at include/shulib/localization/wall_reset.hpp:313.
const char* name = nullptrOptional: leads the log line when set — a stable literal.
field, declared at include/shulib/localization/wall_reset.hpp:315.
struct WallSampleOne sample of the window, as the sampler took it.
struct, declared at include/shulib/localization/wall_reset.hpp:319.
units::Length distance{}The sensor's distance() reading — RAW (the mount's bias is removed by the gates, never here).
field, declared at include/shulib/localization/wall_reset.hpp:321.
double confidence = 0.0The sensor's confidence() reading, in [0, 1].
field, declared at include/shulib/localization/wall_reset.hpp:323.
bool faultMoved = falseThe read-fault count moved across the sample's two device reads: the values may be HELD (a faulted port's adapter returns its last good reading), not measured — never evidence.
field, declared at include/shulib/localization/wall_reset.hpp:326.
units::Time at{}When it was taken, from the window's first sample.
field, declared at include/shulib/localization/wall_reset.hpp:328.
inline constexpr std::size_t kMaxWallSamples = 64The window's sample buffer: fixed, allocation-free. At the 10-ms tick the 0.5-s windowMax is 50 samples; a faster pacer fills it and the sampler STOPS at capacity — it never wraps or overruns.
constant, declared at include/shulib/localization/wall_reset.hpp:333.
inline constexpr double kMaxWallWindowSeconds = 0.6The longest WallResetLimits::window a reset accepts (seconds). The 64-sample buffer spans 63 ticks — 0.63 s at the project's 10-ms control tick — and a window longer than the buffer can span could never be met: every reset would end TOO FEW SAMPLES. 0.6 s keeps a tick of slack; past it the request is refused BadRequest, naming the field (found by the L6-A1 review).
constant, declared at include/shulib/localization/wall_reset.hpp:339.
enum class WallResetVerdict : std::uint8_tA reset's verdict. APPEND-ONLY from L6-A1's landing (2026-10-29): a value is never renumbered or reused. wallResetVerdictWord gives each its word; guide 11 gives each its remedy.
enum class, declared at include/shulib/localization/wall_reset.hpp:343.
SeatedThe axis was re-seated.
enumerator, declared at include/shulib/localization/wall_reset.hpp:345.
NoSensorThe robot declares no wall sensors (the everyday form: the robot's context has no wall-sensor slot).
enumerator, declared at include/shulib/localization/wall_reset.hpp:348.
SensorAbsentThe named side's sensor does not exist (the provider refused it); the detail is the reason.
enumerator, declared at include/shulib/localization/wall_reset.hpp:350.
MountUnsetThe side's mount was never measured (SideMount::measured false).
enumerator, declared at include/shulib/localization/wall_reset.hpp:352.
NotLiveThe estimate is not live yet (the IMU still booting).
enumerator, declared at include/shulib/localization/wall_reset.hpp:354.
MotionActiveA motion is still armed (a Tier-3 async()): the reset never moves the estimate under one.
enumerator, declared at include/shulib/localization/wall_reset.hpp:356.
BadRequestA request, mount or limit field is unusable; the detail names it.
enumerator, declared at include/shulib/localization/wall_reset.hpp:358.
NotFieldStartThe auton's start is not a FIELD start (the everyday form); the detail is the start mode's word.
enumerator, declared at include/shulib/localization/wall_reset.hpp:360.
NotSquareThe beam is not within squareWithin of the wall's normal (or faces away from it).
enumerator, declared at include/shulib/localization/wall_reset.hpp:362.
KeepOutThe beam lands on (or its widened footprint overlaps) a keep-out span; the detail names it.
enumerator, declared at include/shulib/localization/wall_reset.hpp:364.
BeamLowThe expected range, or the median's, is past the beam-height ceiling.
enumerator, declared at include/shulib/localization/wall_reset.hpp:366.
MovingThe estimate moved or turned during the window.
enumerator, declared at include/shulib/localization/wall_reset.hpp:368.
ReadFaultA sample was read while the port faulted.
enumerator, declared at include/shulib/localization/wall_reset.hpp:370.
NoReturnA sample had no return (confidence 0 — PROS's 9999, or a held value).
enumerator, declared at include/shulib/localization/wall_reset.hpp:372.
LowConfidenceA sample's confidence was under minConfidence.
enumerator, declared at include/shulib/localization/wall_reset.hpp:374.
OutOfRangeA sample's bias-corrected range was outside [rangeMin, rangeMax].
enumerator, declared at include/shulib/localization/wall_reset.hpp:376.
TooFewSamplesThe window had fewer than minSamples, or ran shorter than window.
enumerator, declared at include/shulib/localization/wall_reset.hpp:378.
SpreadThe window's readings spread more than spreadMax.
enumerator, declared at include/shulib/localization/wall_reset.hpp:380.
ImpreciseThe answer's worst-case error is over errorBoundMax.
enumerator, declared at include/shulib/localization/wall_reset.hpp:382.
DisagreesThe answer differs from the estimate by more than maxCorrection.
enumerator, declared at include/shulib/localization/wall_reset.hpp:384.
CutThe run's deadline or a disable landed in the window — or had already come when it was to begin (samples 0; the line says which) — the everyday form.
enumerator, declared at include/shulib/localization/wall_reset.hpp:387.
[[nodiscard]] constexpr const char* wallResetVerdictWord(WallResetVerdict v) noexceptThe verdict's word in the log line ("SEATED", "REFUSED keep-out", ...). Exhaustive with no default: — a new verdict without a word does not compile (-Wswitch -Werror).
free function, declared at include/shulib/localization/wall_reset.hpp:392.
struct WallResetReportWhat a reset did, with every number its log line prints. A VALUE: a refusal is a report, never an exception. Fields a verdict did not reach stay at their defaults.
struct, declared at include/shulib/localization/wall_reset.hpp:442.
WallResetVerdict verdict = WallResetVerdict::NoSensorThe verdict (the FIRST rule that failed, or Seated).
field, declared at include/shulib/localization/wall_reset.hpp:444.
Axis axis = Axis::XThe axis the wall measures.
field, declared at include/shulib/localization/wall_reset.hpp:446.
WallSide side = WallSide::LeftThe side whose sensor was read.
field, declared at include/shulib/localization/wall_reset.hpp:448.
bool required = falseThe request's required (D3): a refusal then fails the step.
field, declared at include/shulib/localization/wall_reset.hpp:450.
units::Length before{}The estimate's coordinate on axis when the reset judged it.
field, declared at include/shulib/localization/wall_reset.hpp:452.
units::Length measured{}The wall's answer for that coordinate (filled once a median exists).
field, declared at include/shulib/localization/wall_reset.hpp:454.
units::Length applied{}How far the coordinate was moved: measured - before when SEATED, 0 otherwise.
field, declared at include/shulib/localization/wall_reset.hpp:456.
units::Length maxCorrection{}The request's maxCorrection, echoed for the line.
field, declared at include/shulib/localization/wall_reset.hpp:458.
units::Length median{}The window's MEDIAN reading — raw, as the sensor gave it.
field, declared at include/shulib/localization/wall_reset.hpp:460.
units::Length spread{}The window's max - min reading.
field, declared at include/shulib/localization/wall_reset.hpp:462.
int samples = 0How many samples the window took.
field, declared at include/shulib/localization/wall_reset.hpp:464.
units::Time windowSpan{}How long the window ran (first sample to last).
field, declared at include/shulib/localization/wall_reset.hpp:466.
units::AngleDim offSquare{}The beam's angle off the wall's normal, by the estimate's heading (rule 2).
field, declared at include/shulib/localization/wall_reset.hpp:468.
units::Length expectedRange{}The beam-centre range to the wall the ESTIMATE implies (rules 3, 4).
field, declared at include/shulib/localization/wall_reset.hpp:470.
units::Length along{}The beam centre's coordinate along the wall, by the estimate (rule 3).
field, declared at include/shulib/localization/wall_reset.hpp:472.
units::Length beamHalfWidth{}The beam's footprint half-width along the wall at the expected range (rule 3).
field, declared at include/shulib/localization/wall_reset.hpp:474.
units::Length keepOutMargin{}The keep-out margin used (rule 3).
field, declared at include/shulib/localization/wall_reset.hpp:476.
units::Length alongUncertainty{}The along-wall drift allowance used: alongDriftRate x travelSinceSeat (rule 3).
field, declared at include/shulib/localization/wall_reset.hpp:478.
units::AngleDim cone{}The beam half-angle used (the mount's measured one, or the limits').
field, declared at include/shulib/localization/wall_reset.hpp:480.
units::Length ceiling{}The beam-height ceiling (rule 4).
field, declared at include/shulib/localization/wall_reset.hpp:482.
units::AngleDim headingTolerance{}The heading tolerance used by the precision gate (rule 8).
field, declared at include/shulib/localization/wall_reset.hpp:484.
units::Length errorBound{}The answer's worst-case error (rule 8; filled once a median exists).
field, declared at include/shulib/localization/wall_reset.hpp:486.
units::Velocity speedSeen{}The fastest the estimate moved during the window.
field, declared at include/shulib/localization/wall_reset.hpp:488.
units::AngularVelocity turnSeen{}The fastest it turned during the window.
field, declared at include/shulib/localization/wall_reset.hpp:490.
int sampleIndex = -1The refusing sample's index (rule 6), or -1.
field, declared at include/shulib/localization/wall_reset.hpp:492.
units::Length sampleDistance{}The refusing sample's distance reading (rule 6).
field, declared at include/shulib/localization/wall_reset.hpp:494.
double sampleConfidence = 0.0The refusing sample's confidence (rule 6).
field, declared at include/shulib/localization/wall_reset.hpp:496.
const char* detail = ""BadRequest: the field's message; KeepOut: the span's name; SensorAbsent: the absence sentence; NotFieldStart: the start mode's word ("RELATIVE", "UNSET" — L6-A2). A stable literal (or the Robot's copied sentence), "" when none.
field, declared at include/shulib/localization/wall_reset.hpp:500.
bool cleanFound = falseKeepOut: a clean band for the beam centre was found along the wall.
field, declared at include/shulib/localization/wall_reset.hpp:502.
units::Length cleanFrom{}KeepOut: the nearest clean band's lower end along the wall.
field, declared at include/shulib/localization/wall_reset.hpp:504.
units::Length cleanTo{}KeepOut: the nearest clean band's upper end along the wall.
field, declared at include/shulib/localization/wall_reset.hpp:506.
bool faultChannel = trueFalse: the sensor has no read-fault count ("faults n/a" — never "faults ok").
field, declared at include/shulib/localization/wall_reset.hpp:508.
[[nodiscard]] constexpr bool seated() const noexceptThe axis was re-seated.
function, declared at include/shulib/localization/wall_reset.hpp:511.
[[nodiscard]] constexpr bool continues() const noexceptThe auton may go on: SEATED, or REFUSED and not required (D3) — the value a then() returns.
function, declared at include/shulib/localization/wall_reset.hpp:513.
struct WallSensorOne side as a reset reads it: the sensor, its read-fault count, its mount, and why it is absent. Built by the caller (the explicit form) or by robot::Robot from the robot file's walls block (config/wall_sensor_config.hpp).
struct, declared at include/shulib/localization/wall_reset.hpp:519.
hal::IDistance* sensor = nullptrThe sensor; nullptr = absent (the reset refuses SensorAbsent with absence).
field, declared at include/shulib/localization/wall_reset.hpp:521.
const hal::IReadFaults* faults = nullptrIts read-fault count; nullptr = none (a fake, or a provider that never screens) — accepted, and the line says "faults n/a".
field, declared at include/shulib/localization/wall_reset.hpp:524.
SideMount mount{}Its measured mount.
field, declared at include/shulib/localization/wall_reset.hpp:526.
const char* absence = "not declared"Why it is absent, when sensor is nullptr — a stable literal or the Robot's copied sentence.
field, declared at include/shulib/localization/wall_reset.hpp:528.
struct WallResetLogA robot's running tally of its resets (the Auton Tester shows it to the people testing, from L6-B) — counts and the last outcome. record() is how a call files one.
struct, declared at include/shulib/localization/wall_reset.hpp:533.
int seated = 0Resets SEATED so far.
field, declared at include/shulib/localization/wall_reset.hpp:535.
int refused = 0Resets REFUSED so far.
field, declared at include/shulib/localization/wall_reset.hpp:537.
WallResetReport last{}The last outcome (a default report until the first).
field, declared at include/shulib/localization/wall_reset.hpp:539.
void record(const WallResetReport& report) noexceptFile one outcome: counted SEATED or REFUSED, and kept as last.
function, declared at include/shulib/localization/wall_reset.hpp:542.
struct WallSensorsBoth sides, the robot's limits and its log — the OPTIONAL slot the robot's context carries (chassis::RobotContextConfig::walls), which the everyday form finds through chassis.deps().ctx.
struct, declared at include/shulib/localization/wall_reset.hpp:554.
WallSensor left{}The LEFT side's sensor.
field, declared at include/shulib/localization/wall_reset.hpp:556.
WallSensor right{}The RIGHT side's sensor.
field, declared at include/shulib/localization/wall_reset.hpp:558.
WallResetLimits limits{}The robot's gate limits.
field, declared at include/shulib/localization/wall_reset.hpp:560.
WallResetLog log{}The robot's running tally.
field, declared at include/shulib/localization/wall_reset.hpp:562.
[[nodiscard]] constexpr const WallSensor& side(WallSide which) const noexceptThe named side.
function, declared at include/shulib/localization/wall_reset.hpp:565.
[[nodiscard]] inline units::Length readingAccuracy(units::Length range, const SideMount& mount) noexceptPURE: the accuracy the reset assumes for a bias-corrected RANGE: the mount's measured rangeAccuracy when typed, else VEX's published max(15 mm, 5 % of the range) — at every range, never a step at 200 mm. A4 register HA-204.
free function, declared at include/shulib/localization/wall_reset.hpp:600.
[[nodiscard]] inline units::Length axisFromReading(units::Length reading, const math::Pose2d& pose, const SideMount& mount, const FieldWall& wall)PURE: the robot centre's coordinate a READING implies (the beam-centre model; the mount's bias removed). reading is the sensor's raw distance and must be finite (a precondition).
free function, declared at include/shulib/localization/wall_reset.hpp:610.
[[nodiscard]] inline units::Length axisErrorBound(units::Length reading, const math::Pose2d& pose, const SideMount& mount, const FieldWall& wall, units::AngleDim headingTolerance)PURE: the worst-case error of axisFromReading's answer — over the CORNERS of the tolerance box (the reading +/- its accuracy, forward and left +/- the mount's positionTolerance, facing +/- its facingTolerance, the heading +/- headingTolerance), each corner run through the exact geometry, not a linearisation. A non-finite tolerance (a NaN typed into the mount, or handed in as headingTolerance) gives +infinity — the worst answer, so the precision gate refuses — never a NaN silently dropped by a max (found by the L6-A1 review). A4 register HA-204 (the accuracy), HA-211 (the tolerances).
free function, declared at include/shulib/localization/wall_reset.hpp:627.
[[nodiscard]] inline units::AngleDim headingTolerance(units::AngleDim turnedSinceHeadingSeed, const WallResetLimits& limits) noexceptPURE: the heading tolerance the precision gate assumes: headingFloor + headingPerTurn x the |rotation| since the heading was last seeded (Localizer::turnedSinceHeadingSeed). A4 register HA-211 (the floor from HA-20, the growth from HA-84).
free function, declared at include/shulib/localization/wall_reset.hpp:663.
[[nodiscard]] constexpr units::AngleDim effectiveCone(const SideMount& mount, const WallResetLimits& limits) noexceptPURE: the beam half-angle a reset uses — the mount's MEASURED one when typed (> 0), else the limits' (A4 register HA-205).
free function, declared at include/shulib/localization/wall_reset.hpp:671.
[[nodiscard]] inline units::Length beamCeiling(const SideMount& mount, const WallResetLimits& limits) noexceptPURE: the farthest range whose cone stays above pieceTop + beamMargin all the way to the wall, from the TYPED height and cone: (height - pieceTop - beamMargin) / tan(cone), and 0 when the lens is not above that line at all. At or under it, no single standing game piece can be the nearest surface in the cone — nor the floor, which the cone meets only beyond height / tan(cone).
free function, declared at include/shulib/localization/wall_reset.hpp:680.
[[nodiscard]] inline const char* wallResetProblem(const SideMount& mount, const WallResetRequest& request, const WallResetLimits& limits) noexceptPURE: the first thing wrong with a request, its mount or the limits, as the message the line prints ("maxCorrection UNSET: say how far this wall may move x") — or nullptr when everything is usable. Rule 1's last check (BadRequest).
free function, declared at include/shulib/localization/wall_reset.hpp:691.
struct WallAimWhere a beam lands, by the ESTIMATE — everything rules 2-4 judge, computed once (PURE).
struct, declared at include/shulib/localization/wall_reset.hpp:784.
units::AngleDim offSquare{}The beam's angle off the wall's outward normal, in [0, pi]: above 90 degrees it faces away.
field, declared at include/shulib/localization/wall_reset.hpp:786.
units::Length expectedRange{}The beam-centre range to the wall the estimate implies (<= 0 if the estimate puts the lens past the wall; only meaningful while the beam points at it).
field, declared at include/shulib/localization/wall_reset.hpp:789.
units::Length along{}The beam centre's coordinate along the wall.
field, declared at include/shulib/localization/wall_reset.hpp:791.
units::Length beamHalfWidth{}The footprint's half-width along the wall at the expected range: the LARGER side of the exact cone footprint (a skewed beam's footprint is lopsided), applied both ways.
field, declared at include/shulib/localization/wall_reset.hpp:794.
units::Length margin{}The keep-out margin (the limits').
field, declared at include/shulib/localization/wall_reset.hpp:796.
units::Length drift{}The along-wall drift allowance (alongDriftRate x the travel since the along axis was set).
field, declared at include/shulib/localization/wall_reset.hpp:798.
units::Length widening{}beamHalfWidth + margin + drift: how far either side of along a keep-out must stay clear.
field, declared at include/shulib/localization/wall_reset.hpp:800.
units::AngleDim cone{}The beam half-angle used (effectiveCone).
field, declared at include/shulib/localization/wall_reset.hpp:802.
units::Length ceiling{}The beam-height ceiling (beamCeiling).
field, declared at include/shulib/localization/wall_reset.hpp:804.
const char* keepOutWhy = nullptrThe first ACTIVE keep-out the widened footprint overlaps (its why), or nullptr.
field, declared at include/shulib/localization/wall_reset.hpp:806.
bool cleanFound = falseA clean band for the beam centre exists along the wall (only computed when keepOutWhy is set).
field, declared at include/shulib/localization/wall_reset.hpp:808.
units::Length cleanFrom{}The nearest clean band's lower end (may be -infinity on an author's own line).
field, declared at include/shulib/localization/wall_reset.hpp:810.
units::Length cleanTo{}The nearest clean band's upper end (may be +infinity on an author's own line).
field, declared at include/shulib/localization/wall_reset.hpp:812.
[[nodiscard]] constexpr bool keepOutActive(const WallKeepOut& span, const SideMount& mount) noexceptPURE: whether a keep-out span applies for this mount (KeepOutKind's rules).
free function, declared at include/shulib/localization/wall_reset.hpp:816.
[[nodiscard]] inline WallAim aimAt(const math::Pose2d& pose, const SideMount& mount, const FieldWall& wall, const WallResetLimits& limits, units::Length alongUncertainty)PURE: where the beam lands by the estimate pose, and what it would land on (rules 2-4's inputs). Requires a usable request (wallResetProblem returned nullptr) — with an inward other than +/-1 the normal is undefined.
free function, declared at include/shulib/localization/wall_reset.hpp:831.
[[nodiscard]] inline WallResetVerdict preCheck(const math::Pose2d& pose, const SideMount& mount, const WallResetRequest& request, const WallResetLimits& limits, units::Length alongUncertainty)PURE: the gates that need no reading, in order — BadRequest (wallResetProblem), NotSquare, KeepOut, BeamLow; Seated means "go on and sample". (The call checks the sensor, the mount's measured, liveness and motion first.)
free function, declared at include/shulib/localization/wall_reset.hpp:943.
[[nodiscard]] inline WallResetVerdict sampleVerdict(const WallSample& sample, const SideMount& mount, const WallResetLimits& limits) noexceptPURE: rule 6 for ONE sample — ReadFault, NoReturn, LowConfidence, OutOfRange, or Seated when the sample is usable. The sampler stops the window at the first sample this refuses; the evaluator names it.
free function, declared at include/shulib/localization/wall_reset.hpp:966.
[[nodiscard]] inline bool wallStill(const math::Twist2d& worst, const WallResetLimits& limits) noexceptPURE: whether a window's worst twist is still (rule 5): the norm of (vx, vy) within stillSpeed and |omega| within stillTurn. A non-finite twist is not still.
free function, declared at include/shulib/localization/wall_reset.hpp:986.
[[nodiscard]] inline WallResetReport describeWallReset(const math::Pose2d& pose, const SideMount& mount, const WallResetRequest& request, const WallResetLimits& limits, units::AngleDim headingTol, units::Length alongUncertainty)PURE: a report with every number the estimate alone decides — the axis, the side, before, the aim's numbers, the heading tolerance, the limit echoed — and verdict Seated ("nothing refused yet"). The call fills a pre-sampling refusal's report from it; evaluateWallReset starts from it.
free function, declared at include/shulib/localization/wall_reset.hpp:995.
[[nodiscard]] inline WallResetReport evaluateWallReset(std::span<const WallSample> samples, const math::Pose2d& pose, const math::Twist2d& maxTwist, const SideMount& mount, const WallResetRequest& request, const WallResetLimits& limits, units::AngleDim headingTol, units::Length alongUncertainty)PURE: the whole verdict from a window of samples — rules 5-9 (run preCheck first: this does not re-judge rules 2-4, but an unusable request is refused BadRequest here too, never judged). maxTwist is the window's worst twist: its linear part's norm (WallSampler's speed over the trailing window) and |omega| each the largest seen. pose is the estimate the answer is compared with (and seated over). Fills measured, applied (SEATED only), median, spread, errorBound and the refusing sample's numbers. Changes nothing.
free function, declared at include/shulib/localization/wall_reset.hpp:1037.
class WallSamplerThe window's sampler: one step() per control tick, each judging stillness from the estimate and taking ONE sample — the read-fault count read before the sample's first device read and after its second (distance() then confidence() are TWO device reads; both must be fault-free). It says the window is DONE at the first tick that refuses (moving, or a sample rule 6 refuses), once the window has minSamples over window, at windowMax, or at the buffer's capacity — never later. The explicit call drives it from Chassis::waitUntil's predicate; the everyday form from the run guard's wait. The wait's own ticks keep the estimate current. RULE 5's SPEED is the estimate's DISPLACEMENT over the trailing window, per that time: on each tick, the distance from the pose of the latest earlier tick at least window back (or the window's first tick, while the window is younger than that), divided by the time between them, floored at window. A robot moving at v reads v once the window is window old, and a push lasting window is seen; WHY NOT ONE TICK'S VELOCITY (the L6-A1 review): the estimate's per-tick linear velocity is a finite difference of the fused pose, and on a robot whose tracking wheels sit off the turning centre a still IMU's heading noise (the register's HA-21, ~0.05 degrees) moves that pose a few thousandths of an inch each tick — 1.1-1.4 in/s of PHANTOM speed on the host test plant's wheel offsets, so every reset was refused MOVING while nothing moved. That jitter does not add up over window (it is noise about a fixed point), so the displacement reads ~0.08 in/s on average there instead (0.04-0.17 in/s over 600 still resets, ten seeds). It grows in step with the noise: ~0.33 in/s (up to ~0.7) at four times HA-21's, and it reaches the 1-in/s limit only near six times (2 of 600 still resets refused MOVING). The turn rate is judged on every tick from the estimate's own omega (the IMU's rate), as before. A NaN pose or turn rate counts as +infinity — the window ends MOVING at that tick (std::max alone would drop a NaN and judge the tick still).
class, declared at include/shulib/localization/wall_reset.hpp:1140.
WallSampler(const WallSensor& sensor, const WallResetLimits& limits) noexceptBorrows sensor and limits (both must outlive the sampler); sensor.sensor must be set and the limits usable (wallResetProblem() returned nullptr — window above 0).
function, declared at include/shulib/localization/wall_reset.hpp:1144.
bool step(units::Time now, const math::Pose2d& pose, units::AngularVelocity turnRate)One tick at time now, the estimate at pose and turning at turnRate: judge stillness, take one sample. Returns true when the window is DONE (the caller's wait predicate returns this).
function, declared at include/shulib/localization/wall_reset.hpp:1150.
[[nodiscard]] std::span<const WallSample> samples() const noexceptThe samples taken so far.
function, declared at include/shulib/localization/wall_reset.hpp:1199.
[[nodiscard]] math::Twist2d maxTwist() const noexceptThe window's worst twist so far: vx carries the largest speed judged (rule 5's: the displacement over the trailing window), vy is 0, omega the largest |turn rate| — the form evaluateWallReset takes.
function, declared at include/shulib/localization/wall_reset.hpp:1206.
inline void appendWallResetLine(diag::lineformat::Line& line, const WallResetReport& rep, const WallResetRequest& request, const SideMount& mount, const WallResetLimits& limits, const char* sideNote = nullptr)PURE: append the reset's ONE log line (subsystem "WALL"; ASCII; within a Line's 384 bytes) — [<name>: ]<wall> <axis> <WORD> (<SIDE> sensor): <the verdict's numbers>, e.g. left wall x SEATED (LEFT sensor): -52.21 -> -54.66 (moved -2.45, limit 3.00) | median 8.05 in spread 0.26 n 10 | bound 0.62 | faults ok. Caller-supplied text (the names, an absence sentence) goes through the Line's sanitizer. MIRROR1-A: sideNote (default none — every line byte-identical to before) is written INSIDE the sensor's parenthesis, (LEFT sensor, <sideNote>), near the line's start, so the terminal's 200-byte message cut never drops it: the everyday call passes "mirrored from red wall RIGHT" for a mirrored auton's reset (competition/auton_wall_reset.hpp).
free function, declared at include/shulib/localization/wall_reset.hpp:1240.
The header opens with the reasoning behind these shapes. It is reproduced here in full because a reference that only lists signatures teaches nobody why.
The header’s own reasoning — 54 lines, click to expand
The WALL RESET's pure core (chunk L6-A1, 2026-10-29; the L6 brief, the team lead's answers of
2026-10-22): the geometry that turns one side distance sensor's reading into ONE field coordinate,
the gates that REFUSE rather than guess, the verdict, and the one log line. Nothing here moves the
estimate or reads a clock: the calls that do are `chassis::resetFromWall` (the explicit form over
sensor handles — chassis/wall_reset_call.hpp) and `competition::resetFromWall` (the everyday form
over an auton's context — competition/auton_wall_reset.hpp, L6-A2). Both run THESE functions, so no gate
is written twice.
── What a wall reset is ─────────────────────────────────────────────────────────────────────────
A robot parked beside a field wall, nose along it and square to it, with a side sensor facing it:
the sensor's range, from the sensor's MEASURED place on the robot, says how far the robot's centre
is from that wall — ONE coordinate (x against the left/right walls, y against the red/blue walls).
The reset replaces that one coordinate of the estimate (`Localizer::seatAxis`) and nothing else:
not the other coordinate, not the heading, not the estimate's trust in itself (the drift term).
── The rules, in the order they run (the verdict names the FIRST that fails) ───────────────────
1. Setup — a sensor, its mount measured, the estimate live, NO motion active, the request sane
(the call checks the first four; `wallResetProblem` the last, naming the field).
2. Square — by the estimate's heading and the typed facing, the beam within `squareWithin` of
the wall's normal; a beam pointing AWAY is NotSquare.
3. Keep-out — the beam centre's coordinate ALONG the wall, widened by the beam's footprint, a
margin and how far the estimate may have drifted along the wall since that axis was set
(`alongDriftRate` × `Localizer::travelSinceSeat`), overlaps no active keep-out span.
4. Beam height — the expected range is at most the CEILING: past it, the cone's lower edge dips
below a standing game piece (6.5 in) + a margin, so the nearest surface could be a Pin or a Cup.
5. Stillness — on every tick, the estimate's speed over the trailing `window` (its displacement
over that time) within `stillSpeed`, and its turn rate |ω| within `stillTurn`.
6. Each sample — no read fault between its two reads, a real return (confidence > 0), enough
confidence, and the bias-corrected range inside [rangeMin, rangeMax].
7. Enough, consistent, under the ceiling — ≥ minSamples over ≥ window; spread ≤ spreadMax; the
MEDIAN's range ≤ the ceiling too (rule 4 judged the estimate; this judges what was seen).
8. Precise — the worst-case error of the answer (`axisErrorBound`) ≤ errorBoundMax.
9. Agrees — |answer − estimate| ≤ the author's maxCorrection. Then the axis is SEATED.
Rules 1-4 read no sensor and cost no time; a refusal leaves the estimate exactly as it was.
── What no gate here can catch (never claim otherwise — guide 14 lists it too) ─────────────────
Something TALLER than a game piece at a plausible distance in the beam passes every check: a robot
beside ours, a nested stack against the wall, a sensor wired to the other side's port, something
close behind a CLEAR wall panel. The defences are the author's (a tight maxCorrection; parked where
the route says), the keep-outs, the beam-height gate and the mount. A SINGLE standing Pin or Cup is
refused by rule 4 — so long as the typed height and cone are true (A4 register HA-205).
── Every number that is a belief carries its register id ──────────────────────────────────────
The sensor's accuracy (A4 register HA-204), its cone and nearest-surface behaviour (HA-205), the
wall returning a reading (HA-206), the update interval (HA-209), and every gate default (HA-211).
The season's walls and keep-outs are localization/override_walls.hpp's (HA-207, HA-208, HA-212).
PURE (the master plan's §5 layering): no chassis/, motion/, sequence/ or competition/ include — the
Localizer includes the leaf axis.hpp, and the calls sit at the layers that own their arguments.
Allocation-free (fixed std::arrays), no exceptions on a refusal (a refusal is a VALUE);
SHULIB_PRECONDITION only for programming errors (a non-finite reading handed to the geometry, too
many keep-outs handed to FieldWall::line). The angle defaults are spelled `N * kWallDegToRad`
because the `_deg` literal is not constexpr and a robot file's block must sit in a constexpr table.