diff --git a/wpilibc/wpilibC++/include/Base.h b/wpilibc/wpilibC++/include/Base.h
index 2aaa4ee223..168d140953 100644
--- a/wpilibc/wpilibC++/include/Base.h
+++ b/wpilibc/wpilibC++/include/Base.h
@@ -16,4 +16,3 @@
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
-
diff --git a/wpilibc/wpilibC++/include/Buttons/Button.h b/wpilibc/wpilibC++/include/Buttons/Button.h
index c4911118ab..8897569b11 100644
--- a/wpilibc/wpilibC++/include/Buttons/Button.h
+++ b/wpilibc/wpilibC++/include/Buttons/Button.h
@@ -1,5 +1,6 @@
/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011. All Rights Reserved. */
+/* 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. */
/*----------------------------------------------------------------------------*/
@@ -18,18 +19,19 @@
*
* This class represents a subclass of Trigger that is specifically aimed at
* buttons on an operator interface as a common use case of the more generalized
- * Trigger objects. This is a simple wrapper around Trigger with the method names
+ * Trigger objects. This is a simple wrapper around Trigger with the method
+ * names
* renamed to fit the Button object use.
- *
+ *
* @author brad
*/
class Button : public Trigger {
-public:
- virtual void WhenPressed(Command *command);
- virtual void WhileHeld(Command *command);
- virtual void WhenReleased(Command *command);
- virtual void CancelWhenPressed(Command *command);
- virtual void ToggleWhenPressed(Command *command);
+ public:
+ virtual void WhenPressed(Command *command);
+ virtual void WhileHeld(Command *command);
+ virtual void WhenReleased(Command *command);
+ virtual void CancelWhenPressed(Command *command);
+ virtual void ToggleWhenPressed(Command *command);
};
#endif
diff --git a/wpilibc/wpilibC++/include/Buttons/ButtonScheduler.h b/wpilibc/wpilibC++/include/Buttons/ButtonScheduler.h
index 96d0a0ee11..7accbc9e36 100644
--- a/wpilibc/wpilibC++/include/Buttons/ButtonScheduler.h
+++ b/wpilibc/wpilibC++/include/Buttons/ButtonScheduler.h
@@ -1,5 +1,6 @@
/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011. All Rights Reserved. */
+/* 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. */
/*----------------------------------------------------------------------------*/
@@ -10,18 +11,17 @@
class Trigger;
class Command;
-class ButtonScheduler
-{
-public:
- ButtonScheduler(bool last, Trigger *button, Command *orders);
- virtual ~ButtonScheduler() {}
- virtual void Execute() = 0;
- void Start();
+class ButtonScheduler {
+ public:
+ ButtonScheduler(bool last, Trigger *button, Command *orders);
+ virtual ~ButtonScheduler() {}
+ virtual void Execute() = 0;
+ void Start();
-protected:
- bool m_pressedLast;
- Trigger *m_button;
- Command *m_command;
+ protected:
+ bool m_pressedLast;
+ Trigger *m_button;
+ Command *m_command;
};
#endif
diff --git a/wpilibc/wpilibC++/include/Buttons/CancelButtonScheduler.h b/wpilibc/wpilibC++/include/Buttons/CancelButtonScheduler.h
index 0491213164..ea5f8ff2d0 100644
--- a/wpilibc/wpilibC++/include/Buttons/CancelButtonScheduler.h
+++ b/wpilibc/wpilibC++/include/Buttons/CancelButtonScheduler.h
@@ -1,5 +1,6 @@
/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011. All Rights Reserved. */
+/* 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. */
/*----------------------------------------------------------------------------*/
@@ -12,14 +13,14 @@
class Trigger;
class Command;
-class CancelButtonScheduler : public ButtonScheduler
-{
-public:
- CancelButtonScheduler(bool last, Trigger *button, Command *orders);
- virtual ~CancelButtonScheduler() {}
- virtual void Execute();
-private:
- bool pressedLast;
+class CancelButtonScheduler : public ButtonScheduler {
+ public:
+ CancelButtonScheduler(bool last, Trigger *button, Command *orders);
+ virtual ~CancelButtonScheduler() {}
+ virtual void Execute();
+
+ private:
+ bool pressedLast;
};
#endif
diff --git a/wpilibc/wpilibC++/include/Buttons/HeldButtonScheduler.h b/wpilibc/wpilibC++/include/Buttons/HeldButtonScheduler.h
index 3bca0d5417..f68bcd70e7 100644
--- a/wpilibc/wpilibC++/include/Buttons/HeldButtonScheduler.h
+++ b/wpilibc/wpilibC++/include/Buttons/HeldButtonScheduler.h
@@ -1,5 +1,6 @@
/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011. All Rights Reserved. */
+/* 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. */
/*----------------------------------------------------------------------------*/
@@ -12,12 +13,11 @@
class Trigger;
class Command;
-class HeldButtonScheduler : public ButtonScheduler
-{
-public:
- HeldButtonScheduler(bool last, Trigger *button, Command *orders);
- virtual ~HeldButtonScheduler() {}
- virtual void Execute();
+class HeldButtonScheduler : public ButtonScheduler {
+ public:
+ HeldButtonScheduler(bool last, Trigger *button, Command *orders);
+ virtual ~HeldButtonScheduler() {}
+ virtual void Execute();
};
#endif
diff --git a/wpilibc/wpilibC++/include/Buttons/InternalButton.h b/wpilibc/wpilibC++/include/Buttons/InternalButton.h
index e61cf0a636..5f54d34818 100644
--- a/wpilibc/wpilibC++/include/Buttons/InternalButton.h
+++ b/wpilibc/wpilibC++/include/Buttons/InternalButton.h
@@ -1,5 +1,6 @@
/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011. All Rights Reserved. */
+/* 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. */
/*----------------------------------------------------------------------------*/
@@ -9,21 +10,20 @@
#include "Buttons/Button.h"
-class InternalButton : public Button
-{
-public:
- InternalButton();
- InternalButton(bool inverted);
- virtual ~InternalButton() {}
+class InternalButton : public Button {
+ public:
+ InternalButton();
+ InternalButton(bool inverted);
+ virtual ~InternalButton() {}
- void SetInverted(bool inverted);
- void SetPressed(bool pressed);
+ void SetInverted(bool inverted);
+ void SetPressed(bool pressed);
- virtual bool Get();
+ virtual bool Get();
-private:
- bool m_pressed;
- bool m_inverted;
+ private:
+ bool m_pressed;
+ bool m_inverted;
};
#endif
diff --git a/wpilibc/wpilibC++/include/Buttons/JoystickButton.h b/wpilibc/wpilibC++/include/Buttons/JoystickButton.h
index cb5f0c482c..f34f36561a 100644
--- a/wpilibc/wpilibC++/include/Buttons/JoystickButton.h
+++ b/wpilibc/wpilibC++/include/Buttons/JoystickButton.h
@@ -1,5 +1,6 @@
/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011. All Rights Reserved. */
+/* 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. */
/*----------------------------------------------------------------------------*/
@@ -10,17 +11,16 @@
#include "GenericHID.h"
#include "Buttons/Button.h"
-class JoystickButton : public Button
-{
-public:
- JoystickButton(GenericHID *joystick, int buttonNumber);
- virtual ~JoystickButton() {}
+class JoystickButton : public Button {
+ public:
+ JoystickButton(GenericHID *joystick, int buttonNumber);
+ virtual ~JoystickButton() {}
- virtual bool Get();
+ virtual bool Get();
-private:
- GenericHID *m_joystick;
- int m_buttonNumber;
+ private:
+ GenericHID *m_joystick;
+ int m_buttonNumber;
};
#endif
diff --git a/wpilibc/wpilibC++/include/Buttons/NetworkButton.h b/wpilibc/wpilibC++/include/Buttons/NetworkButton.h
index 874a768a48..6ec0c1ea79 100644
--- a/wpilibc/wpilibC++/include/Buttons/NetworkButton.h
+++ b/wpilibc/wpilibC++/include/Buttons/NetworkButton.h
@@ -1,5 +1,6 @@
/*----------------------------------------------------------------------------*/
-/* Copyright (c) FIRST 2011. All Rights Reserved. */
+/* 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. */
/*----------------------------------------------------------------------------*/
@@ -10,19 +11,17 @@
#include "Buttons/Button.h"
#include 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. 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. If a command uses a {@link Subsystem}, then it should specify that it does so by
+ * 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. If a command is running and a new command with shared requirements is started,
+ * 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
+ * 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.
It may be useful for a team to reference the {@link Command#isTimedOut() isTimedOut()} method - * for time-sensitive commands.
- * @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. - * - *This is where you may want - * to wrap up loose ends, like shutting off a motor that was being used - * in the command.
- * - *Generally, it is useful to simply call the {@link Command#end() end()} method - * within this method
- */ - virtual void Interrupted() = 0; - virtual void _Initialize(); - virtual void _Interrupted(); - virtual void _Execute(); - virtual void _End(); - virtual void _Cancel(); + protected: + void SetTimeout(double timeout); + bool IsTimedOut() const; + 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. + * + *It may be useful for a team to reference the {@link Command#isTimedOut() + * isTimedOut()} method + * for time-sensitive commands.
+ * @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. + * + *This is where you may want + * to wrap up loose ends, like shutting off a motor that was being used + * in the command.
+ * + *Generally, it is useful to simply call the {@link Command#end() end()} + * method + * within this method
+ */ + 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(); + 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() const; - virtual std::string GetSmartDashboardType() const; - virtual void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew); -protected: - ITable* m_table; + /** 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() const; + virtual std::string GetSmartDashboardType() const; + virtual void ValueChanged(ITable *source, const std::string &key, + EntryValue value, bool isNew); + + protected: + ITable *m_table; }; #endif diff --git a/wpilibc/wpilibC++/include/Commands/CommandGroup.h b/wpilibc/wpilibC++/include/Commands/CommandGroup.h index 9a7005bd62..302d9c6c1a 100644 --- a/wpilibc/wpilibC++/include/Commands/CommandGroup.h +++ b/wpilibc/wpilibC++/include/Commands/CommandGroup.h @@ -1,5 +1,6 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2011. All Rights Reserved. */ +/* 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. */ /*----------------------------------------------------------------------------*/ @@ -15,57 +16,59 @@ /** * A {@link CommandGroup} is a list of commands which are executed in sequence. * - *Commands in a {@link CommandGroup} are added using the {@link CommandGroup#AddSequential(Command) AddSequential(...)} method + *
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}.
* - *{@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(...)} + *
{@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.
* *CommandGroups can also execute commands in parallel, simply by adding them * using {@link CommandGroup#AddParallel(Command) AddParallel(...)}.
- * + * * @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() const; - int GetSize() const; +class CommandGroup : public Command { + public: + CommandGroup(); + CommandGroup(const char *name); + virtual ~CommandGroup(); -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(); + 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; -private: - void CancelConflicts(Command *command); + 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(); - typedef std::vectorIt 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 + *
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.
* */ -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(); +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(); + void Enable(); + void Disable(); - // PIDOutput interface - virtual void PIDWrite(float output); + // PIDOutput interface + virtual void PIDWrite(float output); - // PIDSource interface - virtual double PIDGet() const; - void SetSetpoint(double setpoint); - void SetSetpointRelative(double deltaSetpoint); - void SetInputRange(float minimumInput, float maximumInput); - void SetOutputRange(float minimumOutput, float maximumOutput); - double GetSetpoint(); - double GetPosition(); + // PIDSource interface + virtual double PIDGet() const; + void SetSetpoint(double setpoint); + void SetSetpointRelative(double deltaSetpoint); + void SetInputRange(float minimumInput, float maximumInput); + void SetOutputRange(float minimumOutput, float maximumOutput); + double GetSetpoint(); + double GetPosition(); - virtual void SetAbsoluteTolerance(float absValue); - virtual void SetPercentTolerance(float percent); - virtual bool OnTarget() const; + virtual void SetAbsoluteTolerance(float absValue); + virtual void SetPercentTolerance(float percent); + virtual bool OnTarget() const; -protected: - PIDController *GetPIDController(); + protected: + PIDController *GetPIDController(); - virtual double ReturnPIDInput() const = 0; - virtual void UsePIDOutput(double output) = 0; + virtual double ReturnPIDInput() const = 0; + virtual void UsePIDOutput(double output) = 0; -private: - /** The internal {@link PIDController} */ - PIDController *m_controller; + private: + /** The internal {@link PIDController} */ + PIDController *m_controller; -public: - virtual void InitTable(ITable* table); - virtual std::string GetSmartDashboardType() const; + public: + virtual void InitTable(ITable *table); + virtual std::string GetSmartDashboardType() const; }; #endif diff --git a/wpilibc/wpilibC++/include/Commands/PrintCommand.h b/wpilibc/wpilibC++/include/Commands/PrintCommand.h index b6342f5014..f36d16d942 100644 --- a/wpilibc/wpilibC++/include/Commands/PrintCommand.h +++ b/wpilibc/wpilibC++/include/Commands/PrintCommand.h @@ -1,5 +1,6 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2011. All Rights Reserved. */ +/* 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. */ /*----------------------------------------------------------------------------*/ @@ -10,21 +11,20 @@ #include "Commands/Command.h" #include