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
|
|
|
|
|
|
2021-05-28 22:06:59 -07:00
|
|
|
#include <frc/Timer.h>
|
2023-07-14 01:12:01 -04:00
|
|
|
#include <frc2/command/Command.h>
|
2021-01-01 06:37:20 +02:00
|
|
|
#include <frc2/command/CommandHelper.h>
|
|
|
|
|
#include <units/time.h>
|
|
|
|
|
|
|
|
|
|
#include "subsystems/Drivetrain.h"
|
|
|
|
|
|
2023-07-14 01:12:01 -04:00
|
|
|
class DriveTime : public frc2::CommandHelper<frc2::Command, DriveTime> {
|
2021-01-01 06:37:20 +02:00
|
|
|
public:
|
|
|
|
|
DriveTime(double speed, units::second_t time, Drivetrain* drive)
|
|
|
|
|
: m_speed(speed), m_duration(time), m_drive(drive) {
|
2023-09-17 20:48:39 -07:00
|
|
|
AddRequirements(m_drive);
|
2021-01-01 06:37:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Initialize() override;
|
|
|
|
|
void Execute() override;
|
|
|
|
|
void End(bool interrupted) override;
|
|
|
|
|
bool IsFinished() override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
double m_speed;
|
|
|
|
|
units::second_t m_duration;
|
|
|
|
|
Drivetrain* m_drive;
|
2021-05-28 22:06:59 -07:00
|
|
|
frc::Timer m_timer;
|
2021-01-01 06:37:20 +02:00
|
|
|
};
|