From de82bb11825e8bc5087f10605b3fe2fd926f1909 Mon Sep 17 00:00:00 2001 From: kartofen Date: Thu, 18 Jan 2024 00:35:25 +0200 Subject: init --- src/main/java/frc/robot/RobotContainer.java | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/main/java/frc/robot/RobotContainer.java (limited to 'src/main/java/frc/robot/RobotContainer.java') 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"); + } +} -- cgit v1.2.3