Skip to content

Add power monitor: per-subsystem current by CAN ID (no PDH mapping) - #2

Open
Ashrayg09 wants to merge 1 commit into
glendale-working-branchfrom
power-monitor-integration
Open

Ashrayg09 wants to merge 1 commit into
glendale-working-branchfrom
power-monitor-integration

Conversation

@Ashrayg09

Copy link
Copy Markdown

What

Adds a per-subsystem power monitor that reads current from the motor controllers by CAN ID (6328 / AdvantageKit style) — no PDH channel mapping or wire tracing. Runs alongside existing code; nothing is replaced.

Files

  • frc/robot/power/ (new, self-contained — no dependency on Constants.java):
    • MotorCurrentMonitor — sums per-subsystem motor current; publishes to NetworkTables + a "Power (motors)" Shuffleboard tab + DataLog; also opens the REV PDH for full-system total (PdhTotalCurrent) + bus voltage.
    • BatteryEstimator (Thevenin + Peukert + Kalman SOC), BreakerThermalModel (Miner's-rule breaker heat), FinanceDepartment (dynamic drive-current allocation), PowerConstants (thresholds).
  • RobotContainer.java — adds a powerMonitor field + configurePowerMonitor() that registers every TalonFX by CAN ID / bus, called on the real robot.

Motor map (pulled from this robot's config)

  • Swerve Drive (KrakenX60) 1/4/7/10 · Swerve Steer (KrakenX44) 3/6/9/12 — bus Canivore
  • Shooter 19/20 · Feeder 14/15/23 · Intake 24/25 · Hood 21 · Turret 17 — bus rio

How to test

Deploy, enable, run each mechanism → its bar moves in the "Power (motors)" Shuffleboard tab and under NetworkTables PowerMonitor/. DataLog under /power/ for AdvantageScope.

Notes

  • Uses read-only TalonFX handles by CAN ID (Phoenix 6 allows multiple objects per device), so no existing subsystem objects are touched.
  • Per-subsystem = motor supply current; PdhTotalCurrent gives the true system total incl. non-motor loads.
  • Verified: ./gradlew compileJava succeeds on this branch.

🤖 Generated with Claude Code

Reads per-subsystem current from the TalonFX motors by CAN ID (no PDH channel
mapping). New self-contained frc.robot.power package + RobotContainer wiring.
Publishes to NetworkTables, a Power (motors) Shuffleboard tab, and DataLog;
also opens the REV PDH for full-system total + bus voltage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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