001 /*----------------------------------------------------------------------------*/ 002 /* Copyright (c) FIRST 2008-2012. All Rights Reserved. */ 003 /* Open Source Software - may be modified and shared by FRC teams. The code */ 004 /* must be accompanied by the FIRST BSD license file in the root directory of */ 005 /* the project. */ 006 /*----------------------------------------------------------------------------*/ 007 008 package edu.wpi.first.wpilibj.command; 009 010 import edu.wpi.first.wpilibj.DriverStation; 011 012 /** 013 * WaitUntilCommand - waits until an absolute game time. 014 * This will wait until the game clock reaches some value, then continue to the next command. 015 * @author brad 016 * 017 */ 018 public class WaitUntilCommand extends Command { 019 020 private double m_time; 021 022 public WaitUntilCommand(double time) { 023 super("WaitUntil(" + time + ")"); 024 m_time = time; 025 } 026 027 public void initialize() { 028 } 029 030 public void execute() { 031 } 032 033 /** 034 * Check if we've reached the actual finish time. 035 */ 036 public boolean isFinished() { 037 return DriverStation.getInstance().getMatchTime() >= m_time; 038 } 039 040 public void end() { 041 } 042 043 public void interrupted() { 044 } 045 }