Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
Brian Silverman | 1a67511 | 2016-02-20 20:42:49 -0500 | [diff] [blame^] | 2 | /* Copyright (c) FIRST 2011-2016. All Rights Reserved. */ |
Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
Brian Silverman | 1a67511 | 2016-02-20 20:42:49 -0500 | [diff] [blame^] | 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ |
| 5 | /* the project. */ |
Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 6 | /*----------------------------------------------------------------------------*/ |
| 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 | */ |
| 17 | WaitUntilCommand::WaitUntilCommand(double time) |
| 18 | : Command("WaitUntilCommand", time) { |
| 19 | m_time = time; |
| 20 | } |
| 21 | |
| 22 | WaitUntilCommand::WaitUntilCommand(const std::string &name, double time) |
| 23 | : Command(name, time) { |
| 24 | m_time = time; |
| 25 | } |
| 26 | |
| 27 | void WaitUntilCommand::Initialize() {} |
| 28 | |
| 29 | void WaitUntilCommand::Execute() {} |
| 30 | |
| 31 | /** |
| 32 | * Check if we've reached the actual finish time. |
| 33 | */ |
| 34 | bool WaitUntilCommand::IsFinished() { return Timer::GetMatchTime() >= m_time; } |
| 35 | |
| 36 | void WaitUntilCommand::End() {} |
| 37 | |
| 38 | void WaitUntilCommand::Interrupted() {} |