Skip to content

Audit: Identify ~193 unnecessary logging fields for reduction#87

Draft
Copilot wants to merge 1 commit into85-claude-optimizationfrom
copilot/reduce-logging-fields
Draft

Audit: Identify ~193 unnecessary logging fields for reduction#87
Copilot wants to merge 1 commit into85-claude-optimizationfrom
copilot/reduce-logging-fields

Conversation

Copy link

Copilot AI commented Mar 1, 2026

Analysis of current logging footprint to identify fields that can be removed or gated behind feature flags. Current total: ~340 fields logged per cycle.

Key Findings

High-impact reduction targets (~193 fields)

  • MotorInputsAutoLogged redundant fields (36 fields): rawRotorPositionRadians, supplyCurrentAmps, tempCelsius, closedLoopOutput rarely needed outside debugging
  • Follower motor logging (33 fields): Shooter follower + 2 intake roller followers log identical data to their leaders
  • LoggedTunableNumbers (~70 fields): All tuning params logged even during matches—should gate behind useTuningServer
  • Swerve module currents/voltages (16 fields): Only needed for diagnostics
  • Duplicate state machine logging (~7 fields): Every subsystem logs both State and StateAfter
  • ShotCalculations debug outputs (~25 fields): 25 Logger.recordOutput calls only useful during shot tuning
  • Redundant closed-loop reference logging (~6 fields): Manually logged despite being in MotorInputs

Recommended feature flags

Flag Purpose
verboseMotorLogging Gate rarely-used motor fields (coppercore change)
logFollowerMotors Control follower motor input logging
verboseDriveLogging Gate swerve module current/voltage logging
logShotCalculations Gate ShotCalculations debug outputs

Current field breakdown

Source Count
MotorInputsAutoLogged (9 motors × 11) 99
ModuleIO (4 modules × 14) 56
LoggedTunableNumbers ~70
Logger.recordOutput calls ~110
@AutoLogOutput annotations 22

No code changes in this PR—analysis only.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 3015rangerrobotics.github.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)
  • frcmaven.wpi.edu
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)
  • maven.ctr-electronics.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)
  • maven.photonvision.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)
  • maven.revrobotics.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Based on the changes and info already in this branch, we need to log less fields. Preferably a few hundred less. Find unnecessary logging or fields that could be made optional with a feature flag. Summarize all of these fields in this chat, without making code changes yet.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Reduce number of logged fields in application Audit: Identify ~193 unnecessary logging fields for reduction Mar 1, 2026
@godmar
Copy link
Contributor

godmar commented Mar 3, 2026

Analysis of current logging footprint to identify fields that can be removed or gated behind feature flags. Current total: ~340 fields logged per cycle.

Key Findings

High-impact reduction targets (~193 fields)

* **MotorInputsAutoLogged redundant fields (36 fields)**: `rawRotorPositionRadians`, `supplyCurrentAmps`, `tempCelsius`, `closedLoopOutput` rarely needed outside debugging

I would agree here. These are all logged via @AutoLog on MotorInput, so making this optional will require some thinking about how to design this.

* **Follower motor logging (33 fields)**: Shooter follower + 2 intake roller followers log identical data to their leaders

* **LoggedTunableNumbers (~70 fields)**: All tuning params logged even during matches—should gate behind `useTuningServer`

We should definitely address this by adding (most of these) only when actually entering a tuning/test mode.

* **Swerve module currents/voltages (16 fields)**: Only needed for diagnostics

* **Duplicate state machine logging (~7 fields)**: Every subsystem logs both `State` and `StateAfter`

This should definitely be gated behind a "debugStateMachine" flag.

* **ShotCalculations debug outputs (~25 fields)**: 25 Logger.recordOutput calls only useful during shot tuning

* **Redundant closed-loop reference logging (~6 fields)**: Manually logged despite being in MotorInputs

@aidnem
Copy link
Contributor

aidnem commented Mar 3, 2026

Analysis of current logging footprint to identify fields that can be removed or gated behind feature flags. Current total: ~340 fields logged per cycle.

Key Findings

High-impact reduction targets (~193 fields)

* **MotorInputsAutoLogged redundant fields (36 fields)**: `rawRotorPositionRadians`, `supplyCurrentAmps`, `tempCelsius`, `closedLoopOutput` rarely needed outside debugging

I would agree here. These are all logged via @AutoLog on MotorInput, so making this optional will require some thinking about how to design this.

I think we can remove the closed loop output field (it can be viewed in phoenix tuner during tuning, and it shouldn't be needed after that point). in my opinion, temperatures are important because if we do experience thermal problems during a competition we need to be able to tell that by viewing logs.

rawRotorPositionRadians is technically useful because, when using a FusedCANCoder or RemoteCANCoder configuration, it is the only way to tell the actual position of the motor. However, since we aren't using a CANCoder this year, we can probably temporarily remove it and kick this can down the road.

* **Follower motor logging (33 fields)**: Shooter follower + 2 intake roller followers log identical data to their leaders

* **LoggedTunableNumbers (~70 fields)**: All tuning params logged even during matches—should gate behind `useTuningServer`

We should definitely address this by adding (most of these) only when actually entering a tuning/test mode.

Agreed. This is ready for review in #91

* **Swerve module currents/voltages (16 fields)**: Only needed for diagnostics

I think at least the currents are once again useful in log viewing.

  • Duplicate state machine logging (~7 fields): Every subsystem logs both State and StateAfter

This should definitely be gated behind a "debugStateMachine" flag.

I can get a quick PR ready for this one as well.

* **ShotCalculations debug outputs (~25 fields)**: 25 Logger.recordOutput calls only useful during shot tuning

The logging here can definitely be cut down some.

  • Redundant closed-loop reference logging (~6 fields): Manually logged despite being in MotorInputs

These are needed because they are logged without proper units in the motor IOs since they can either be a velocity or a position depending on the closed loop mode.

@aidnem aidnem added the reference These PRs have reference changes (usually AI-authored) that probably won't merge label Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reference These PRs have reference changes (usually AI-authored) that probably won't merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants