2020-12-26 14:12:05 -08: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.
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-05-28 22:06:59 -07:00
|
|
|
#include <units/time.h>
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
namespace frc2 {
|
|
|
|
|
/**
|
|
|
|
|
* Class that holds scheduling state for a command. Used internally by the
|
|
|
|
|
* CommandScheduler
|
|
|
|
|
*/
|
|
|
|
|
class CommandState final {
|
|
|
|
|
public:
|
|
|
|
|
CommandState() = default;
|
|
|
|
|
|
|
|
|
|
explicit CommandState(bool interruptible);
|
|
|
|
|
|
|
|
|
|
bool IsInterruptible() const { return m_interruptible; }
|
|
|
|
|
|
|
|
|
|
// The time since this command was initialized.
|
2021-05-28 22:06:59 -07:00
|
|
|
units::second_t TimeSinceInitialized() const;
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
private:
|
2021-05-28 22:06:59 -07:00
|
|
|
units::second_t m_startTime = -1_s;
|
2019-08-25 23:55:59 -04:00
|
|
|
bool m_interruptible;
|
|
|
|
|
|
|
|
|
|
void StartTiming();
|
|
|
|
|
void StartRunning();
|
|
|
|
|
};
|
|
|
|
|
} // namespace frc2
|