blob: e08bf8d8a35cc61169781904688e83cd43a49371 (
plain)
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
|
// 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");
}
}
|