Adding a few subsystems, not sure I like the use of periodic for the shooter and intake pivot subsystems
This commit is contained in:
69
src/main/java/frc/robot/constants/IntakePivotConstants.java
Normal file
69
src/main/java/frc/robot/constants/IntakePivotConstants.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package frc.robot.constants;
|
||||
|
||||
import com.revrobotics.spark.FeedbackSensor;
|
||||
import com.revrobotics.spark.config.SparkMaxConfig;
|
||||
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
|
||||
|
||||
public class IntakePivotConstants {
|
||||
// TODO Real values
|
||||
public enum IntakePivotPosition {
|
||||
kUp(0),
|
||||
kDown(0);
|
||||
private double positionRadians;
|
||||
|
||||
private IntakePivotPosition(double positionRadians) {
|
||||
this.positionRadians = positionRadians;
|
||||
}
|
||||
|
||||
public double getPositionRadians() {
|
||||
return positionRadians;
|
||||
}
|
||||
}
|
||||
|
||||
public static final int kLeftMotorCANID = 0;
|
||||
public static final int kRightMotorCANID = 1;
|
||||
|
||||
public static final double kConversionFactor = 0;
|
||||
|
||||
public static final double kP = 0;
|
||||
public static final double kI = 0;
|
||||
public static final double kD = 0;
|
||||
public static final double kS = 0;
|
||||
public static final double kV = 0;
|
||||
public static final double kA = 0;
|
||||
|
||||
public static final boolean kInvertMotors = false;
|
||||
|
||||
public static final int kCurrentLimit = 30;
|
||||
|
||||
public static final IdleMode kIdleMode = IdleMode.kBrake;
|
||||
|
||||
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||
|
||||
public static final SparkMaxConfig leftMotorConfig = new SparkMaxConfig();
|
||||
public static final SparkMaxConfig rightMotorConfig = new SparkMaxConfig();
|
||||
|
||||
static {
|
||||
leftMotorConfig
|
||||
.idleMode(kIdleMode)
|
||||
.smartCurrentLimit(kCurrentLimit)
|
||||
.inverted(kInvertMotors);
|
||||
leftMotorConfig.absoluteEncoder
|
||||
.positionConversionFactor(kConversionFactor)
|
||||
.velocityConversionFactor(kConversionFactor / 60);
|
||||
leftMotorConfig.closedLoop
|
||||
.feedbackSensor(FeedbackSensor.kAbsoluteEncoder)
|
||||
.pid(kP, kI, kD)
|
||||
.outputRange(-1, 1)
|
||||
.positionWrappingEnabled(true)
|
||||
.positionWrappingInputRange(0, 2 * Math.PI)
|
||||
.feedForward
|
||||
.sva(kS, kV, kA);
|
||||
|
||||
rightMotorConfig
|
||||
.idleMode(kIdleMode)
|
||||
.smartCurrentLimit(kCurrentLimit)
|
||||
.inverted(kInvertMotors)
|
||||
.follow(kLeftMotorCANID);
|
||||
}
|
||||
}
|
||||
34
src/main/java/frc/robot/constants/IntakeRollerConstants.java
Normal file
34
src/main/java/frc/robot/constants/IntakeRollerConstants.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package frc.robot.constants;
|
||||
|
||||
import com.revrobotics.spark.config.SparkMaxConfig;
|
||||
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
|
||||
|
||||
public class IntakeRollerConstants {
|
||||
// TODO Real values
|
||||
public static final int kLeftMotorCANID = 0;
|
||||
public static final int kRightMotorCANID = 0;
|
||||
|
||||
public static final int kCurrentLimit = 30;
|
||||
|
||||
public static final boolean kInvertMotors = false;
|
||||
|
||||
public static final IdleMode kIdleMode = IdleMode.kCoast;
|
||||
|
||||
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||
|
||||
public static final SparkMaxConfig leftMotorConfig = new SparkMaxConfig();
|
||||
public static final SparkMaxConfig rightMotorConfig = new SparkMaxConfig();
|
||||
|
||||
static {
|
||||
leftMotorConfig
|
||||
.idleMode(kIdleMode)
|
||||
.smartCurrentLimit(kCurrentLimit)
|
||||
.inverted(kInvertMotors);
|
||||
|
||||
rightMotorConfig
|
||||
.idleMode(kIdleMode)
|
||||
.smartCurrentLimit(kCurrentLimit)
|
||||
.inverted(kInvertMotors)
|
||||
.follow(kLeftMotorCANID);
|
||||
}
|
||||
}
|
||||
32
src/main/java/frc/robot/constants/SpindexerConstants.java
Normal file
32
src/main/java/frc/robot/constants/SpindexerConstants.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package frc.robot.constants;
|
||||
|
||||
import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
|
||||
import com.ctre.phoenix6.configs.MotorOutputConfigs;
|
||||
import com.ctre.phoenix6.signals.InvertedValue;
|
||||
import com.ctre.phoenix6.signals.NeutralModeValue;
|
||||
|
||||
public class SpindexerConstants {
|
||||
// TODO Real values
|
||||
public static final int kMotorCANID = 0;
|
||||
|
||||
public static final int kStatorCurrentLimit = 80;
|
||||
public static final int kSupplyCurrentLimit = 30;
|
||||
|
||||
public static final InvertedValue kInversionState = InvertedValue.Clockwise_Positive;
|
||||
public static final NeutralModeValue kIdleMode = NeutralModeValue.Brake;
|
||||
|
||||
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||
|
||||
public static final CurrentLimitsConfigs kCurrentLimitConfig = new CurrentLimitsConfigs();
|
||||
public static final MotorOutputConfigs kMotorConfig = new MotorOutputConfigs();
|
||||
|
||||
static {
|
||||
kCurrentLimitConfig.StatorCurrentLimitEnable = true;
|
||||
kCurrentLimitConfig.SupplyCurrentLimitEnable = true;
|
||||
kCurrentLimitConfig.StatorCurrentLimit = kStatorCurrentLimit;
|
||||
kCurrentLimitConfig.SupplyCurrentLimit = kSupplyCurrentLimit;
|
||||
|
||||
kMotorConfig.Inverted = kInversionState;
|
||||
kMotorConfig.NeutralMode = kIdleMode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user