-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRobotContainer.java
96 lines (73 loc) · 3.18 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
93
94
95
96
/************************ PROJECT PHIL ************************/
/* Copyright (c) 2023 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.odometry.OdometryRealign;
import com.stuypulse.robot.commands.swerve.SwerveDriveDrive;
import com.stuypulse.robot.commands.turret.TurretPoint;
import com.stuypulse.robot.constants.Ports;
import com.stuypulse.robot.subsystems.shooter.Shooter;
import com.stuypulse.robot.subsystems.swerve.SwerveDrive;
import com.stuypulse.robot.subsystems.swerve.evenMoreSwerve.*;
import com.stuypulse.robot.subsystems.turret.Turret;
import com.stuypulse.stuylib.input.Gamepad;
import com.stuypulse.stuylib.input.gamepads.AutoGamepad;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.button.Trigger;
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 Turret turret = Turret.getInstance();
public final SwerveDrive swerve = SwerveDrive.getInstance();
public final Shooter shooter = Shooter.getInstance();
// Autons
private static SendableChooser<Command> autonChooser = new SendableChooser<>();
// Robot container
public RobotContainer() {
configureDefaultCommands();
configureButtonBindings();
configureAutons();
}
/****************/
/*** DEFAULTS ***/
/****************/
private void configureDefaultCommands() {
turret.setDefaultCommand(new TurretPoint(new Translation2d(5, 5)));
swerve.setDefaultCommand(new SwerveDriveDrive(driver));
}
/***************/
/*** BUTTONS ***/
/***************/
private void configureButtonBindings() {
configureDriverBindings();
}
private void configureDriverBindings() {
// swerve
// turret
// driver.getLeftButton().whileTrue(new TurretPoint(new Translation2d(0, 0))); // change the button later lol
// left bumper -> robot relative
// odometry
driver.getDPadUp().onTrue(new OdometryRealign(Rotation2d.fromDegrees(180)));
driver.getDPadLeft().onTrue(new OdometryRealign(Rotation2d.fromDegrees(-90)));
driver.getDPadDown().onTrue(new OdometryRealign(Rotation2d.fromDegrees(0)));
driver.getDPadRight().onTrue(new OdometryRealign(Rotation2d.fromDegrees(90)));
}
/**************/
/*** AUTONS ***/
/**************/
public void configureAutons() {
autonChooser.setDefaultOption("Do Nothing", new DoNothingAuton());
SmartDashboard.putData("Autonomous", autonChooser);
}
public Command getAutonomousCommand() {
return autonChooser.getSelected();
}
}