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.
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-05-25 22:40:15 -07:00
|
|
|
#pragma once
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2021-05-26 17:44:18 -07:00
|
|
|
#include <string_view>
|
2016-09-05 13:55:31 -07:00
|
|
|
|
2021-05-28 22:06:59 -07:00
|
|
|
#include <units/time.h>
|
|
|
|
|
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "frc/commands/Command.h"
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
namespace frc {
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
class WaitUntilCommand : public Command {
|
|
|
|
|
public:
|
2018-05-31 20:47:15 -07:00
|
|
|
/**
|
|
|
|
|
* A WaitCommand will wait until a certain match time before finishing.
|
|
|
|
|
*
|
|
|
|
|
* This will wait until the game clock reaches some value, then continue to
|
|
|
|
|
* the next command.
|
|
|
|
|
*
|
|
|
|
|
* @see CommandGroup
|
|
|
|
|
*/
|
2021-05-28 22:06:59 -07:00
|
|
|
explicit WaitUntilCommand(units::second_t time);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
2021-05-28 22:06:59 -07:00
|
|
|
WaitUntilCommand(std::string_view name, units::second_t time);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
2020-12-28 00:10:13 -08:00
|
|
|
~WaitUntilCommand() override = default;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2018-09-24 00:08:25 -07:00
|
|
|
WaitUntilCommand(WaitUntilCommand&&) = default;
|
|
|
|
|
WaitUntilCommand& operator=(WaitUntilCommand&&) = default;
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
protected:
|
2018-05-31 20:47:15 -07:00
|
|
|
/**
|
|
|
|
|
* Check if we've reached the actual finish time.
|
|
|
|
|
*/
|
2020-12-28 00:10:13 -08:00
|
|
|
bool IsFinished() override;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
private:
|
2021-05-28 22:06:59 -07:00
|
|
|
units::second_t m_time;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|
2016-11-01 22:33:12 -07:00
|
|
|
|
|
|
|
|
} // namespace frc
|