Package frc.robot.viz

Class RobotViz

java.lang.Object
frc.robot.viz.RobotViz

@NullMarked public class RobotViz extends Object
Centralized visualization helper for publishing robot state to logging and visualization tools.

This class is responsible for publishing robot poses, mechanism transforms, and subsystem geometry to Logger for visualization tools such as AdvantageScope. It computes both estimated and (when available) ground-truth representations of the robot state.

Estimated vs Ground-Truth Data

  • Estimated data is sourced from live subsystems (swerve, turret, hood, etc.) and reflects what the robot believes its state to be.
  • Ground-truth data is sourced from SimulatedRobotState when running in simulation. When not simulating, ground-truth outputs are aliased to the estimated state.

All outputs are published via Logger and are intended strictly for debugging, analysis, and visualization (e.g., AdvantageScope). No control or decision-making logic should depend on this class.

  • Constructor Details

    • RobotViz

      public RobotViz(@Nullable SimulatedRobotState sim, Swerve swerve, Turret turret, AdjustableHood hood, Intake intake, Climber climber)
      Creates a new visualization helper.

      The visualization system automatically switches between estimated-only and estimated-plus-ground-truth modes depending on whether a simulation state is provided.

      Parameters:
      sim - simulation state used for ground-truth visualization; may be null
      swerve - live swerve subsystem providing pose estimates
      turret - live turret subsystem
      hood - adjustable hood subsystem
      intake - intake subsystem
      climber - climber subsystem
  • Method Details

    • periodic

      public void periodic()
      Publishes visualization data for the current control loop iteration.

      This method should be called periodically (e.g., from robotPeriodic).