blob: 22476bbe822666ad6ddf6ae7061e33c172edc41e [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2011-2017. 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 the root directory of */
5/* the project. */
6/*----------------------------------------------------------------------------*/
7
8#include "Commands/CommandGroupEntry.h"
9
10#include "Commands/Command.h"
11
12using namespace frc;
13
14CommandGroupEntry::CommandGroupEntry(Command* command, Sequence state,
15 double timeout)
16 : m_timeout(timeout), m_command(command), m_state(state) {}
17
18bool CommandGroupEntry::IsTimedOut() const {
19 if (m_timeout < 0.0) return false;
20 double time = m_command->TimeSinceInitialized();
21 if (time == 0.0) return false;
22 return time >= m_timeout;
23}