Skip to content

Commit

Permalink
added proper sysid things to intake/amper
Browse files Browse the repository at this point in the history
  • Loading branch information
7028Robotics committed Feb 16, 2024
1 parent e5e03a8 commit 3d7002d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
3 changes: 0 additions & 3 deletions src/main/java/frc/robot/subsystems/AmpShooterSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ public class AmpShooterSubsystem extends SubsystemBase {
private final VelocityTorqueCurrentFOC ampMotorVelocity = new VelocityTorqueCurrentFOC(0, 0, 0, 1, false, false,
false);

public AmpShooterSubsystem() {
}

// device id is a placeholder!!!
private final TalonFX ampShooterMotor = new TalonFX(DEVICE_ID_TRAP_AMP_SHOOTER);

Expand Down
20 changes: 2 additions & 18 deletions src/main/java/frc/robot/subsystems/IntakeSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
package frc.robot.subsystems;

import static edu.wpi.first.units.Units.Volts;
//import static frc.robot.Constants.IntakeConstants.DEPLOY_SLOT_CONFIGS;
//import static frc.robot.Constants.IntakeConstants.DEVICE_ID_DEPLOY_CANCODER;
//import static frc.robot.Constants.IntakeConstants.DEVICE_ID_DEPLOY_MOTOR;
import static frc.robot.Constants.IntakeConstants.DEVICE_ID_ROLLERS_MOTOR;
//import static frc.robot.Constants.IntakeConstants.ROLLERS_SLOT_CONFIGS;
import static frc.robot.Constants.IntakeConstants.MagnetOffsetValue;

import com.ctre.phoenix6.configs.CANcoderConfiguration;
Expand All @@ -31,40 +27,28 @@ public class IntakeSubsystem extends SubsystemBase {

private final VoltageOut voltageRequest = new VoltageOut(0);
private final TalonFX rollersMotor = new TalonFX(DEVICE_ID_ROLLERS_MOTOR);
//private final CANcoder canCoder = new CANcoder(DEVICE_ID_DEPLOY_CANCODER, CANIVORE_BUS_NAME);

//private SysIdRoutine rollersMotorSysIdRoutine = new SysIdRoutine(
// new SysIdRoutine.Config(null, null, null, SysIdRoutineSignalLogger.logState()),
// new SysIdRoutine.Mechanism((volts) -> RollersMotor.setControl(voltageRequest.withOutput(volts.in(Volts))), null,
// this));

public IntakeSubsystem() {
var intakeRollersConfig = new TalonFXConfiguration();
//intakeRollersConfig.Slot0 = Slot0Configs.from(ROLLERS_SLOT_CONFIGS);
intakeRollersConfig.MotorOutput.Inverted = InvertedValue.Clockwise_Positive;
rollersMotor.getConfigurator().apply(intakeRollersConfig);

CANcoderConfiguration canCoderConfig = new CANcoderConfiguration();
canCoderConfig.MagnetSensor.AbsoluteSensorRange = AbsoluteSensorRangeValue.Signed_PlusMinusHalf;
canCoderConfig.MagnetSensor.SensorDirection = SensorDirectionValue.Clockwise_Positive;
canCoderConfig.MagnetSensor.MagnetOffset = MagnetOffsetValue;
//canCoder.getConfigurator().apply(canCoderConfig);
}

private final VelocityTorqueCurrentFOC intakeRollersMotorVelocity = new VelocityTorqueCurrentFOC(0, 0, 0, 1, false,
false,
false);

private final VelocityTorqueCurrentFOC intakeDeployMotorVelocity = new VelocityTorqueCurrentFOC(0, 0, 0, 1, false,
false,
false);

public void runintakeRollers(Measure<Voltage> volts) {
rollersMotor.setControl(voltageRequest.withOutput(volts.in(Volts)));
rollersMotor.setControl(intakeRollersMotorVelocity.withVelocity(volts.in(Volts)));
}

public void reverseintakeRollers(Measure<Voltage> volts) {
rollersMotor.setControl(voltageRequest.withOutput(-volts.in(Volts)));
rollersMotor.setControl(intakeRollersMotorVelocity.withVelocity(-volts.in(Volts)));
}

public void stop() {
Expand Down

0 comments on commit 3d7002d

Please sign in to comment.