-
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
5 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
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,6 @@ | ||
package frc.robot.subsystems.pivot; | ||
|
||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
||
public class Pivot extends SubsystemBase{ | ||
} |
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,9 @@ | ||
package frc.robot.subsystems.pivot; | ||
|
||
import java.util.concurrent.Flow.Publisher; | ||
|
||
public class PivotConstants{ | ||
public static int pivotMotorID = 0; //not right | ||
public static int stallLimit = 30; //not right | ||
public static int freeLimit = 20; //not right | ||
} |
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,14 @@ | ||
package frc.robot.subsystems.pivot; | ||
|
||
import org.littletonrobotics.junction.AutoLog; | ||
|
||
public interface PivotIO { | ||
@AutoLog | ||
public static class PivotIOInputs { | ||
public double position = 0; | ||
public double velocity = 0; | ||
public double voltage = 0; | ||
} | ||
public default void setVoltage(double voltage) {}; | ||
public default void updateInputs(PivotIOInputs inputs) {}; | ||
} |
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,33 @@ | ||
package frc.robot.subsystems.pivot; | ||
|
||
import com.revrobotics.AbsoluteEncoder; | ||
import com.revrobotics.spark.SparkMax; | ||
import com.revrobotics.spark.SparkBase.PersistMode; | ||
import com.revrobotics.spark.SparkBase.ResetMode; | ||
import com.revrobotics.spark.SparkLowLevel.MotorType; | ||
import com.revrobotics.spark.config.SparkBaseConfig; | ||
import com.revrobotics.spark.config.SparkMaxConfig; | ||
|
||
public class PivotIOReal implements PivotIO { | ||
private SparkMax pivotMotor = new SparkMax(PivotConstants.pivotMotorID, MotorType.kBrushless); | ||
private SparkMaxConfig config = new SparkMaxConfig(); | ||
private AbsoluteEncoder encoder = pivotMotor.getAbsoluteEncoder(); | ||
public PivotIOReal() { | ||
config.smartCurrentLimit(PivotConstants.stallLimit); | ||
pivotMotor.configure(config, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters); | ||
pivotMotor.getStickyFaults(); | ||
} | ||
|
||
@Override | ||
public void setVoltage(double voltage) { | ||
pivotMotor.setVoltage(voltage); | ||
} | ||
|
||
@Override | ||
public void updateInputs(PivotIOInputs inputs) { | ||
inputs.voltage = pivotMotor.getBusVoltage(); | ||
inputs.position = encoder.getPosition(); | ||
inputs.velocity = encoder.getVelocity(); | ||
} | ||
|
||
} |
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,5 @@ | ||
package frc.robot.subsystems.pivot; | ||
|
||
public class PivotIOSim { | ||
private | ||
} |