summaryrefslogtreecommitdiff
path: root/src/main/java/frc/robot/RobotContainer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/frc/robot/RobotContainer.java')
-rw-r--r--src/main/java/frc/robot/RobotContainer.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java
new file mode 100644
index 0000000..e08bf8d
--- /dev/null
+++ b/src/main/java/frc/robot/RobotContainer.java
@@ -0,0 +1,42 @@
+// 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;
+
+import edu.wpi.first.math.filter.SlewRateLimiter;
+import edu.wpi.first.wpilibj2.command.Command;
+import edu.wpi.first.wpilibj2.command.Commands;
+import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
+import frc.robot.subsystems.Drivetrain;
+
+public class RobotContainer
+{
+ private final Drivetrain m_drive = new Drivetrain();
+
+ private final SlewRateLimiter m_speedlimiter = new SlewRateLimiter(3);
+ private final SlewRateLimiter m_rotlimiter = new SlewRateLimiter(3);
+
+ private final CommandXboxController m_dcontroller =
+ new CommandXboxController(Constants.PortDriverController);
+
+ public RobotContainer()
+ {
+ configureBindings();
+ }
+
+ private void configureBindings()
+ {
+ // drivetrain controls
+ m_drive.setDefaultCommand(m_drive.run(() ->
+ m_drive.drive(
+ m_speedlimiter.calculate(m_dcontroller.getLeftY()) * Constants.DriveMaxSpeed,
+ m_rotlimiter.calculate(m_dcontroller.getRightX()) * Constants.DriveMaxAngular
+ )));
+ }
+
+ public Command getAutonomousCommand()
+ {
+ return Commands.print("No autonomous command configured");
+ }
+}