2021-01-01 06:37:20 +02: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
|
|
|
|
|
|
2023-07-18 21:18:32 -07:00
|
|
|
#include <functional>
|
|
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "subsystems/Drivetrain.hpp"
|
2025-11-08 16:58:51 -08:00
|
|
|
#include "wpi/commands2/Command.hpp"
|
|
|
|
|
#include "wpi/commands2/CommandHelper.hpp"
|
2021-01-01 06:37:20 +02:00
|
|
|
|
|
|
|
|
class TeleopArcadeDrive
|
2025-11-07 20:00:05 -05:00
|
|
|
: public wpi::cmd::CommandHelper<wpi::cmd::Command, TeleopArcadeDrive> {
|
2021-01-01 06:37:20 +02:00
|
|
|
public:
|
2024-11-16 10:24:58 -05:00
|
|
|
/**
|
|
|
|
|
* Creates a new ArcadeDrive. This command will drive your robot according to
|
2026-03-06 14:19:15 -08:00
|
|
|
* the velocity suppliers. This command does not terminate.
|
2024-11-16 10:24:58 -05:00
|
|
|
*
|
|
|
|
|
* @param drivetrain The drivetrain subsystem on which this command will run
|
2026-03-06 14:19:15 -08:00
|
|
|
* @param xaxisVelocitySupplier Supplier of forward/backward velocity
|
|
|
|
|
* @param zaxisRotateSupplier Supplier of rotational velocity
|
2024-11-16 10:24:58 -05:00
|
|
|
*/
|
2021-01-01 06:37:20 +02:00
|
|
|
TeleopArcadeDrive(Drivetrain* subsystem,
|
2026-03-06 14:19:15 -08:00
|
|
|
std::function<double()> xaxisVelocitySupplier,
|
2021-01-01 06:37:20 +02:00
|
|
|
std::function<double()> zaxisRotateSupplier);
|
|
|
|
|
void Execute() override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Drivetrain* m_drive;
|
2026-03-06 14:19:15 -08:00
|
|
|
std::function<double()> m_xaxisVelocitySupplier;
|
2021-01-01 06:37:20 +02:00
|
|
|
std::function<double()> m_zaxisRotateSupplier;
|
|
|
|
|
};
|