blob: 17d6f3eabb999803051550643565dfe5ba61a16e [file] [log] [blame]
Brian Silverman26e4e522015-12-17 01:56:40 -05001/*----------------------------------------------------------------------------*/
Brian Silverman1a675112016-02-20 20:42:49 -05002/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
Brian Silverman26e4e522015-12-17 01:56:40 -05003/* Open Source Software - may be modified and shared by FRC teams. The code */
Brian Silverman1a675112016-02-20 20:42:49 -05004/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
Brian Silverman26e4e522015-12-17 01:56:40 -05006/*----------------------------------------------------------------------------*/
7
8#include "Commands/WaitUntilCommand.h"
9#include "Timer.h"
10
11/**
12 * A {@link WaitCommand} will wait until a certain match time before finishing.
13 * This will wait until the game clock reaches some value, then continue to the
14 * next command.
15 * @see CommandGroup
16 */
17WaitUntilCommand::WaitUntilCommand(double time)
18 : Command("WaitUntilCommand", time) {
19 m_time = time;
20}
21
22WaitUntilCommand::WaitUntilCommand(const std::string &name, double time)
23 : Command(name, time) {
24 m_time = time;
25}
26
27void WaitUntilCommand::Initialize() {}
28
29void WaitUntilCommand::Execute() {}
30
31/**
32 * Check if we've reached the actual finish time.
33 */
34bool WaitUntilCommand::IsFinished() { return Timer::GetMatchTime() >= m_time; }
35
36void WaitUntilCommand::End() {}
37
38void WaitUntilCommand::Interrupted() {}