Helps manage logging and telemetry in MARSLib using AdvantageKit and AdvantageScope. Use when adding new log keys, debugging Sim/Real disparities, or enforcing replay-only algorithm constraints.
You are a telemetry engineer for Team MARS 2614. When modifying logging or configuring AdvantageScope:
MARSLib uses AdvantageKit for all telemetry, enforcing deterministic log-replay:
| Component | Purpose |
|---|---|
@AutoLog inner class | Auto-generates logging for IO inputs (sensors, encoders) |
Logger.processInputs() | Records IO inputs every periodic cycle |
Logger.recordOutput() | Records algorithm outputs (setpoints, decisions, poses) |
LoggedTunableNumber | Runtime-tunable constants with automatic logging |
.wpilog files | Binary log format for post-match replay |
Hardware → IO.updateInputs() → Logger.processInputs() → [Logged as Inputs]
↓
Subsystem.periodic() algorithms → Logger.recordOutput() → [Logged as Outputs]
Inputs are recorded for replay. Outputs are recomputed from inputs during replay. This separation is what makes deterministic replay possible.
All telemetry MUST go through AdvantageKit's Logger. Do NOT use SmartDashboard.putNumber() or NetworkTableInstance.getDefault().getTable(). These bypass the replay pipeline and create non-deterministic behavior.
@AutoLog in IO classes): Sensor readings, encoder positions, current draw. These are the "truth" that gets replayed.Logger.recordOutput() in subsystems): Setpoints, decisions, computed poses. These are recomputed from inputs during replay.Never put algorithm decisions in IO inputs. Never put sensor readings in outputs. Mixing them breaks replay determinism.
Do NOT write if (!isReplay()) { ... }. The algorithm logic in periodic() must execute identically whether running live or replaying from a log. The ONLY layer that diverges is the IO implementation (real hardware vs. sim vs. replay).
The IOSim and IOReal implementations MUST use identical units. If IOReal reports position in radians, IOSim must also report radians — not rotations, not degrees. Unit mismatches are the #1 cause of "works in sim, fails on robot" bugs.
@AutoLog inner class.Logger.recordOutput("Subsystem/KeyName", value) in the subsystem's periodic()."Superstructure/CollisionClamp" not "collision_clamp".Pose2d, SwerveModuleState[], Mechanism2d.When building AdvantageScope layouts:
Logger.recordOutput() keys (e.g., RealOutputs/Swerve/Pose)Pose2d[] arraysSwerveModuleState[] arraysadvantagescope-layouts skill for MCP tool usageThese are the telemetry keys logged by the telemetry system itself:
Logger/Timestamp — Current FPGA timestampLogger/LoopCycleMs — Time taken for one full periodic cycleLogger/LogSizeBytes — Cumulative log file sizeBuildConstants/Version — Deployed code versionBuildConstants/GitSHA — Git commit hash