Skip to content

Commit

Permalink
Added stopper and changed constants more
Browse files Browse the repository at this point in the history
  • Loading branch information
Craptop committed Nov 22, 2023
1 parent 8ba5f67 commit b4d29e5
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
41 changes: 41 additions & 0 deletions src/main/java/frc/robot/Commands/StopIntakeMotorCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// 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 frc.robot.Commands;

import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.Subsystems.IntakeSubsystem;

public class StopIntakeMotorCommand extends CommandBase {
IntakeSubsystem intakeSubsystem;

/** Creates a new StopIntakeMotorCommand. */
public StopIntakeMotorCommand(IntakeSubsystem intakeSubsystem) {
this.intakeSubsystem = intakeSubsystem;

// Use addRequirements() here to declare subsystem dependencies.
addRequirements(intakeSubsystem);
}

// Called when the command is initially scheduled.
@Override
public void initialize() {
// STOP ALL MOTORS IN INITIALIZE
intakeSubsystem.SetMotorPower(0);
}

// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {}

// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}

// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class Intake {
public static final double CUBE_UNLOADING_SPEED = -.5d;
public static final double CONE_UNLOADING_SPEED = .5d;

public static final double CUBE_STATOR_LIMIT = 100;
public static final double CONE_STATOR_LIMIT = 100;
public static final double CUBE_STATOR_LIMIT = 90;
public static final double CONE_STATOR_LIMIT = 70;
}
}
6 changes: 5 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.robot.Commands.IntakeCommand;
import frc.robot.Commands.StopIntakeMotorCommand;
import frc.robot.Subsystems.IntakeSubsystem;

/**
Expand All @@ -22,7 +23,6 @@ public class RobotContainer {
public CommandXboxController driverB = new CommandXboxController(0);

private final IntakeSubsystem intakeSubsystem = new IntakeSubsystem();


/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
Expand Down Expand Up @@ -62,9 +62,13 @@ public void containerMatchStarting() {
* edu.wpi.first.wpilibj2.command.button.JoystickButton}.
*/
private void configureButtonBindings() {
// intake and outtake
driverB.rightTrigger().onTrue(new IntakeCommand(intakeSubsystem, false, true));
driverB.leftTrigger().onTrue(new IntakeCommand(intakeSubsystem, true, true));
driverB.rightBumper().onTrue(new IntakeCommand(intakeSubsystem, false, false));
driverB.leftBumper().onTrue(new IntakeCommand(intakeSubsystem, true, false));

// stop the motors
driverB.x().onTrue(new StopIntakeMotorCommand(intakeSubsystem));
}
}

0 comments on commit b4d29e5

Please sign in to comment.