Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ public class DriveConstants {
That means the wheel needs to rotate toward the robot’s absolute right
(clockwise when viewed from above).

To decide whether a wheel is over- or underrotated:
To decide whether a wheel is over - or underrotated:
Stand (or imagine standing) beside the robot, facing the same direction as its absolute front.

- For front wheels:
Overrotated pointing toward the robots right (your left)
Underrotated pointing toward the robots left (your right)
Overrotated -> pointing toward the robot's right (your left)
Underrotated -> pointing toward the robot's left (your right)

- For back wheels:
Overrotated pointing toward the robots right (your left)
Underrotated pointing toward the robots left (your right)
Overrotated -> pointing toward the robot's right (your left)
Underrotated -> pointing toward the robot's left (your right)
*/
public static final Rotation2d frontLeftZeroRotation =
new Rotation2d(-0.7853181997882291).minus(new Rotation2d(Degrees.of(16 + 5)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class ModuleIOSpark implements ModuleIO {
private final Debouncer driveConnectedDebounce = new Debouncer(0.5);
private final Debouncer turnConnectedDebounce = new Debouncer(0.5);

// Cached cancoder status updated only in resetToAbsolute()
// Cached cancoder status - updated only in resetToAbsolute()
private boolean lastCancoderConnected = false;

private final int module;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/frc/robot/outReach/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@
import frc.robot.generic.util.LoggedTalon.NoOppTalonFX;
import frc.robot.generic.util.LoggedTalon.PhoenixTalonFX;
import frc.robot.generic.util.LoggedTalon.SimpleMotorSim;
import frc.robot.outReach.subsystems.turret.Turret;
import frc.robot.generic.util.RobotConfig;
import frc.robot.generic.util.SwerveBuilder;

import frc.robot.outReach.subsystems.turret.Turret;
import org.littletonrobotics.junction.networktables.LoggedDashboardChooser;

/**
Expand Down
45 changes: 21 additions & 24 deletions src/main/java/frc/robot/outReach/subsystems/shooter/Shooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@
// the WPILib BSD license file in the root directory of this project.

package frc.robot.outReach.subsystems.shooter;
import frc.robot.generic.util.LoggedTalon.LoggedTalonFX;

import java.util.function.DoubleSupplier;

import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
import com.ctre.phoenix6.configs.FeedbackConfigs;
import com.ctre.phoenix6.configs.MotorOutputConfigs;
import com.ctre.phoenix6.configs.Slot0Configs;
import com.ctre.phoenix6.configs.TalonFXConfiguration;
import com.ctre.phoenix6.controls.NeutralOut;
import com.ctre.phoenix6.controls.VelocityDutyCycle;
import com.ctre.phoenix6.controls.VelocityVoltage;
import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.signals.NeutralModeValue;

import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.generic.util.LoggedTalon.LoggedTalonFX;
import java.util.function.DoubleSupplier;

public class Shooter extends SubsystemBase {
private final LoggedTalonFX shooterMotor;
Expand All @@ -28,29 +24,30 @@ public class Shooter extends SubsystemBase {

/** Creates a new Torrent. */
public Shooter(LoggedTalonFX shooterMotor) {
var config =
new TalonFXConfiguration()
.withCurrentLimits(
new CurrentLimitsConfigs().withStatorCurrentLimit(30).withSupplyCurrentLimit(60))
.withSlot0(new Slot0Configs().withKP(0).withKI(0).withKD(0).withKS(0).withKV(0))
.withFeedback(new FeedbackConfigs().withSensorToMechanismRatio(0))
.withMotorOutput(new MotorOutputConfigs().withNeutralMode(NeutralModeValue.Coast));
var config =
new TalonFXConfiguration()
.withCurrentLimits(
new CurrentLimitsConfigs().withStatorCurrentLimit(30).withSupplyCurrentLimit(60))
.withSlot0(new Slot0Configs().withKP(0).withKI(0).withKD(0).withKS(0).withKV(0))
.withFeedback(new FeedbackConfigs().withSensorToMechanismRatio(0))
.withMotorOutput(new MotorOutputConfigs().withNeutralMode(NeutralModeValue.Coast));

this.shooterMotor = shooterMotor.withConfig(config);
}

this.shooterMotor = shooterMotor.withConfig(config);
public Command spinToVelocityAndRotationsCommand(DoubleSupplier velocityRPS) {
return runEnd(
() -> {
shooterMotor.setControl(velocityPIDRequest.withVelocity(velocityRPS.getAsDouble()));
},
() -> {
shooterMotor.setControl(neutralOut);
});
}
public Command spinToVelocityAndRotationsCommand(DoubleSupplier velocityRPS) {
return runEnd(()->{
shooterMotor.setControl(velocityPIDRequest.withVelocity(velocityRPS.getAsDouble()));
}, ()-> {
shooterMotor.setControl(neutralOut);
});
}


@Override
@Override
public void periodic() {
// This method will be called once per scheduler run
shooterMotor.periodic();
}
}

Loading