import com.ctre.phoenix6.controls.Follower;
import com.ctre.phoenix6.controls.MotionMagicVoltage;
import com.ctre.phoenix6.hardware.TalonFX;
+import com.ctre.phoenix6.signals.InvertedValue;
import com.ctre.phoenix6.signals.MotorAlignmentValue;
import com.ctre.phoenix6.signals.NeutralModeValue;
TalonFXConfiguration rollerConfig = new TalonFXConfiguration();
// config the current limits (low value for testing)
- // add constant for currentLimits
rollerConfig.CurrentLimits
- .withStatorCurrentLimit(40.0)
+ .withStatorCurrentLimit(IntakeConstants.extendCurrentLimits)
.withStatorCurrentLimitEnable(true)
- .withSupplyCurrentLimit(40.0)
+ .withSupplyCurrentLimit(IntakeConstants.extendCurrentLimits)
.withSupplyCurrentLimitEnable(true);
// config Slot 0 PID params
// config the current limits (low value for testing)
config.CurrentLimits
- .withStatorCurrentLimit(10.0)
+ .withStatorCurrentLimit(IntakeConstants.rCurrentLimits)
.withStatorCurrentLimitEnable(true)
- .withSupplyCurrentLimit(10.0)
+ .withSupplyCurrentLimit(IntakeConstants.rCurrentLimits)
.withSupplyCurrentLimitEnable(true);
// config Slot 0 PID params
// apply the configuration to the right motor (master)
rightMotor.getConfigurator().apply(config);
-
+
// apply the configuration to the left motor (slave)
leftMotor.getConfigurator().apply(config);
SmartDashboard.putData("Retract Intake", new InstantCommand(this::retract));
SmartDashboard.putData("Intake On", new InstantCommand(this::spinStart));
SmartDashboard.putData("Intake Off", new InstantCommand(this::spinStop));
- SmartDashboard.putData("Roller Spin Forward", new InstantCommand(() -> this.spin(0.5), this));
+ SmartDashboard.putData("Roller Spin Forward", new InstantCommand(() -> this.spin(0.8), this));
SmartDashboard.putData("Roller Spin Reverse", new InstantCommand(() -> this.spin(-0.5), this));
SmartDashboard.putData("Roller Stop", new InstantCommand(() -> this.spin(0.0), this));
SmartDashboard.putData("Zero Motors", new InstantCommand(this::zeroMotors));
public void setPosition(double setpoint) {
double motorRotations =inchesToRotations(setpoint);
rightMotor.setControl(voltageRequest.withPosition(motorRotations));
+
}
/**
+++ /dev/null
-package frc.robot.subsystems.indexer;
-
-import com.ctre.phoenix6.hardware.TalonFX;
-
-import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
-import edu.wpi.first.wpilibj2.command.InstantCommand;
-import edu.wpi.first.wpilibj2.command.SubsystemBase;
-
-public class Spindexer extends SubsystemBase {
- private TalonFX motor;
-
- public Spindexer(){
- // TODO: change device id
- motor = new TalonFX(1);
-
- // Smartdashboard commands
- SmartDashboard.putData("Run", new InstantCommand(()-> run()));
- SmartDashboard.putData("Slow", new InstantCommand(()-> slow()));
- SmartDashboard.putData("Reverse", new InstantCommand(()-> reverse()));
- SmartDashboard.putData("Stop", new InstantCommand(()-> stop()));
-
- }
-
- public void run(){
- motor.set(1);
- }
-
- public void slow(){
- motor.set(0.6);
- }
-
- public void reverse(){
- motor.set(-1);
- }
-
- public void stop(){
- motor.set(0);
- }
-}