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
|
|
|
|
2018-04-29 23:33:19 -07:00
|
|
|
#include <wpi/Twine.h>
|
2016-09-05 13:55:31 -07:00
|
|
|
|
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
|
|
|
|
|
*/
|
2016-07-10 17:47:44 -07:00
|
|
|
explicit WaitUntilCommand(double time);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
2018-04-29 23:33:19 -07:00
|
|
|
WaitUntilCommand(const wpi::Twine& name, double time);
|
2018-05-31 20:47:15 -07:00
|
|
|
|
2015-06-24 01:06:29 -07:00
|
|
|
virtual ~WaitUntilCommand() = 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.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
virtual bool IsFinished();
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
private:
|
|
|
|
|
double m_time;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|
2016-11-01 22:33:12 -07:00
|
|
|
|
|
|
|
|
} // namespace frc
|