mirror of
https://github.com/Team4388/2025-Programer-Training.git
synced 2026-06-09 00:38:03 -06:00
patch: include swerve angles and write shooter subsystem.
This commit is contained in:
@@ -41,10 +41,10 @@ public final class Constants {
|
||||
public static final double TURBO_SPEED = 1.0;
|
||||
|
||||
public static final class DefaultSwerveRotOffsets {
|
||||
public static final double FRONT_LEFT_ROT_OFFSET = 0.0; //TODO: per robot swerve module offsets.
|
||||
public static final double FRONT_RIGHT_ROT_OFFSET = 0.0; //TODO: per robot swerve module offsets.
|
||||
public static final double BACK_LEFT_ROT_OFFSET = 0.0; //TODO: per robot swerve module offsets.
|
||||
public static final double BACK_RIGHT_ROT_OFFSET = 0.0; //TODO: per robot swerve module offsets.
|
||||
public static final double FRONT_LEFT_ROT_OFFSET = 0.36962890625 + 0.5; //TODO: per robot swerve module offsets.
|
||||
public static final double FRONT_RIGHT_ROT_OFFSET = 0.61474609375 + 0.5; //TODO: per robot swerve module offsets.
|
||||
public static final double BACK_LEFT_ROT_OFFSET = -0.227294921875 + 0.5; //TODO: per robot swerve module offsets.
|
||||
public static final double BACK_RIGHT_ROT_OFFSET = 0.60595703125 + 0.5; //TODO: per robot swerve module offsets.
|
||||
}
|
||||
|
||||
public static final class IDs {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class RobotContainer {
|
||||
|
||||
m_robotMap.gyro);
|
||||
|
||||
private final Shooter m_robotshooter = new Shooter(m_robotMap.leftShooter, m_robotMap.rightShooter);
|
||||
private final Shooter m_robotShooter = new Shooter(m_robotMap.leftShooter, m_robotMap.rightShooter);
|
||||
|
||||
/* Controllers */
|
||||
private final DeadbandedXboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID);
|
||||
@@ -153,7 +153,11 @@ public class RobotContainer {
|
||||
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftUpRot()));
|
||||
|
||||
// ? /* Operator Buttons */
|
||||
|
||||
|
||||
DualJoystickButton(getDeadbandedOperatorController(), getVirtualOperatorController(), XboxController.LEFT_BUMPER_BUTTON)
|
||||
.onTrue(new InstantCommand(() -> m_robotShooter.spin()))
|
||||
.onFalse(new InstantCommand(() -> m_robotShooter.stop()));
|
||||
|
||||
// ? /* Programer Buttons (Controller 3)*/
|
||||
|
||||
// * /* Auto Recording */
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.ctre.phoenix6.hardware.TalonFX;
|
||||
import com.ctre.phoenix6.hardware.CANcoder;
|
||||
import com.ctre.phoenix6.hardware.Pigeon2;
|
||||
|
||||
import frc4388.robot.Constants.ShooterConstants;
|
||||
// import edu.wpi.first.wpilibj.motorcontrol.Spark;
|
||||
// import frc4388.robot.Constants.LEDConstants;
|
||||
import frc4388.robot.Constants.SwerveDriveConstants;
|
||||
@@ -55,6 +56,10 @@ public class RobotMap {
|
||||
public final TalonFX rightBackSteer = new TalonFX(SwerveDriveConstants.IDs.RIGHT_BACK_STEER_ID);
|
||||
public final CANcoder rightBackEncoder = new CANcoder(SwerveDriveConstants.IDs.RIGHT_BACK_ENCODER_ID);
|
||||
|
||||
/* Shooter Subsystem */
|
||||
public final TalonFX leftShooter = new TalonFX(ShooterConstants.LEFT_SHOOTER_ID);
|
||||
public final TalonFX rightShooter = new TalonFX(ShooterConstants.RIGHT_SHOOTER_ID);
|
||||
|
||||
void configureDriveMotorControllers() {
|
||||
// initialize SwerveModules
|
||||
this.rightFront = new SwerveModule(rightFrontWheel, rightFrontSteer, rightFrontEncoder, SwerveDriveConstants.DefaultSwerveRotOffsets.FRONT_RIGHT_ROT_OFFSET);
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
package frc4388.robot.subsystems;
|
||||
|
||||
import com.ctre.phoenix6.hardware.TalonFX;
|
||||
import com.ctre.phoenix6.signals.NeutralModeValue;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import frc4388.robot.Constants.ShooterConstants;
|
||||
|
||||
public class Shooter extends SubsystemBase {
|
||||
private final TalonFX leftShooter;
|
||||
@@ -15,8 +17,23 @@ public class Shooter extends SubsystemBase {
|
||||
public Shooter(TalonFX leftShooterMotor, TalonFX rightShooterMotor) {
|
||||
leftShooter = leftShooterMotor;
|
||||
rightShooter = rightShooterMotor;
|
||||
|
||||
leftShooter.setNeutralMode(NeutralModeValue.Coast);
|
||||
rightShooter.setNeutralMode(NeutralModeValue.Coast);
|
||||
}
|
||||
|
||||
public void spin(double speed) {
|
||||
leftShooter.set(-speed);
|
||||
rightShooter.set(-speed);
|
||||
}
|
||||
|
||||
public void spin() {
|
||||
spin(ShooterConstants.SHOOTER_SPEED);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
spin(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
|
||||
Reference in New Issue
Block a user