WheelSpeeds — per-wheel linear surface speeds (in/s), in a drivetrain-defined wheel order (each IKinematics impl documents its own order).
This header declares 1 type (8 members).
Extracted from include/shulib/kinematics/wheel_speeds.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 the user guide; worked recipes live in the cookbook; this page is the complete, mechanical list of what exists.
class WheelSpeedsA drivetrain's per-wheel linear SURFACE speeds in in/s (units::Velocity, never a bare double — the units wall reaches the motor edge), indexed in that drivetrain's own wheel order. Each IKinematics implementation documents its order; this type does not know which one it is holding, so a set from one drivetrain means nothing to another. A plain value type with fixed inline capacity and no heap, because one of these is produced every control tick. The wheel COUNT is fixed at construction — there is no push or resize, so you build a set of size n and set() into it.
class, declared at include/shulib/kinematics/wheel_speeds.hpp:34.
static constexpr int kMaxWheels = 8Hard upper bound on wheel count (see header note). Generous on purpose.
field, declared at include/shulib/kinematics/wheel_speeds.hpp:37.
WheelSpeeds() = defaultAn empty set (size 0). Used as a default / accumulator seed.
function, declared at include/shulib/kinematics/wheel_speeds.hpp:40.
explicit WheelSpeeds(int count)A zero-initialized set of count wheels. count must be in [0, kMaxWheels].
function, declared at include/shulib/kinematics/wheel_speeds.hpp:43.
[[nodiscard]] int size() const noexceptWheels in the set, fixed at construction: this IS the valid index range for operator[] and set(), and 0 for a default-constructed set. For anything IKinematics::toWheels() produced it equals that drivetrain's wheelCount().
function, declared at include/shulib/kinematics/wheel_speeds.hpp:51.
[[nodiscard]] units::Velocity operator[](int i) constThe i-th wheel speed. Precondition: 0 <= i < size().
function, declared at include/shulib/kinematics/wheel_speeds.hpp:54.
void set(int i, units::Velocity speed)Set the i-th wheel speed. Precondition: 0 <= i < size().
function, declared at include/shulib/kinematics/wheel_speeds.hpp:60.
[[nodiscard]] units::Velocity maxMagnitude() const noexceptLargest |wheel speed| across the set (0 for an empty set). The quantity a uniform desaturation scales against.
function, declared at include/shulib/kinematics/wheel_speeds.hpp:67.
[[nodiscard]] bool approxEqual(const WheelSpeeds& o, double tol = 1e-9) const noexceptElement-wise comparison within tol, which is an ABSOLUTE tolerance in in/s — not relative, and not a norm over the set: every wheel must agree on its own. Differing sizes compare UNEQUAL rather than tripping a precondition, so it is safe to call across drivetrains. Signs matter: a reversed wheel is not approximately the forward one. A comparison for tests and assertions, not an equivalence relation — tolerance comparison is not transitive.
function, declared at include/shulib/kinematics/wheel_speeds.hpp:81.
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 — 14 lines
WheelSpeeds — per-wheel linear *surface* speeds (in/s), in a drivetrain-defined
wheel order (each IKinematics impl documents its own order).
Why a fixed inline capacity (no heap):
* cheap and allocation-free on the V5 (this is produced every ~10ms tick),
* trivially value-typed for host tests.
kMaxWheels is deliberately generous: a FROZEN contract (F5) should never need a
version bump merely to gain a wheel. Current drives fit easily — tank=2, H=3,
X/mecanum=4, swerve drive-speeds=4.
The element type is units::Velocity, not a bare double, so the units wall (F3)
reaches all the way to the motor edge: you cannot accidentally feed a length or
a voltage in where a wheel speed belongs.