summaryrefslogtreecommitdiff
path: root/src/main/java/frc/robot/RobotContainer.java
blob: d91ff7863db870b7fe0c9c57e61657ec6b5a2906 (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
// 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.wpilibj.GenericHID;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
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 GenericHID m_controller = 
        new GenericHID(Constants.PortDriverController);

    public RobotContainer() 
    {
        configureBindings();
    }

    private void configureBindings() 
    {
        m_drive.setDefaultCommand(m_drive.run(() -> 
        m_drive.drive(
            m_speedlimiter.calculate(m_controller.getRawAxis(1)) * Constants.DriveMaxSpeed,
            m_rotlimiter.calculate(m_controller.getRawAxis(2)) * Constants.DriveMaxAngular
        ))); 
    }

    public Command getAutonomousCommand() 
    {
        return Commands.print("No autonomous command configured");
    }
}