This repository has been archived by the owner on Jan 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/main/java/frc/robot/subsystems/rollers/RollerIOsparkmax.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package frc.robot.subsystems.rollers; | ||
|
||
import com.revrobotics.CANSparkBase.ControlType; | ||
import com.revrobotics.CANSparkLowLevel.MotorType; | ||
import com.revrobotics.CANSparkMax; | ||
import com.revrobotics.RelativeEncoder; | ||
import com.revrobotics.SparkPIDController; | ||
import com.revrobotics.SparkPIDController.ArbFFUnits; | ||
import edu.wpi.first.math.util.Units; | ||
|
||
|
||
|
||
public class RollerIOsparkmax implements RollersIO { | ||
private final CANSparkMax rollerMotor = new CANSparkMax(0,MotorType.kBrushless); | ||
|
||
public RollerIOsparkmax() { | ||
rollerMotor.restoreFactoryDefaults(); | ||
} | ||
@Override | ||
public void updateInputs(RollerIOInputs inputs){ | ||
inputs.appliedVolts = rollerMotor.getAppliedOutput() * rollerMotor.getBusVoltage(); | ||
inputs.currentAmps = rollerMotor.getOutputCurrent(); | ||
} | ||
|
||
@Override | ||
public void runVolts(double volts){ | ||
rollerMotor.setVoltage(volts); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package frc.robot.subsystems.rollers; | ||
|
||
import edu.wpi.first.math.controller.SimpleMotorFeedforward; | ||
import edu.wpi.first.math.util.Units; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine; | ||
import frc.robot.Constants; | ||
import org.littletonrobotics.junction.AutoLogOutput; | ||
import org.littletonrobotics.junction.Logger; | ||
|
||
public class Rollers extends SubsystemBase{ | ||
private final RollersIO io; | ||
//private final RollersIOInputsAutoLogged inputs = new RollersIOInputsAutoLogged(); | ||
|
||
public Rollers(RollersIO io){ | ||
this.io = io; | ||
} | ||
|
||
public void runVolts(double volts){ | ||
io.setVoltage(volts); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package frc.robot.subsystems.rollers; | ||
|
||
import org.littletonrobotics.junction.AutoLog; | ||
|
||
public interface RollersIO { | ||
@AutoLog | ||
public static class RollerIOInputs { | ||
public double positionRad = 0.0; | ||
public double velocityRadPerSec = 0.0; | ||
public double appliedVolts = 0.0; | ||
public double currentAmps = 0.0; | ||
} | ||
|
||
public default void updateInputs(RollerIOInputs inputs) {} | ||
|
||
public default void runVolts(double volts) {} | ||
|
||
public default void stopRoller() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package frc.robot.subsystems.rollers; | ||
|
||
public class rollerIOsim {} |