jerrym | f157933 | 2013-02-07 01:56:28 +0000 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/
|
| 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 | */
|
| 17 | WaitUntilCommand::WaitUntilCommand(double time) :
|
| 18 | Command("WaitUntilCommand", time)
|
| 19 | {
|
| 20 | m_time = time;
|
| 21 | }
|
| 22 |
|
| 23 | WaitUntilCommand::WaitUntilCommand(const char *name, double time) :
|
| 24 | Command(name, time)
|
| 25 | {
|
| 26 | m_time = time;
|
| 27 | }
|
| 28 |
|
| 29 | void WaitUntilCommand::Initialize()
|
| 30 | {
|
| 31 | }
|
| 32 |
|
| 33 | void WaitUntilCommand::Execute()
|
| 34 | {
|
| 35 | }
|
| 36 |
|
| 37 | /**
|
| 38 | * Check if we've reached the actual finish time.
|
| 39 | */
|
| 40 | bool WaitUntilCommand::IsFinished()
|
| 41 | {
|
| 42 | return DriverStation::GetInstance()->GetMatchTime() >= m_time;
|
| 43 | }
|
| 44 |
|
| 45 | void WaitUntilCommand::End()
|
| 46 | {
|
| 47 | }
|
| 48 |
|
| 49 | void WaitUntilCommand::Interrupted()
|
| 50 | {
|
| 51 | }
|