Skip to content
Merged
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import com.github.spotbugs.snom.SpotBugsTask
plugins {
id "java"
id 'pmd'
id "edu.wpi.first.GradleRIO" version "2025.2.1"
id "edu.wpi.first.GradleRIO" version "2025.3.1"
id "com.github.spotbugs" version "5.0.14"
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,18 +278,18 @@ public static class NarwhalClimberConstants {

public static final double GEAR_REDUCTION = 125.0;
public static final double PULLY_REDUCTION = 10.0;
public static final double CLIMBER_ANGLE_TO_MOTOR_ANGLE = GEAR_REDUCTION * PULLY_REDUCTION;
public static final double CLIMBER_ANGLE_TO_MOTOR_ANGLE = GEAR_REDUCTION * PULLY_REDUCTION; // technically not a 1 to 1 conversion because of how the climber arm and winch are linked

public static final double PID_P = 5;
public static final double PID_P = 8.5;
public static final double PID_I = 0;
public static final double PID_D = 0.1;
public static final double PID_F = 1.9;

public static final double CLIMBER_PID_MIN_OUTPUT = -0.3;
public static final double CLIMBER_PID_MAX_OUTPUT = 0.3;

public static final Rotation2d DEPLOYED_ANGLE = Rotation2d.fromDegrees(30);
public static final Rotation2d CLIMB_ANGLE = Rotation2d.fromDegrees(-5);
public static final Rotation2d DEPLOYED_ANGLE = Rotation2d.fromDegrees(40);
public static final Rotation2d CLIMB_ANGLE = Rotation2d.fromDegrees(-13.5);
}

public static class NarwhalElevatorConstants {
Expand Down Expand Up @@ -427,7 +427,7 @@ public static class VisionConstants {
// Pipeline settings
public static final int APRIL_TAG_PIPELINE = 0;
public static final AprilTagFieldLayout APRIL_TAG_FIELD_LAYOUT = AprilTagFieldLayout
.loadField(AprilTagFields.k2025Reefscape);
.loadField(AprilTagFields.k2025ReefscapeAndyMark);

// Odometry Detection Strategy
public static final PhotonPoseEstimator.PoseStrategy POSE_STRATEGY = PhotonPoseEstimator.PoseStrategy.MULTI_TAG_PNP_ON_COPROCESSOR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class NarwhalManualClimberCommand extends Command {
/**
* Creates a manual squid climber command that toggles between down and climbed positions.
*
* @param squidClimber The climber subsystem to control.
* @param narwhalClimber The climber subsystem to control.
* @param controller The Xbox controller used to drive the climber.
*/
public NarwhalManualClimberCommand(NarwhalClimber narwhalClimber, XboxController controller) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.narwhal.NarwhalElevator;

public class ManualNarwhalElevatorCommand extends Command {
public class NarwhalManualElevatorCommand extends Command {
private final NarwhalElevator narwhalElevator;
private final XboxController xboxController;
private final Supplier<Boolean> narwhalWristReadyToIntakeSupplier;
Expand All @@ -17,7 +17,7 @@ public class ManualNarwhalElevatorCommand extends Command {
* @param controller The Xbox controller used to drive the elevator.
* @param narwhalWristReadyToIntakeSupplier A supplier that indicates if the narwhal wrist is ready to intake.
*/
public ManualNarwhalElevatorCommand(
public NarwhalManualElevatorCommand(
NarwhalElevator narwhalElevator,
XboxController controller,
Supplier<Boolean> narwhalWristReadyToIntakeSupplier) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.narwhal.NarwhalWrist;

public class ManualNarwhalWristCommand extends Command {
public class NarwhalManualWristCommand extends Command {
private final XboxController xBoxController;
private final NarwhalWrist narwhalWrist;

Expand All @@ -13,7 +13,7 @@ public class ManualNarwhalWristCommand extends Command {
* @param squidClimber The climber subsystem to control.
* @param controller The Xbox controller used to control the subsystem.
*/
public ManualNarwhalWristCommand(XboxController xboxController, NarwhalWrist narwhalWrist){
public NarwhalManualWristCommand(NarwhalWrist narwhalWrist, XboxController xboxController){
this.xBoxController = xboxController;
this.narwhalWrist = narwhalWrist;
addRequirements(narwhalWrist);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,28 @@
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.RunCommand;
import frc.robot.commands.narwhal.NarwhalManualClimberCommand;
import frc.robot.commands.narwhal.NarwhalManualElevatorCommand;
import frc.robot.commands.narwhal.NarwhalManualIntakeOuttakeCommand;
import frc.robot.commands.narwhal.NarwhalManualWristCommand;
import frc.robot.subsystems.upper_assembly.UpperAssemblyBase;
import frc.robot.util.upper_assembly.ScoringHeight;

public class NarwhalUpperAssembly extends UpperAssemblyBase {

private final NarwhalIntakeOuttake narwhalIntakeOuttake;
private final NarwhalWrist narwhalWrist;
private final NarwhalElevator narwhalElevator;
private final NarwhalClimber narwhalClimber;

public NarwhalUpperAssembly(){
narwhalIntakeOuttake = new NarwhalIntakeOuttake();
narwhalWrist = new NarwhalWrist();
narwhalElevator = new NarwhalElevator();
narwhalClimber = new NarwhalClimber();
}

public Command getCoralIntakeCommand(Supplier<Pose2d> robotPoseSupplier) {
return new RunCommand(
() -> {/*PLACEHOLDER, DO NOT USE RUN COMMANDS!*/},
Expand Down Expand Up @@ -40,10 +56,19 @@ public Command getClimbCommand(Supplier<Pose2d> robotPoseSupplier) {
}

public Command getManualCommand(XboxController controller) {
return new RunCommand(
() -> {/*PLACEHOLDER, DO NOT USE RUN COMMANDS!*/},
this
NarwhalManualIntakeOuttakeCommand narwhalManualIntakeOuttakeCommand = new NarwhalManualIntakeOuttakeCommand(narwhalIntakeOuttake, controller);
NarwhalManualWristCommand narwhalManualWristCommand = new NarwhalManualWristCommand(narwhalWrist, controller);
NarwhalManualElevatorCommand narwhalManualElevatorCommand = new NarwhalManualElevatorCommand(narwhalElevator, controller, narwhalWrist::readyToIntake);
NarwhalManualClimberCommand narwhalManualClimberCommand = new NarwhalManualClimberCommand(narwhalClimber, controller);

ParallelCommandGroup manualParallelCommandGroup = new ParallelCommandGroup(
narwhalManualIntakeOuttakeCommand,
narwhalManualWristCommand,
narwhalManualElevatorCommand,
narwhalManualClimberCommand
);
manualParallelCommandGroup.addRequirements(this);
return manualParallelCommandGroup;
}

public void disable() {}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/frc/robot/subsystems/narwhal/NarwhalWrist.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public NarwhalWrist() {
currentState = NarwhalWristState.STOPPED;
}

/**
* Get the wrist position and detect if the position is within the WRIST_ANGLE_TOLERANCE to the INTAKE_ANGLE
* @return true if the wrist is within the angle tolerance to the intake angle, otherwise false.
*/
public boolean readyToIntake(){
double current_position = wrist.getAbsoluteEncoder().getPosition();
return Math.abs(current_position - NarwhalWristConstants.INTAKE_ANGLE.getRadians()) < NarwhalWristConstants.WRIST_ANGLE_TOLERANCE;
Expand All @@ -89,9 +93,6 @@ public void setCurrentMotorAngle(Rotation2d targetAngle){
* Set the wrist motor to the intake angle (defined in constants) & update status.
*/
public void goToIntakeAngle() {

// Inline construction of command goes here.
// Subsystem::RunOnce implicitly requires `this` subsystem.
setCurrentMotorAngle(NarwhalWristConstants.INTAKE_ANGLE);
currentState = NarwhalWristState.INTAKING; // must be after the set function because the set function will default to CUSTOM state
}
Expand Down
Loading