finished robotcontainer.java
This commit is contained in:
parent
c1eae1e68b
commit
b084ae7f16
@ -4,42 +4,62 @@
|
|||||||
|
|
||||||
package frc.robot;
|
package frc.robot;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
|
||||||
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||||
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import edu.wpi.first.wpilibj2.command.Commands;
|
|
||||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||||
import frc.robot.constants.OIConstants;
|
import frc.robot.constants.OIConstants;
|
||||||
import frc.robot.subsystems.Drivetrain;
|
import frc.robot.subsystems.Drivetrain;
|
||||||
import frc.robot.subsystems.Flicker;
|
import frc.robot.subsystems.Flicker;
|
||||||
|
import frc.robot.subsystems.Shooter;
|
||||||
|
|
||||||
|
|
||||||
public class RobotContainer {
|
public class RobotContainer {
|
||||||
private Flicker flicker;
|
private Flicker flicker;
|
||||||
|
private Shooter shooter;
|
||||||
private Drivetrain drivetrain;
|
private Drivetrain drivetrain;
|
||||||
private CommandXboxController driver;
|
private CommandXboxController driver;
|
||||||
private CommandXboxController operator;
|
|
||||||
public RobotContainer() {
|
public RobotContainer() {
|
||||||
drivetrain = new Drivetrain();
|
drivetrain = new Drivetrain();
|
||||||
flicker = new Flicker();
|
flicker = new Flicker();
|
||||||
driver = new CommandXboxController(OIConstants.kDriverUSB);
|
driver = new CommandXboxController(OIConstants.kDriverUSB); //sets up controlers
|
||||||
|
|
||||||
configureBindings();
|
configureBindings();
|
||||||
|
configureShuffleboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureBindings() {
|
private void configureBindings() {
|
||||||
drivetrain.setDefaultCommand(
|
drivetrain.setDefaultCommand(
|
||||||
drivetrain.driveArcade(
|
drivetrain.driveArcade(
|
||||||
driver::getLeftY,
|
driver::getLeftY,
|
||||||
driver::getLeftX
|
driver::getLeftX //manual controls for driveing
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
flicker.setDefaultCommand(flicker.stop());
|
flicker.setDefaultCommand(flicker.stop());
|
||||||
driver.a().onTrue(flicker.setSpeed(() ->1));
|
driver.a().onTrue(flicker.setSpeed(() ->1));
|
||||||
|
|
||||||
|
shooter.setDefaultCommand(shooter.stop());
|
||||||
|
driver.rightBumper().onTrue(shooter.setSpeed(()->1)); //manual controls for shooter and flicker
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
private void configureShuffleboard() {
|
||||||
|
ShuffleboardTab robotIndicatorTab = Shuffleboard.getTab(OIConstants.kRobotIndicatorsTabName);
|
||||||
|
|
||||||
|
robotIndicatorTab.addBoolean("Sensors", flicker::photoswich)
|
||||||
|
.withPosition(0, 0).
|
||||||
|
withSize(2, 1).
|
||||||
|
withWidget(BuiltInWidgets.kBooleanBox); //sets up the wiget
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Command getAutonomousCommand() {
|
public Command getAutonomousCommand() {
|
||||||
return flicker.setSpeed(() -> 1);
|
return drivetrain.driveTank(() -> .5,() -> .5).withTimeout(2). andThen(
|
||||||
|
shooter.setSpeed(()-> 1)).withTimeout(1).andThen(
|
||||||
|
shooter.setSpeed(()->1)).alongWith(
|
||||||
|
flicker.setSpeed(()->1)); //sets up the anumus command, it drives forward for 2 seconds, spins the shooter mototrs for 1 second, and both shooter and flicker for 3 seconds.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user