generated from StuyPulse/Phil
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathRobotContainer.java
92 lines (74 loc) · 3.34 KB
/
RobotContainer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/************************ PROJECT PHIL ************************/
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved.*/
/* This work is licensed under the terms of the MIT license. */
/**************************************************************/
package com.stuypulse.robot;
import com.stuypulse.robot.commands.auton.DoNothingAuton;
import com.stuypulse.robot.commands.swerve.SwerveDriveDrive;
import com.stuypulse.robot.commands.swerve.SwerveDriveToPose;
import com.stuypulse.robot.commands.swerve.SwerveDriveToShoot;
import com.stuypulse.robot.commands.swerve.SwerveDriveXMode;
import com.stuypulse.robot.constants.Field;
import com.stuypulse.robot.constants.Ports;
import com.stuypulse.robot.subsystems.amper.Amper;
import com.stuypulse.robot.subsystems.odometry.Odometry;
import com.stuypulse.robot.subsystems.swerve.SwerveDrive;
import com.stuypulse.robot.subsystems.vision.AprilTagVision;
import com.stuypulse.robot.subsystems.vision.NoteVision;
import com.stuypulse.robot.subsystems.intake.Intake;
import com.stuypulse.robot.subsystems.shooter.Shooter;
import com.stuypulse.robot.subsystems.conveyor.Conveyor;
import com.stuypulse.stuylib.input.Gamepad;
import com.stuypulse.stuylib.input.gamepads.AutoGamepad;
import com.stuypulse.stuylib.input.gamepads.Xbox;
import com.stuypulse.robot.subsystems.climber.*;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
public class RobotContainer {
// Gamepads
public final Gamepad driver = new AutoGamepad(Ports.Gamepad.DRIVER);
public final Gamepad operator = new AutoGamepad(Ports.Gamepad.OPERATOR);
// Subsystem
public final Climber climber = Climber.getInstance();
public final Amper amper = Amper.getInstance();
public final SwerveDrive swerve = SwerveDrive.getInstance();
public final Odometry odometry = Odometry.getInstance();
public final AprilTagVision vision = AprilTagVision.getInstance();
public final NoteVision noteVision = NoteVision.getInstance();
public final Intake intake = Intake.getInstance();
public final Shooter shooter = Shooter.getInstance();
public final Conveyor conveyor = Conveyor.getInstance();
// Autons
private static SendableChooser<Command> autonChooser = new SendableChooser<>();
// Robot container
public RobotContainer() {
configureDefaultCommands();
configureButtonBindings();
configureAutons();
}
/****************/
/*** DEFAULTS ***/
/****************/
private void configureDefaultCommands() {
swerve.setDefaultCommand(new SwerveDriveDrive(driver));
}
/***************/
/*** BUTTONS ***/
/***************/
private void configureButtonBindings() {
driver.getLeftBumper().onTrue(new SwerveDriveXMode());
driver.getBottomButton().whileTrue(new SwerveDriveToPose(Field.getFiducial(8).getLocation().toPose2d()));
driver.getRightBumper().whileTrue(new SwerveDriveToShoot());
}
/**************/
/*** AUTONS ***/
/**************/
public void configureAutons() {
autonChooser.setDefaultOption("Do Nothing", new DoNothingAuton());
SmartDashboard.putData("Autonomous", autonChooser);
}
public Command getAutonomousCommand() {
return autonChooser.getSelected();
}
}