Adding a way to manage driver control profiles
This commit is contained in:
32
src/main/java/frc/robot/subsystems/FrisbeeShooterWheels.java
Normal file
32
src/main/java/frc/robot/subsystems/FrisbeeShooterWheels.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package frc.robot.subsystems;
|
||||
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
import com.revrobotics.spark.SparkMax;
|
||||
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import frc.robot.constants.FrisbeeShooterWheelsConstants;
|
||||
import frc.robot.interfaces.ISimpleMotor;
|
||||
|
||||
public class FrisbeeShooterWheels extends SubsystemBase implements ISimpleMotor{
|
||||
private SparkMax frontMotor;
|
||||
private SparkMax rearMotor;
|
||||
|
||||
public FrisbeeShooterWheels() {
|
||||
frontMotor = new SparkMax(FrisbeeShooterWheelsConstants.kFrontMotorCANID, MotorType.kBrushless);
|
||||
rearMotor = new SparkMax(FrisbeeShooterWheelsConstants.kRearMotorCANID, MotorType.kBrushless);
|
||||
}
|
||||
|
||||
public Command setSpeed(DoubleSupplier speed) {
|
||||
return run(() -> {
|
||||
frontMotor.set(speed.getAsDouble());
|
||||
rearMotor.set(speed.getAsDouble());
|
||||
});
|
||||
}
|
||||
|
||||
public Command stop() {
|
||||
return setSpeed(() -> 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user