Squashed 'third_party/allwpilib_2016/' content from commit 7f61816
Change-Id: If9d9245880859cdf580f5d7f77045135d0521ce7
git-subtree-dir: third_party/allwpilib_2016
git-subtree-split: 7f618166ed253a24629934fcf89c3decb0528a3b
diff --git a/wpilibc/shared/include/Commands/Command.h b/wpilibc/shared/include/Commands/Command.h
new file mode 100644
index 0000000..6ec5512
--- /dev/null
+++ b/wpilibc/shared/include/Commands/Command.h
@@ -0,0 +1,190 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __COMMAND_H__
+#define __COMMAND_H__
+
+#include "ErrorBase.h"
+#include "SmartDashboard/NamedSendable.h"
+#include "tables/ITableListener.h"
+#include <set>
+#include <string>
+#include <memory>
+
+class CommandGroup;
+class Subsystem;
+
+/**
+ * The Command class is at the very core of the entire command framework.
+ * Every command can be started with a call to {@link Command#Start() Start()}.
+ * Once a command is started it will call {@link Command#Initialize()
+ * Initialize()}, and then
+ * will repeatedly call {@link Command#Execute() Execute()} until the {@link
+ *Command#IsFinished() IsFinished()}
+ * returns true. Once it does, {@link Command#End() End()} will be called.
+ *
+ * <p>However, if at any point while it is running {@link Command#Cancel()
+ * Cancel()} is called, then
+ * the command will be stopped and {@link Command#Interrupted() Interrupted()}
+ * will be called.</p>
+ *
+ * <p>If a command uses a {@link Subsystem}, then it should specify that it does
+ * so by
+ * calling the {@link Command#Requires(Subsystem) Requires(...)} method
+ * in its constructor. Note that a Command may have multiple requirements, and
+ * {@link Command#Requires(Subsystem) Requires(...)} should be
+ * called for each one.</p>
+ *
+ * <p>If a command is running and a new command with shared requirements is
+ * started,
+ * then one of two things will happen. If the active command is interruptible,
+ * then {@link Command#Cancel() Cancel()} will be called and the command will be
+ * removed
+ * to make way for the new one. If the active command is not interruptible, the
+ * other one will not even be started, and the active one will continue
+ * functioning.</p>
+ *
+ * @see CommandGroup
+ * @see Subsystem
+ */
+class Command : public ErrorBase, public NamedSendable, public ITableListener {
+ friend class CommandGroup;
+ friend class Scheduler;
+
+ public:
+ Command();
+ Command(const std::string &name);
+ Command(double timeout);
+ Command(const std::string &name, double timeout);
+ virtual ~Command();
+ double TimeSinceInitialized() const;
+ void Requires(Subsystem *s);
+ bool IsCanceled() const;
+ void Start();
+ bool Run();
+ void Cancel();
+ bool IsRunning() const;
+ bool IsInterruptible() const;
+ void SetInterruptible(bool interruptible);
+ bool DoesRequire(Subsystem *subsystem) const;
+ typedef std::set<Subsystem *> SubsystemSet;
+ SubsystemSet GetRequirements() const;
+ CommandGroup *GetGroup() const;
+ void SetRunWhenDisabled(bool run);
+ bool WillRunWhenDisabled() const;
+ int GetID() const;
+
+ protected:
+ void SetTimeout(double timeout);
+ bool IsTimedOut() const;
+ bool AssertUnlocked(const std::string &message);
+ void SetParent(CommandGroup *parent);
+ /**
+ * The initialize method is called the first time this Command is run after
+ * being started.
+ */
+ virtual void Initialize() = 0;
+ /**
+ * The execute method is called repeatedly until this Command either finishes
+ * or is canceled.
+ */
+ virtual void Execute() = 0;
+ /**
+ * Returns whether this command is finished.
+ * If it is, then the command will be removed
+ * and {@link Command#end() end()} will be called.
+ *
+ * <p>It may be useful for a team to reference the {@link Command#isTimedOut()
+ * isTimedOut()} method
+ * for time-sensitive commands.</p>
+ * @return whether this command is finished.
+ * @see Command#isTimedOut() isTimedOut()
+ */
+ virtual bool IsFinished() = 0;
+ /**
+ * Called when the command ended peacefully. This is where you may want
+ * to wrap up loose ends, like shutting off a motor that was being used
+ * in the command.
+ */
+ virtual void End() = 0;
+ /**
+ * Called when the command ends because somebody called {@link
+ *Command#cancel() cancel()}
+ * or another command shared the same requirements as this one, and booted
+ * it out.
+ *
+ * <p>This is where you may want
+ * to wrap up loose ends, like shutting off a motor that was being used
+ * in the command.</p>
+ *
+ * <p>Generally, it is useful to simply call the {@link Command#end() end()}
+ * method
+ * within this method</p>
+ */
+ virtual void Interrupted() = 0;
+ virtual void _Initialize();
+ virtual void _Interrupted();
+ virtual void _Execute();
+ virtual void _End();
+ virtual void _Cancel();
+
+ private:
+ void LockChanges();
+ /*synchronized*/ void Removed();
+ void StartRunning();
+ void StartTiming();
+
+ /** The name of this command */
+ std::string m_name;
+
+ /** The time since this command was initialized */
+ double m_startTime = -1;
+
+ /** The time (in seconds) before this command "times out" (or -1 if no
+ * timeout) */
+ double m_timeout;
+
+ /** Whether or not this command has been initialized */
+ bool m_initialized = false;
+
+ /** The requirements (or null if no requirements) */
+ SubsystemSet m_requirements;
+
+ /** Whether or not it is running */
+ bool m_running = false;
+
+ /** Whether or not it is interruptible*/
+ bool m_interruptible = true;
+
+ /** Whether or not it has been canceled */
+ bool m_canceled = false;
+
+ /** Whether or not it has been locked */
+ bool m_locked = false;
+
+ /** Whether this command should run when the robot is disabled */
+ bool m_runWhenDisabled = false;
+
+ /** The {@link CommandGroup} this is in */
+ CommandGroup *m_parent = nullptr;
+
+ int m_commandID = m_commandCounter++;
+ static int m_commandCounter;
+
+ public:
+ virtual std::string GetName() const;
+ virtual void InitTable(std::shared_ptr<ITable> table);
+ virtual std::shared_ptr<ITable> GetTable() const;
+ virtual std::string GetSmartDashboardType() const;
+ virtual void ValueChanged(ITable* source, llvm::StringRef key,
+ std::shared_ptr<nt::Value> value, bool isNew);
+
+ protected:
+ std::shared_ptr<ITable> m_table;
+};
+
+#endif
diff --git a/wpilibc/shared/include/Commands/CommandGroup.h b/wpilibc/shared/include/Commands/CommandGroup.h
new file mode 100644
index 0000000..7f289ca
--- /dev/null
+++ b/wpilibc/shared/include/Commands/CommandGroup.h
@@ -0,0 +1,74 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __COMMAND_GROUP_H__
+#define __COMMAND_GROUP_H__
+
+#include "Commands/Command.h"
+#include "Commands/CommandGroupEntry.h"
+#include <list>
+#include <vector>
+
+/**
+ * A {@link CommandGroup} is a list of commands which are executed in sequence.
+ *
+ * <p>Commands in a {@link CommandGroup} are added using the {@link
+ * CommandGroup#AddSequential(Command) AddSequential(...)} method
+ * and are called sequentially.
+ * {@link CommandGroup CommandGroups} are themselves {@link Command Commands}
+ * and can be given to other {@link CommandGroup CommandGroups}.</p>
+ *
+ * <p>{@link CommandGroup CommandGroups} will carry all of the requirements of
+ * their {@link Command subcommands}. Additional
+ * requirements can be specified by calling {@link
+ *CommandGroup#Requires(Subsystem) Requires(...)}
+ * normally in the constructor.</P>
+ *
+ * <p>CommandGroups can also execute commands in parallel, simply by adding them
+ * using {@link CommandGroup#AddParallel(Command) AddParallel(...)}.</p>
+ *
+ * @see Command
+ * @see Subsystem
+ */
+class CommandGroup : public Command {
+ public:
+ CommandGroup() = default;
+ CommandGroup(const std::string &name);
+ virtual ~CommandGroup() = default;
+
+ void AddSequential(Command *command);
+ void AddSequential(Command *command, double timeout);
+ void AddParallel(Command *command);
+ void AddParallel(Command *command, double timeout);
+ bool IsInterruptible() const;
+ int GetSize() const;
+
+ protected:
+ virtual void Initialize();
+ virtual void Execute();
+ virtual bool IsFinished();
+ virtual void End();
+ virtual void Interrupted();
+ virtual void _Initialize();
+ virtual void _Interrupted();
+ virtual void _Execute();
+ virtual void _End();
+
+ private:
+ void CancelConflicts(Command *command);
+
+ /** The commands in this group (stored in entries) */
+ std::vector<CommandGroupEntry> m_commands;
+
+ /** The active children in this group (stored in entries) */
+ std::list<CommandGroupEntry> m_children;
+
+ /** The current command, -1 signifies that none have been run */
+ int m_currentCommandIndex = -1;
+};
+
+#endif
diff --git a/wpilibc/shared/include/Commands/CommandGroupEntry.h b/wpilibc/shared/include/Commands/CommandGroupEntry.h
new file mode 100644
index 0000000..442a02c
--- /dev/null
+++ b/wpilibc/shared/include/Commands/CommandGroupEntry.h
@@ -0,0 +1,30 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __COMMAND_GROUP_ENTRY_H__
+#define __COMMAND_GROUP_ENTRY_H__
+
+class Command;
+
+class CommandGroupEntry {
+ public:
+ typedef enum {
+ kSequence_InSequence,
+ kSequence_BranchPeer,
+ kSequence_BranchChild
+ } Sequence;
+
+ CommandGroupEntry() = default;
+ CommandGroupEntry(Command *command, Sequence state, double timeout = -1.0);
+ bool IsTimedOut() const;
+
+ double m_timeout = -1.0;
+ Command *m_command = nullptr;
+ Sequence m_state = kSequence_InSequence;
+};
+
+#endif
diff --git a/wpilibc/shared/include/Commands/PIDCommand.h b/wpilibc/shared/include/Commands/PIDCommand.h
new file mode 100644
index 0000000..d67c063
--- /dev/null
+++ b/wpilibc/shared/include/Commands/PIDCommand.h
@@ -0,0 +1,58 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __PID_COMMAND_H__
+#define __PID_COMMAND_H__
+
+#include "Commands/Command.h"
+#include "PIDController.h"
+#include "PIDSource.h"
+#include "PIDOutput.h"
+
+#include <memory>
+
+class PIDCommand : public Command, public PIDOutput, public PIDSource {
+ public:
+ PIDCommand(const std::string &name, double p, double i, double d);
+ PIDCommand(const std::string &name, double p, double i, double d, double period);
+ PIDCommand(const std::string &name, double p, double i, double d, double f,
+ double period);
+ PIDCommand(double p, double i, double d);
+ PIDCommand(double p, double i, double d, double period);
+ PIDCommand(double p, double i, double d, double f, double period);
+ virtual ~PIDCommand() = default;
+
+ void SetSetpointRelative(double deltaSetpoint);
+
+ // PIDOutput interface
+ virtual void PIDWrite(float output);
+
+ // PIDSource interface
+ virtual double PIDGet();
+
+ protected:
+ std::shared_ptr<PIDController> GetPIDController() const;
+ virtual void _Initialize();
+ virtual void _Interrupted();
+ virtual void _End();
+ void SetSetpoint(double setpoint);
+ double GetSetpoint() const;
+ double GetPosition();
+
+ virtual double ReturnPIDInput() = 0;
+ virtual void UsePIDOutput(double output) = 0;
+
+ private:
+ /** The internal {@link PIDController} */
+ std::shared_ptr<PIDController> m_controller;
+
+ public:
+ virtual void InitTable(std::shared_ptr<ITable> table);
+ virtual std::string GetSmartDashboardType() const;
+};
+
+#endif
diff --git a/wpilibc/shared/include/Commands/PIDSubsystem.h b/wpilibc/shared/include/Commands/PIDSubsystem.h
new file mode 100644
index 0000000..ff05514
--- /dev/null
+++ b/wpilibc/shared/include/Commands/PIDSubsystem.h
@@ -0,0 +1,76 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __PID_SUBSYSTEM_H__
+#define __PID_SUBSYSTEM_H__
+
+#include "Commands/Subsystem.h"
+#include "PIDController.h"
+#include "PIDSource.h"
+#include "PIDOutput.h"
+
+#include <memory>
+
+/**
+ * This class is designed to handle the case where there is a {@link Subsystem}
+ * which uses a single {@link PIDController} almost constantly (for instance,
+ * an elevator which attempts to stay at a constant height).
+ *
+ * <p>It provides some convenience methods to run an internal {@link
+ * PIDController}.
+ * It also allows access to the internal {@link PIDController} in order to give
+ * total control
+ * to the programmer.</p>
+ *
+ */
+class PIDSubsystem : public Subsystem, public PIDOutput, public PIDSource {
+ public:
+ PIDSubsystem(const std::string &name, double p, double i, double d);
+ PIDSubsystem(const std::string &name, double p, double i, double d, double f);
+ PIDSubsystem(const std::string &name, double p, double i, double d, double f,
+ double period);
+ PIDSubsystem(double p, double i, double d);
+ PIDSubsystem(double p, double i, double d, double f);
+ PIDSubsystem(double p, double i, double d, double f, double period);
+ virtual ~PIDSubsystem() = default;
+
+ void Enable();
+ void Disable();
+
+ // PIDOutput interface
+ virtual void PIDWrite(float output);
+
+ // PIDSource interface
+ virtual double PIDGet();
+ void SetSetpoint(double setpoint);
+ void SetSetpointRelative(double deltaSetpoint);
+ void SetInputRange(float minimumInput, float maximumInput);
+ void SetOutputRange(float minimumOutput, float maximumOutput);
+ double GetSetpoint();
+ double GetPosition();
+ double GetRate();
+
+ virtual void SetAbsoluteTolerance(float absValue);
+ virtual void SetPercentTolerance(float percent);
+ virtual bool OnTarget() const;
+
+ protected:
+ std::shared_ptr<PIDController> GetPIDController();
+
+ virtual double ReturnPIDInput() = 0;
+ virtual void UsePIDOutput(double output) = 0;
+
+ private:
+ /** The internal {@link PIDController} */
+ std::shared_ptr<PIDController> m_controller;
+
+ public:
+ virtual void InitTable(std::shared_ptr<ITable> table);
+ virtual std::string GetSmartDashboardType() const;
+};
+
+#endif
diff --git a/wpilibc/shared/include/Commands/PrintCommand.h b/wpilibc/shared/include/Commands/PrintCommand.h
new file mode 100644
index 0000000..cbb3e5e
--- /dev/null
+++ b/wpilibc/shared/include/Commands/PrintCommand.h
@@ -0,0 +1,30 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __PRINT_COMMAND_H__
+#define __PRINT_COMMAND_H__
+
+#include "Commands/Command.h"
+#include <string>
+
+class PrintCommand : public Command {
+ public:
+ PrintCommand(const std::string &message);
+ virtual ~PrintCommand() = default;
+
+ protected:
+ virtual void Initialize();
+ virtual void Execute();
+ virtual bool IsFinished();
+ virtual void End();
+ virtual void Interrupted();
+
+ private:
+ std::string m_message;
+};
+
+#endif
diff --git a/wpilibc/shared/include/Commands/Scheduler.h b/wpilibc/shared/include/Commands/Scheduler.h
new file mode 100644
index 0000000..065fbad
--- /dev/null
+++ b/wpilibc/shared/include/Commands/Scheduler.h
@@ -0,0 +1,70 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __SCHEDULER_H__
+#define __SCHEDULER_H__
+
+#include "Commands/Command.h"
+#include "ErrorBase.h"
+#include "SmartDashboard/NamedSendable.h"
+#include "networktables/NetworkTable.h"
+#include "SmartDashboard/SmartDashboard.h"
+#include <list>
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+#include <vector>
+#include "HAL/cpp/priority_mutex.h"
+
+class ButtonScheduler;
+class Subsystem;
+
+class Scheduler : public ErrorBase, public NamedSendable {
+ public:
+ static Scheduler *GetInstance();
+
+ void AddCommand(Command *command);
+ void AddButton(ButtonScheduler *button);
+ void RegisterSubsystem(Subsystem *subsystem);
+ void Run();
+ void Remove(Command *command);
+ void RemoveAll();
+ void ResetAll();
+ void SetEnabled(bool enabled);
+
+ void UpdateTable();
+ std::string GetSmartDashboardType() const;
+ void InitTable(std::shared_ptr<ITable> subTable);
+ std::shared_ptr<ITable> GetTable() const;
+ std::string GetName() const;
+ std::string GetType() const;
+
+ private:
+ Scheduler();
+ virtual ~Scheduler() = default;
+
+ void ProcessCommandAddition(Command *command);
+
+ Command::SubsystemSet m_subsystems;
+ priority_mutex m_buttonsLock;
+ typedef std::vector<ButtonScheduler *> ButtonVector;
+ ButtonVector m_buttons;
+ typedef std::vector<Command *> CommandVector;
+ priority_mutex m_additionsLock;
+ CommandVector m_additions;
+ typedef std::set<Command *> CommandSet;
+ CommandSet m_commands;
+ bool m_adding = false;
+ bool m_enabled = true;
+ std::vector<std::string> commands;
+ std::vector<double> ids;
+ std::vector<double> toCancel;
+ std::shared_ptr<ITable> m_table;
+ bool m_runningCommandsChanged = false;
+};
+#endif
diff --git a/wpilibc/shared/include/Commands/StartCommand.h b/wpilibc/shared/include/Commands/StartCommand.h
new file mode 100644
index 0000000..8f53d14
--- /dev/null
+++ b/wpilibc/shared/include/Commands/StartCommand.h
@@ -0,0 +1,29 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __START_COMMAND_H__
+#define __START_COMMAND_H__
+
+#include "Commands/Command.h"
+
+class StartCommand : public Command {
+ public:
+ StartCommand(Command *commandToStart);
+ virtual ~StartCommand() = default;
+
+ protected:
+ virtual void Initialize();
+ virtual void Execute();
+ virtual bool IsFinished();
+ virtual void End();
+ virtual void Interrupted();
+
+ private:
+ Command *m_commandToFork;
+};
+
+#endif
diff --git a/wpilibc/shared/include/Commands/Subsystem.h b/wpilibc/shared/include/Commands/Subsystem.h
new file mode 100644
index 0000000..8762ec8
--- /dev/null
+++ b/wpilibc/shared/include/Commands/Subsystem.h
@@ -0,0 +1,50 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __SUBSYSTEM_H__
+#define __SUBSYSTEM_H__
+
+#include "ErrorBase.h"
+#include "SmartDashboard/NamedSendable.h"
+#include <string>
+#include <memory>
+
+class Command;
+
+class Subsystem : public ErrorBase, public NamedSendable {
+ friend class Scheduler;
+
+ public:
+ Subsystem(const std::string &name);
+ virtual ~Subsystem() = default;
+
+ void SetDefaultCommand(Command *command);
+ Command *GetDefaultCommand();
+ void SetCurrentCommand(Command *command);
+ Command *GetCurrentCommand() const;
+ virtual void InitDefaultCommand();
+
+ private:
+ void ConfirmCommand();
+
+ Command *m_currentCommand = nullptr;
+ bool m_currentCommandChanged = true;
+ Command *m_defaultCommand = nullptr;
+ std::string m_name;
+ bool m_initializedDefaultCommand = false;
+
+ public:
+ virtual std::string GetName() const;
+ virtual void InitTable(std::shared_ptr<ITable> table);
+ virtual std::shared_ptr<ITable> GetTable() const;
+ virtual std::string GetSmartDashboardType() const;
+
+ protected:
+ std::shared_ptr<ITable> m_table;
+};
+
+#endif
diff --git a/wpilibc/shared/include/Commands/WaitCommand.h b/wpilibc/shared/include/Commands/WaitCommand.h
new file mode 100644
index 0000000..6db6dac
--- /dev/null
+++ b/wpilibc/shared/include/Commands/WaitCommand.h
@@ -0,0 +1,27 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __WAIT_COMMAND_H__
+#define __WAIT_COMMAND_H__
+
+#include "Commands/Command.h"
+
+class WaitCommand : public Command {
+ public:
+ WaitCommand(double timeout);
+ WaitCommand(const std::string &name, double timeout);
+ virtual ~WaitCommand() = default;
+
+ protected:
+ virtual void Initialize();
+ virtual void Execute();
+ virtual bool IsFinished();
+ virtual void End();
+ virtual void Interrupted();
+};
+
+#endif
diff --git a/wpilibc/shared/include/Commands/WaitForChildren.h b/wpilibc/shared/include/Commands/WaitForChildren.h
new file mode 100644
index 0000000..858d243
--- /dev/null
+++ b/wpilibc/shared/include/Commands/WaitForChildren.h
@@ -0,0 +1,27 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __WAIT_FOR_CHILDREN_H__
+#define __WAIT_FOR_CHILDREN_H__
+
+#include "Commands/Command.h"
+
+class WaitForChildren : public Command {
+ public:
+ WaitForChildren(double timeout);
+ WaitForChildren(const std::string &name, double timeout);
+ virtual ~WaitForChildren() = default;
+
+ protected:
+ virtual void Initialize();
+ virtual void Execute();
+ virtual bool IsFinished();
+ virtual void End();
+ virtual void Interrupted();
+};
+
+#endif
diff --git a/wpilibc/shared/include/Commands/WaitUntilCommand.h b/wpilibc/shared/include/Commands/WaitUntilCommand.h
new file mode 100644
index 0000000..fd77f8e
--- /dev/null
+++ b/wpilibc/shared/include/Commands/WaitUntilCommand.h
@@ -0,0 +1,30 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011. All Rights Reserved.
+ */
+/* Open Source Software - may be modified and shared by FRC teams. The code */
+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
+/*----------------------------------------------------------------------------*/
+
+#ifndef __WAIT_UNTIL_COMMAND_H__
+#define __WAIT_UNTIL_COMMAND_H__
+
+#include "Commands/Command.h"
+
+class WaitUntilCommand : public Command {
+ public:
+ WaitUntilCommand(double time);
+ WaitUntilCommand(const std::string &name, double time);
+ virtual ~WaitUntilCommand() = default;
+
+ protected:
+ virtual void Initialize();
+ virtual void Execute();
+ virtual bool IsFinished();
+ virtual void End();
+ virtual void Interrupted();
+
+ private:
+ double m_time;
+};
+
+#endif