Added Endeffector and Gear Ratios

Created Endeffector Subsystem and added Gear Ratios.
This commit is contained in:
Michael Mikovsky
2025-01-17 20:55:53 -07:00
parent faf17348c3
commit 453e0e54af
4 changed files with 94 additions and 5 deletions
@@ -0,0 +1,56 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc4388.robot.subsystems;
import com.ctre.phoenix6.controls.PositionVoltage;
import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.signals.NeutralModeValue;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.EndeffectorConstants;
public class Endeffector extends SubsystemBase {
/** Creates a new Endefector. */
private TalonFX endeffectorMotor;
public Endeffector(TalonFX endffectorTalonFX) {
endeffectorMotor = endffectorTalonFX;
endeffectorMotor.setNeutralMode(NeutralModeValue.Brake);
}
public void PIDPosition(double position) {
var request = new PositionVoltage(position);
endeffectorMotor.setControl(request);
}
public void PIDTop() {
PIDPosition(EndeffectorConstants.TOP);
}
public void PIDMiddle() {
PIDPosition(EndeffectorConstants.MIDDLE);
}
public void PIDBottom() {
PIDPosition(EndeffectorConstants.BOTTOM);
}
public void endeffectorTop() {
endeffectorMotor.set(EndeffectorConstants.TOP);
}
public void endeffectorMiddle() {
endeffectorMotor.set(EndeffectorConstants.MIDDLE);
}
public void endeffectorBottom() {
endeffectorMotor.set(EndeffectorConstants.BOTTOM);
}
@Override
public void periodic() {
// This method will be called once per scheduler run
}
}