Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
arm setpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty committed Aug 17, 2024
1 parent 83d618a commit 37eede3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
32 changes: 16 additions & 16 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@

public class Robot extends CommandRobot {
private final CommandXboxController m_driver = new CommandXboxController(Constants.driverport);
private final CommandXboxController m_codriver =
new CommandXboxController(Constants.codriverport);
private final CommandXboxController m_codriver = new CommandXboxController(Constants.codriverport);

private final Arm m_arm = new Arm();
private final Shooter m_shooter = new Shooter();
Expand All @@ -42,11 +41,10 @@ public class Robot extends CommandRobot {
private final Superstructure m_superstructure = new Superstructure(m_shooter, m_intake, m_index);
private static final CommandSwerveDrivetrain m_drivetrain = TunerConstants.DriveTrain;

private final SwerveRequest.FieldCentric m_drive =
new SwerveRequest.FieldCentric()
.withDeadband(Constants.DrivebaseMaxSpeed * 0.1)
.withRotationalDeadband(Constants.DrivebaseMaxAngularRate * 0.1)
.withDriveRequestType(DriveRequestType.OpenLoopVoltage);
private final SwerveRequest.FieldCentric m_drive = new SwerveRequest.FieldCentric()
.withDeadband(Constants.DrivebaseMaxSpeed * 0.1)
.withRotationalDeadband(Constants.DrivebaseMaxAngularRate * 0.1)
.withDriveRequestType(DriveRequestType.OpenLoopVoltage);
private final SwerveRequest.SwerveDriveBrake m_brake = new SwerveRequest.SwerveDriveBrake();
private final Telemetry m_logger = new Telemetry();

Expand Down Expand Up @@ -99,15 +97,14 @@ public Robot() {

m_drivetrain.setDefaultCommand(
m_drivetrain.applyRequest(
() ->
m_drive
.withVelocityX(
Utils.deadzone(-m_driver.getLeftY() * Constants.DrivebaseMaxSpeed))
.withVelocityY(
Utils.deadzone(-m_driver.getLeftX() * Constants.DrivebaseMaxSpeed))
.withRotationalRate(
Utils.deadzone(
-m_driver.getRightX() * Constants.DrivebaseMaxAngularRate))));
() -> m_drive
.withVelocityX(
Utils.deadzone(-m_driver.getLeftY() * Constants.DrivebaseMaxSpeed))
.withVelocityY(
Utils.deadzone(-m_driver.getLeftX() * Constants.DrivebaseMaxSpeed))
.withRotationalRate(
Utils.deadzone(
-m_driver.getRightX() * Constants.DrivebaseMaxAngularRate))));
m_intake.setDefaultCommand(m_superstructure.intake());
m_shooter.setDefaultCommand(m_shooter.stop());
m_index.setDefaultCommand(m_index.stop());
Expand Down Expand Up @@ -149,5 +146,8 @@ public Robot() {
}
});
m_codriver.y().onTrue(m_superstructure.stop());
m_codriver.b().whileTrue(
m_arm.goToSetpoint(Setpoint.kShuttling)
.andThen(Commands.parallel(m_arm.maintain(), m_shooter.spinup(500).andThen(m_shooter.maintain()))));
}
}
4 changes: 3 additions & 1 deletion src/main/java/frc/robot/subsystems/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public enum Setpoint {
kAmp,
kIntake,
kSpeaker,
kStowed
kStowed,
kShuttling
}

private final CANSparkMax m_primaryMotor =
Expand Down Expand Up @@ -190,6 +191,7 @@ public Command goToSetpoint(Setpoint setpoint) {
case kIntake -> position = 0.2;
case kSpeaker -> position = 0.2;
case kStowed -> position = 0.2;
case kShuttling -> position = 0.2;
}

return moveToPosition(position);
Expand Down

0 comments on commit 37eede3

Please sign in to comment.