Skip to content

Add EnergyMonitor for motor power and energy tracking#73

Open
tytremblay wants to merge 1 commit intomainfrom
ty/energyMonitor
Open

Add EnergyMonitor for motor power and energy tracking#73
tytremblay wants to merge 1 commit intomainfrom
ty/energyMonitor

Conversation

@tytremblay
Copy link
Contributor

Summary

Adds an EnergyMonitor static singleton that tracks power and energy usage for all motors across the robot.

Changes

  • EnergyManagement.EnergyMonitor: Static singleton that subsystems report voltage/current to

    • Tracks per-motor: power, total energy, energy draw, energy regenerated, peak power/current
    • Aggregates per-subsystem and robot-wide
    • Logs to AdvantageKit with unit metadata (Watts, Volts, Amps, Joules)
  • Integration points:

    • MotorSubsystem: reports single motor as "Motor"
    • MotorFollowerSubsystem: reports "Leader" and "Follower"
    • Module: reports "Module{n}_Drive" and "Module{n}_Turn" per swerve module
    • Robot.robotPeriodic(): calls EnergyMonitor.log() after scheduler
  • Drive modules: Use supply current instead of stator current (ModuleIOTalonFX, ModuleIOTalonFXS)

AdvantageKit paths

  • Per-motor: EnergyMonitor/{subsystem}/{motor}/PowerW, etc.
  • Per-subsystem: EnergyMonitor/{subsystem}/Total/PowerW, etc.
  • Robot: EnergyMonitor/Robot/PowerW, etc.

Made with Cursor

- Add EnergyMonitor static singleton in EnergyManagement.java
- Subsystems report voltage/current; monitor tracks power, energy draw, regen
- Per-motor, per-subsystem, and robot-wide aggregation logged to AdvantageKit
- Integrate reporting in MotorSubsystem, MotorFollowerSubsystem, Module
- Call EnergyMonitor.log() from Robot.robotPeriodic()
- Use supply current instead of stator for drive modules (ModuleIOTalonFX, ModuleIOTalonFXS)

Made-with: Cursor
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