001/************************ PROJECT ZIXI ************************/ 002/* Copyright (c) 2026 StuyPulse Robotics. All rights reserved.*/ 003/* This work is licensed under the terms of the MIT license. */ 004/**************************************************************/ 005package com.stuypulse.robot.subsystems.swerve; 006 007import org.wpilib.math.geometry.Rotation2d; 008 009import org.littletonrobotics.junction.AutoLog; 010 011public interface ModuleIO { 012 @AutoLog 013 public static class ModuleIOInputs { 014 public boolean driveConnected = false; 015 public double drivePositionRad = 0.0; 016 public double driveVelocityRadPerSec = 0.0; 017 public double driveAppliedVolts = 0.0; 018 public double driveCurrentAmps = 0.0; 019 020 public boolean turnConnected = false; 021 public boolean turnEncoderConnected = false; 022 public Rotation2d turnAbsolutePosition = Rotation2d.ZERO; 023 public Rotation2d turnPosition = Rotation2d.ZERO; 024 public double turnVelocityRadPerSec = 0.0; 025 public double turnAppliedVolts = 0.0; 026 public double turnCurrentAmps = 0.0; 027 028 public double[] odometryTimestamps = new double[] {}; 029 public double[] odometryDrivePositionsRad = new double[] {}; 030 public Rotation2d[] odometryTurnPositions = new Rotation2d[] {}; 031 } 032 033 /** Updates the set of loggable inputs. */ 034 public default void updateInputs(ModuleIOInputs inputs) {} 035 036 /** Run the drive motor at the specified open loop value. */ 037 public default void setDriveOpenLoop(double output) {} 038 039 /** Run the turn motor at the specified open loop value. */ 040 public default void setTurnOpenLoop(double output) {} 041 042 /** Run the drive motor at the specified velocity. */ 043 public default void setDriveVelocity(double velocityRadPerSec) {} 044 045 /** Run the turn motor to the specified rotation. */ 046 public default void setTurnPosition(Rotation2d rotation) {} 047}