2026-02-07 00:36:35 -05:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2026-02-15 00:51:21 -08:00
|
|
|
#include "wpi/drive/DifferentialDrive.hpp"
|
|
|
|
|
#include "wpi/driverstation/Joystick.hpp"
|
|
|
|
|
#include "wpi/framework/TimedRobot.hpp"
|
|
|
|
|
#include "wpi/system/Timer.hpp"
|
|
|
|
|
#include "wpi/xrp/XRPMotor.hpp"
|
2026-02-07 00:36:35 -05:00
|
|
|
|
2026-02-15 00:51:21 -08:00
|
|
|
class Robot : public wpi::TimedRobot {
|
2026-02-07 00:36:35 -05:00
|
|
|
public:
|
|
|
|
|
Robot();
|
|
|
|
|
void RobotPeriodic() override;
|
|
|
|
|
void AutonomousInit() override;
|
|
|
|
|
void AutonomousPeriodic() override;
|
|
|
|
|
void TeleopInit() override;
|
|
|
|
|
void TeleopPeriodic() override;
|
|
|
|
|
|
|
|
|
|
private:
|
2026-02-15 00:51:21 -08:00
|
|
|
wpi::xrp::XRPMotor m_leftMotor{0};
|
|
|
|
|
wpi::xrp::XRPMotor m_rightMotor{1};
|
|
|
|
|
// Assumes a gamepad plugged into channel 0
|
|
|
|
|
wpi::Joystick m_controller{0};
|
|
|
|
|
wpi::Timer m_timer;
|
2026-02-07 00:36:35 -05:00
|
|
|
|
2026-02-15 00:51:21 -08:00
|
|
|
wpi::DifferentialDrive m_drive{
|
2026-04-09 22:28:01 -07:00
|
|
|
[&](double output) { m_leftMotor.SetThrottle(output); },
|
|
|
|
|
[&](double output) { m_rightMotor.SetThrottle(output); }};
|
2026-02-07 00:36:35 -05:00
|
|
|
};
|