Skip to content

Commit

Permalink
Add TLM to SmartDashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Java4First committed Feb 6, 2024
1 parent 3895326 commit 295083d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.revrobotics.SparkAbsoluteEncoder;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
// import edu.wpi.first.wpilibj.AnalogInput;
// import edu.wpi.first.wpilibj.RobotController;
import java.util.Queue;
Expand Down Expand Up @@ -57,7 +58,11 @@ public class ModuleIOSparkMax implements ModuleIO {
private final boolean isTurnMotorInverted = true;
// private final Rotation2d absoluteEncoderOffset;

// STU
private final int m_index;

public ModuleIOSparkMax(int index) {
m_index = index;
switch (index) {
case 0: // FL
driveSparkMax = new CANSparkMax(1, MotorType.kBrushless);
Expand Down Expand Up @@ -136,6 +141,8 @@ public void updateInputs(ModuleIOInputs inputs) {
inputs.driveCurrentAmps = new double[] {driveSparkMax.getOutputCurrent()};

inputs.turnAbsolutePosition = new Rotation2d(turnAbsoluteEncoder.getPosition() * 2.0 * Math.PI);
SmartDashboard.putNumber(
"turnAbsolutePosition[" + m_index + "]", inputs.turnAbsolutePosition.getDegrees());
// turnAbsoluteEncoder.getVoltage() / RobotController.getVoltage5V() * 2.0 * Math.PI)
// .minus(absoluteEncoderOffset);
inputs.turnPosition =
Expand Down

0 comments on commit 295083d

Please sign in to comment.