mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
CMake Changes
This is the changes made by Patrick Plenefisch converting the native code to use CMake and the CMake Maven Plugin, as opposed to the native Maven plugin. This is to allow for compatibility with newer versions of the GCC toolchain. All the cpp sources were moved from maven style directories to cpp style directories for CMake. Change-Id: I67f5e3608948f37c83b0990d232105a3784f8593
This commit is contained in:
164
wpilibc/include/Commands/Command.h
Normal file
164
wpilibc/include/Commands/Command.h
Normal file
@@ -0,0 +1,164 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* 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 <set>
|
||||
#include <string>
|
||||
|
||||
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 char *name);
|
||||
Command(double timeout);
|
||||
Command(const char *name, double timeout);
|
||||
virtual ~Command();
|
||||
double TimeSinceInitialized();
|
||||
void Requires(Subsystem *s);
|
||||
bool IsCanceled();
|
||||
void Start();
|
||||
bool Run();
|
||||
void Cancel();
|
||||
bool IsRunning();
|
||||
bool IsInterruptible();
|
||||
void SetInterruptible(bool interruptible);
|
||||
bool DoesRequire(Subsystem *subsystem);
|
||||
typedef std::set<Subsystem *> SubsystemSet;
|
||||
SubsystemSet GetRequirements();
|
||||
CommandGroup *GetGroup();
|
||||
void SetRunWhenDisabled(bool run);
|
||||
bool WillRunWhenDisabled();
|
||||
int GetID();
|
||||
|
||||
|
||||
protected:
|
||||
void SetTimeout(double timeout);
|
||||
bool IsTimedOut();
|
||||
bool AssertUnlocked(const char *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 InitCommand(const char *name, double timeout);
|
||||
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;
|
||||
/** 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;
|
||||
/** The requirements (or null if no requirements) */
|
||||
SubsystemSet m_requirements;
|
||||
/** Whether or not it is running */
|
||||
bool m_running;
|
||||
/** Whether or not it is interruptible*/
|
||||
bool m_interruptible;
|
||||
/** Whether or not it has been canceled */
|
||||
bool m_canceled;
|
||||
/** Whether or not it has been locked */
|
||||
bool m_locked;
|
||||
/** Whether this command should run when the robot is disabled */
|
||||
bool m_runWhenDisabled;
|
||||
/** The {@link CommandGroup} this is in */
|
||||
CommandGroup *m_parent;
|
||||
int m_commandID;
|
||||
static int m_commandCounter;
|
||||
|
||||
public:
|
||||
virtual std::string GetName();
|
||||
virtual void InitTable(ITable* table);
|
||||
virtual ITable* GetTable();
|
||||
virtual std::string GetSmartDashboardType();
|
||||
virtual void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
|
||||
protected:
|
||||
ITable* m_table;
|
||||
};
|
||||
|
||||
#endif
|
||||
71
wpilibc/include/Commands/CommandGroup.h
Normal file
71
wpilibc/include/Commands/CommandGroup.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* 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();
|
||||
CommandGroup(const char *name);
|
||||
virtual ~CommandGroup();
|
||||
|
||||
void AddSequential(Command *command);
|
||||
void AddSequential(Command *command, double timeout);
|
||||
void AddParallel(Command *command);
|
||||
void AddParallel(Command *command, double timeout);
|
||||
bool IsInterruptible();
|
||||
int GetSize();
|
||||
|
||||
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);
|
||||
|
||||
typedef std::vector<CommandGroupEntry> CommandVector;
|
||||
/** The commands in this group (stored in entries) */
|
||||
CommandVector m_commands;
|
||||
typedef std::list<CommandGroupEntry> CommandList;
|
||||
/** The active children in this group (stored in entries) */
|
||||
CommandList m_children;
|
||||
/** The current command, -1 signifies that none have been run */
|
||||
int m_currentCommandIndex;
|
||||
};
|
||||
|
||||
#endif
|
||||
27
wpilibc/include/Commands/CommandGroupEntry.h
Normal file
27
wpilibc/include/Commands/CommandGroupEntry.h
Normal file
@@ -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 __COMMAND_GROUP_ENTRY_H__
|
||||
#define __COMMAND_GROUP_ENTRY_H__
|
||||
|
||||
class Command;
|
||||
|
||||
class CommandGroupEntry
|
||||
{
|
||||
public:
|
||||
typedef enum {kSequence_InSequence, kSequence_BranchPeer, kSequence_BranchChild} Sequence;
|
||||
|
||||
CommandGroupEntry();
|
||||
CommandGroupEntry(Command *command, Sequence state);
|
||||
CommandGroupEntry(Command *command, Sequence state, double timeout);
|
||||
bool IsTimedOut();
|
||||
|
||||
double m_timeout;
|
||||
Command *m_command;
|
||||
Sequence m_state;
|
||||
};
|
||||
|
||||
#endif
|
||||
56
wpilibc/include/Commands/PIDCommand.h
Normal file
56
wpilibc/include/Commands/PIDCommand.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* 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 "PIDSource.h"
|
||||
#include "PIDOutput.h"
|
||||
|
||||
class PIDController;
|
||||
|
||||
class PIDCommand : public Command, public PIDOutput, public PIDSource
|
||||
{
|
||||
public:
|
||||
PIDCommand(const char *name, double p, double i, double d);
|
||||
PIDCommand(const char *name, double p, double i, double d, double period);
|
||||
PIDCommand(const char *name, double p, double i, double d, double f, double perioid);
|
||||
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();
|
||||
|
||||
void SetSetpointRelative(double deltaSetpoint);
|
||||
|
||||
// PIDOutput interface
|
||||
virtual void PIDWrite(float output);
|
||||
|
||||
// PIDSource interface
|
||||
virtual double PIDGet();
|
||||
protected:
|
||||
PIDController *GetPIDController();
|
||||
virtual void _Initialize();
|
||||
virtual void _Interrupted();
|
||||
virtual void _End();
|
||||
void SetSetpoint(double setpoint);
|
||||
double GetSetpoint();
|
||||
double GetPosition();
|
||||
|
||||
virtual double ReturnPIDInput() = 0;
|
||||
virtual void UsePIDOutput(double output) = 0;
|
||||
|
||||
private:
|
||||
/** The internal {@link PIDController} */
|
||||
PIDController *m_controller;
|
||||
|
||||
public:
|
||||
virtual void InitTable(ITable* table);
|
||||
virtual std::string GetSmartDashboardType();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
70
wpilibc/include/Commands/PIDSubsystem.h
Normal file
70
wpilibc/include/Commands/PIDSubsystem.h
Normal file
@@ -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 __PID_SUBSYSTEM_H__
|
||||
#define __PID_SUBSYSTEM_H__
|
||||
|
||||
#include "Commands/Subsystem.h"
|
||||
#include "PIDController.h"
|
||||
#include "PIDSource.h"
|
||||
#include "PIDOutput.h"
|
||||
|
||||
/**
|
||||
* 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 char *name, double p, double i, double d);
|
||||
PIDSubsystem(const char *name, double p, double i, double d, double f);
|
||||
PIDSubsystem(const char *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();
|
||||
|
||||
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);
|
||||
double GetSetpoint();
|
||||
double GetPosition();
|
||||
|
||||
virtual void SetAbsoluteTolerance(float absValue);
|
||||
virtual void SetPercentTolerance(float percent);
|
||||
virtual bool OnTarget();
|
||||
|
||||
protected:
|
||||
PIDController *GetPIDController();
|
||||
|
||||
virtual double ReturnPIDInput() = 0;
|
||||
virtual void UsePIDOutput(double output) = 0;
|
||||
|
||||
private:
|
||||
/** The internal {@link PIDController} */
|
||||
PIDController *m_controller;
|
||||
|
||||
public:
|
||||
virtual void InitTable(ITable* table);
|
||||
virtual std::string GetSmartDashboardType();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
30
wpilibc/include/Commands/PrintCommand.h
Normal file
30
wpilibc/include/Commands/PrintCommand.h
Normal file
@@ -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 char *message);
|
||||
virtual ~PrintCommand() {}
|
||||
|
||||
protected:
|
||||
virtual void Initialize();
|
||||
virtual void Execute();
|
||||
virtual bool IsFinished();
|
||||
virtual void End();
|
||||
virtual void Interrupted();
|
||||
|
||||
private:
|
||||
std::string m_message;
|
||||
};
|
||||
|
||||
#endif
|
||||
71
wpilibc/include/Commands/Scheduler.h
Normal file
71
wpilibc/include/Commands/Scheduler.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* 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 "networktables2/type/NumberArray.h"
|
||||
#include "networktables2/type/StringArray.h"
|
||||
#include "SmartDashboard/SmartDashboard.h"
|
||||
#include "HAL/Semaphore.h"
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
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 SetEnabled(bool enabled);
|
||||
|
||||
void UpdateTable();
|
||||
std::string GetSmartDashboardType();
|
||||
void InitTable(ITable *subTable);
|
||||
ITable * GetTable();
|
||||
std::string GetName();
|
||||
std::string GetType();
|
||||
|
||||
private:
|
||||
Scheduler();
|
||||
virtual ~Scheduler();
|
||||
|
||||
void ProcessCommandAddition(Command *command);
|
||||
|
||||
static Scheduler *_instance;
|
||||
Command::SubsystemSet m_subsystems;
|
||||
MUTEX_ID m_buttonsLock;
|
||||
typedef std::vector<ButtonScheduler *> ButtonVector;
|
||||
ButtonVector m_buttons;
|
||||
typedef std::vector<Command *> CommandVector;
|
||||
MUTEX_ID m_additionsLock;
|
||||
CommandVector m_additions;
|
||||
typedef std::set<Command *> CommandSet;
|
||||
CommandSet m_commands;
|
||||
bool m_adding;
|
||||
bool m_enabled;
|
||||
StringArray *commands;
|
||||
NumberArray *ids;
|
||||
NumberArray *toCancel;
|
||||
ITable *m_table;
|
||||
bool m_runningCommandsChanged;
|
||||
};
|
||||
#endif
|
||||
|
||||
29
wpilibc/include/Commands/StartCommand.h
Normal file
29
wpilibc/include/Commands/StartCommand.h
Normal file
@@ -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() {}
|
||||
|
||||
protected:
|
||||
virtual void Initialize();
|
||||
virtual void Execute();
|
||||
virtual bool IsFinished();
|
||||
virtual void End();
|
||||
virtual void Interrupted();
|
||||
|
||||
private:
|
||||
Command *m_commandToFork;
|
||||
};
|
||||
|
||||
#endif
|
||||
48
wpilibc/include/Commands/Subsystem.h
Normal file
48
wpilibc/include/Commands/Subsystem.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* 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>
|
||||
|
||||
|
||||
class Command;
|
||||
|
||||
class Subsystem : public ErrorBase, public NamedSendable
|
||||
{
|
||||
friend class Scheduler;
|
||||
public:
|
||||
Subsystem(const char *name);
|
||||
virtual ~Subsystem() {}
|
||||
|
||||
void SetDefaultCommand(Command *command);
|
||||
Command *GetDefaultCommand();
|
||||
void SetCurrentCommand(Command *command);
|
||||
Command *GetCurrentCommand();
|
||||
virtual void InitDefaultCommand();
|
||||
|
||||
private:
|
||||
void ConfirmCommand();
|
||||
|
||||
Command *m_currentCommand;
|
||||
bool m_currentCommandChanged;
|
||||
Command *m_defaultCommand;
|
||||
std::string m_name;
|
||||
bool m_initializedDefaultCommand;
|
||||
|
||||
public:
|
||||
virtual std::string GetName();
|
||||
virtual void InitTable(ITable* table);
|
||||
virtual ITable* GetTable();
|
||||
virtual std::string GetSmartDashboardType();
|
||||
protected:
|
||||
ITable* m_table;
|
||||
};
|
||||
|
||||
#endif
|
||||
27
wpilibc/include/Commands/WaitCommand.h
Normal file
27
wpilibc/include/Commands/WaitCommand.h
Normal file
@@ -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 char *name, double timeout);
|
||||
virtual ~WaitCommand() {}
|
||||
|
||||
protected:
|
||||
virtual void Initialize();
|
||||
virtual void Execute();
|
||||
virtual bool IsFinished();
|
||||
virtual void End();
|
||||
virtual void Interrupted();
|
||||
};
|
||||
|
||||
#endif
|
||||
27
wpilibc/include/Commands/WaitForChildren.h
Normal file
27
wpilibc/include/Commands/WaitForChildren.h
Normal file
@@ -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 char *name, double timeout);
|
||||
virtual ~WaitForChildren() {}
|
||||
|
||||
protected:
|
||||
virtual void Initialize();
|
||||
virtual void Execute();
|
||||
virtual bool IsFinished();
|
||||
virtual void End();
|
||||
virtual void Interrupted();
|
||||
};
|
||||
|
||||
#endif
|
||||
30
wpilibc/include/Commands/WaitUntilCommand.h
Normal file
30
wpilibc/include/Commands/WaitUntilCommand.h
Normal file
@@ -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 char *name, double time);
|
||||
virtual ~WaitUntilCommand() {}
|
||||
|
||||
protected:
|
||||
virtual void Initialize();
|
||||
virtual void Execute();
|
||||
virtual bool IsFinished();
|
||||
virtual void End();
|
||||
virtual void Interrupted();
|
||||
|
||||
private:
|
||||
double m_time;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user