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.

Currently, this class publishes visualization data related to drivetrain state, including the robot's global pose and derived camera poses.

Future intent: This class is intended to become the single location responsible for publishing visualization data for all robot subsystems, such as elevators, arms, intakes, and other articulated mechanisms. Each subsystem will contribute geometry or pose data that can be rendered together in a unified visualization view.

This class supports both real and simulated operation:

  • When a SwerveSim instance is provided, visualization data is sourced from the simulator's ground-truth drivetrain pose.
  • Otherwise, certain entries with keys indicating ground truth use estimates instead, often duplicating other entries (e.g. ActualPose will be equivalent to GlobalEstPose).

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 SwerveSim sim, Swerve swerve)
      Creates a new visualization helper.
      Parameters:
      sim - optional swerve simulator; when provided, simulated ground-truth drivetrain pose is used for visualization
      swerve - live swerve subsystem providing pose estimates when not simulating
  • 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).

      As additional subsystems are integrated, this method will be extended to publish poses, transforms, and geometry for other mechanisms relative to the robot frame.