blob: 5a6b329d69ba258746ad9f9ac388d3ab9a9bb8b9 [file] [log] [blame]
jerrymf1579332013-02-07 01:56:28 +00001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2011. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5/*----------------------------------------------------------------------------*/
6
7#include "Commands/WaitUntilCommand.h"
8#include "DriverStation.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{
20 m_time = time;
21}
22
23WaitUntilCommand::WaitUntilCommand(const char *name, double time) :
24 Command(name, time)
25{
26 m_time = time;
27}
28
29void WaitUntilCommand::Initialize()
30{
31}
32
33void WaitUntilCommand::Execute()
34{
35}
36
37/**
38 * Check if we've reached the actual finish time.
39 */
40bool WaitUntilCommand::IsFinished()
41{
42 return DriverStation::GetInstance()->GetMatchTime() >= m_time;
43}
44
45void WaitUntilCommand::End()
46{
47}
48
49void WaitUntilCommand::Interrupted()
50{
51}