Skip to content

Skip AdvantageKit mirror of Property values from NetworkTables (-459 entries for 2026 code in sim)#675

Open
aschokking wants to merge 1 commit into
mainfrom
claude/properties-skip-nt-publish
Open

Skip AdvantageKit mirror of Property values from NetworkTables (-459 entries for 2026 code in sim)#675
aschokking wants to merge 1 commit into
mainfrom
claude/properties-skip-nt-publish

Conversation

@aschokking

@aschokking aschokking commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

This PR was written by Claude Opus 4.8 with my direction and manual verification of changes.

Why are we doing this?

Each Property currently costs two NetworkTables entries:

  1. /Preferences/<prefix>/<suffix> — the WPILib Preferences-backed editable/savable dashboard surface.
  2. /AdvantageKit/<prefix>/<suffix> — a mirror created by Logger.processInputs(...) in Property.refreshDataFrame(), which records the value as a LoggableInputs so replay sees what the robot used.

The AKit mirror has to exist for replay correctness, but it doesn't need to be published over NetworkTables — dashboards already see the value via /Preferences/.... With well over a thousand Properties on the bot, the redundant mirrors are a meaningful chunk of the NT load that's been stressing the rio.

This PR drops the AKit mirror's path to NT, keeps it on disk for replay, and leaves /Preferences/... untouched.

Whats changing?

New: xbot.common.advantage.PropertySkippingNT4Publisher — a LogDataReceiver that wraps NT4Publisher. On each putTable, it builds a filtered copy of the incoming LogTable that omits any entry under the PropertyMirror/ namespace, then forwards to the real NT4Publisher. The WPILOGWriter data receiver is untouched — disk capture (and therefore replay) is unaffected.

Property base class — added public static final String AKIT_LOG_NAMESPACE = "PropertyMirror/" and a protected akitLogPrefix() helper that returns PropertyMirror/<prefix>. Subclasses use it when calling Logger.processInputs(...).

Property subclassesDoubleProperty, BooleanProperty, StringProperty, MeasureProperty all change Logger.processInputs(prefix, inputs)Logger.processInputs(akitLogPrefix(), inputs). One-line each.

BaseRobot.robotInit()new NT4Publisher()new PropertySkippingNT4Publisher().

Measured impact

Counted live against the TeamXbot2026 sim using a small ntcore-based Python script (connect as an NT4 client, subscribe "" with the topics-only flag, wait for announcements, group by path).

Top-level NT tables

Top-level table Before After Δ
/AdvantageKit 937 478 −459
/Preferences 459 459 0
/SmartDashboard 184 184 0
/photonvision 85 85 0
/CameraPublisher 48 48 0
/.schema 16 16 0
/FMSInfo 9 9 0
/PathPlanner 4 4 0
/Shuffleboard 3 3 0
/LiveWindow 1 1 0
Total 1746 1287 −459 (−26%)

Drop is exactly the number of /Preferences/... entries — every WPILib Preference that had an AKit mirror has lost the mirror. Nothing else moved.

Per-subsystem matching: AKit mirror is decoupled, Preferences is intact

Subsystem /Preferences/<X> before → after /AdvantageKit/<X> before → after
ShooterSubsystem 82 → 82 82 → 0
AprilTagVisionSubsystemExtended 40 → 40 60 → 20
ClimberSubsystem 36 → 36 37 → 1
IntakeDeploySubsystem 36 → 36 36 → 0
HopperRollerSubsystem 34 → 34 34 → 0
CollectorSubsystem 30 → 30 30 → 0
ShooterFeederSubsystem 30 → 30 30 → 0
SwerveDriveSubsystem 28 → 28 28 → 0
SwerveSteeringSubsystem 27 → 27 27 → 0
DriveSubsystem 22 → 22 74 → 52
Simulator 16 → 16 16 → 0
TrajectoriesCalculation 14 → 14 14 → 0
HoodSubsystem 7 → 7 (not in top-40)
IntakeDeployAdaptiveCloseWhileFiringCommand 7 → 7 (not in top-40)

The /Preferences/<X> column is unchanged everywhere (dashboards still see and edit the values). The /AdvantageKit/<X> column drops to 0 wherever everything under that subtable was a property mirror, and drops by exactly the Preferences count where the subsystem also has real telemetry going through aKitLog.record(...) (e.g. DriveSubsystem keeps 52 telemetry keys, AprilTagVisionSubsystemExtended keeps 20).

Questions/notes for reviewers

  • Naming. I picked PropertyMirror/ (rather than Properties/) deliberately so the deny prefix in the wrapper reads less ambiguously next to WPILib's Preferences table. They sit close together conceptually and the original name kept tripping me up when re-reading the code.

How this was tested

  • unit tests added (8 new tests in PropertySkippingNT4PublisherTest; full suite: 294 tests, 0 failures, 10 skipped)
  • tested on robot (sim) — TeamXbot2026 sim, NT topic count and per-subsystem breakdown captured above

🤖 Generated with Claude Code

Properties currently cost two NT entries each: one at /Preferences/<prefix>/<suffix>
(WPILib Preferences, the editable/savable dashboard surface) and a redundant
mirror at /AdvantageKit/<prefix>/<suffix> that comes from Logger.processInputs()
recording the property value for replay correctness.

Route Property processInputs() calls through a dedicated PropertyMirror/ subtable
in the AKit log, then wrap NT4Publisher to drop that subtable on the way to NT.
The on-disk WPILOG receiver still captures everything, so replay sees the
property value the robot used. The /Preferences/... surface is unchanged.

Net effect: roughly halves the AdvantageKit slice of NT traffic with no loss
of dashboard editability or replay fidelity.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@aschokking aschokking requested a review from a team as a code owner June 5, 2026 02:47
@aschokking aschokking changed the title Skip AdvantageKit mirror of Property values from NetworkTables Skip AdvantageKit mirror of Property values from NetworkTables (-459 entries for 2026 code in sim) Jun 5, 2026
@aschokking aschokking requested a review from stephenjust June 5, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant