diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/.cproject b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/.cproject
index 1f7bf740af..c4d783aa48 100644
--- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/.cproject
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/.cproject
@@ -152,8 +152,8 @@
-
-
+
+
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.cpp
new file mode 100644
index 0000000000..c4eeb845e4
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.cpp
@@ -0,0 +1,25 @@
+#include "CheckForHotGoal.h"
+
+#include "Robot.h"
+
+CheckForHotGoal::CheckForHotGoal(double time) {
+ SetTimeout(time);
+}
+
+// Called just before this Command runs the first time
+void CheckForHotGoal::Initialize() {}
+
+// Called repeatedly when this Command is scheduled to run
+void CheckForHotGoal::Execute() {}
+
+// Make this return true when this Command no longer needs to run execute()
+bool CheckForHotGoal::IsFinished() {
+ return IsTimedOut() || Robot::shooter->GoalIsHot();
+}
+
+// Called once after isFinished returns true
+void CheckForHotGoal::End() {}
+
+// Called when another command which requires one or more of the same
+// subsystems is scheduled to run
+void CheckForHotGoal::Interrupted() {}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.h
new file mode 100644
index 0000000000..8fbbe08162
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.h
@@ -0,0 +1,22 @@
+#ifndef CheckForHotGoal_H
+#define CheckForHotGoal_H
+
+#include "WPILib.h"
+
+/**
+ * This command looks for the hot goal and waits until it's detected or timed
+ * out. The timeout is because it's better to shoot and get some autonomous
+ * points than get none. When called sequentially, this command will block until
+ * the hot goal is detected or until it is timed out.
+ */
+class CheckForHotGoal : Command {
+public:
+ CheckForHotGoal(double time);
+ void Initialize();
+ void Execute();
+ bool IsFinished();
+ void End();
+ void Interrupted();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.cpp
new file mode 100644
index 0000000000..580a1ab8a3
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.cpp
@@ -0,0 +1,27 @@
+#include "CloseClaw.h"
+
+#include "Robot.h"
+
+CloseClaw::CloseClaw() {
+ Requires(Robot::collector);
+}
+
+// Called just before this Command runs the first time
+void CloseClaw::Initialize() {
+ Robot::collector->Close();
+}
+
+// Called repeatedly when this Command is scheduled to run
+void CloseClaw::Execute() {}
+
+// Make this return true when this Command no longer needs to run execute()
+bool CloseClaw::IsFinished() {
+ return true;
+}
+
+// Called once after isFinished returns true
+void CloseClaw::End() {}
+
+// Called when another command which requires one or more of the same
+// subsystems is scheduled to run
+void CloseClaw::Interrupted() {}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.h
new file mode 100644
index 0000000000..dec6cc7b03
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.h
@@ -0,0 +1,22 @@
+#ifndef CloseClaw_H
+#define CloseClaw_H
+
+#include "WPILib.h"
+
+/**
+ * Close the claw.
+ *
+ * NOTE: It doesn't wait for the claw to close since there is no sensor to
+ * detect that.
+ */
+class CloseClaw: public Command {
+public:
+ CloseClaw();
+ void Initialize();
+ void Execute();
+ bool IsFinished();
+ void End();
+ void Interrupted();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.cpp
new file mode 100644
index 0000000000..bb76efff0a
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.cpp
@@ -0,0 +1,14 @@
+#include "Collect.h"
+
+#include "Robot.h"
+#include "Commands/SetCollectionSpeed.h"
+#include "Commands/CloseClaw.h"
+#include "Commands/SetPivotSetpoint.h"
+#include "Commands/WaitForBall.h"
+
+Collect::Collect() {
+ AddSequential(new SetCollectionSpeed(Collector::FORWARD));
+ AddParallel(new CloseClaw());
+ AddSequential(new SetPivotSetpoint(Pivot::COLLECT));
+ AddSequential(new WaitForBall());
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.h
new file mode 100644
index 0000000000..974d2a0a24
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.h
@@ -0,0 +1,14 @@
+#ifndef Collect_H
+#define Collect_H
+
+#include "WPILib.h"
+
+/**
+ * Get the robot set to collect balls.
+ */
+class Collect: public CommandGroup {
+public:
+ Collect();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.cpp
new file mode 100644
index 0000000000..802efdc095
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.cpp
@@ -0,0 +1,20 @@
+#include "DriveAndShootAutonomous.h"
+
+#include "Robot.h"
+#include "Commands/WaitForPressure.h"
+#include "Commands/CloseClaw.h"
+#include "Commands/SetPivotSetpoint.h"
+#include "Commands/DriveForward.h"
+#include "Commands/Shoot.h"
+
+DriveAndShootAutonomous::DriveAndShootAutonomous() {
+ AddSequential(new WaitForPressure(), 2);
+ #ifdef REAL
+ // NOTE: Simulation doesn't currently have the concept of hot.
+ AddSequential(new CheckForHotGoal(2));
+ #endif
+ AddSequential(new CloseClaw());
+ AddSequential(new SetPivotSetpoint(45));
+ AddSequential(new DriveForward(8, 0.4));
+ AddSequential(new Shoot());
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.h
new file mode 100644
index 0000000000..38a7c6e9c3
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.h
@@ -0,0 +1,15 @@
+#ifndef DriveAndShootAutonomous_H
+#define DriveAndShootAutonomous_H
+
+#include "WPILib.h"
+
+/**
+ * Drive over the line and then shoot the ball. If the hot goal is not detected,
+ * it will wait briefly.
+ */
+class DriveAndShootAutonomous: public CommandGroup {
+public:
+ DriveAndShootAutonomous();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.cpp
new file mode 100644
index 0000000000..7f05406aa2
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.cpp
@@ -0,0 +1,55 @@
+#include "DriveForward.h"
+
+#include "Robot.h"
+
+void DriveForward::init(double dist, double maxSpeed) {
+ Requires(Robot::drivetrain);
+ distance = dist;
+ driveForwardSpeed = maxSpeed;
+ error = 0;
+}
+
+DriveForward::DriveForward() {
+ init(10, 0.5);
+}
+
+DriveForward::DriveForward(double dist) {
+ init(dist, 0.5);
+}
+
+DriveForward::DriveForward(double dist, double maxSpeed) {
+ init(dist, maxSpeed);
+}
+
+// Called just before this Command runs the first time
+void DriveForward::Initialize() {
+ Robot::drivetrain->GetRightEncoder()->Reset();
+ SetTimeout(2);
+}
+
+// Called repeatedly when this Command is scheduled to run
+void DriveForward::Execute() {
+ error = (distance - Robot::drivetrain->GetRightEncoder()->GetDistance());
+ if (driveForwardSpeed * KP * error >= driveForwardSpeed) {
+ Robot::drivetrain->TankDrive(driveForwardSpeed, driveForwardSpeed);
+ } else {
+ Robot::drivetrain->TankDrive(driveForwardSpeed * KP * error,
+ driveForwardSpeed * KP * error);
+ }
+}
+
+// Make this return true when this Command no longer needs to run execute()
+bool DriveForward::IsFinished() {
+ return (abs(error) <= TOLERANCE) || IsTimedOut();
+}
+
+// Called once after isFinished returns true
+void DriveForward::End() {
+ Robot::drivetrain->Stop();
+}
+
+// Called when another command which requires one or more of the same
+// subsystems is scheduled to run
+void DriveForward::Interrupted() {
+ End();
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.h
new file mode 100644
index 0000000000..267c752ca0
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.h
@@ -0,0 +1,29 @@
+#ifndef DriveForward_H
+#define DriveForward_H
+
+#include "WPILib.h"
+
+/**
+ * This command drives the robot over a given distance with simple proportional
+ * control This command will drive a given distance limiting to a maximum speed.
+ */
+class DriveForward: public Command {
+private:
+ double driveForwardSpeed;
+ double distance;
+ double error;
+ static const double TOLERANCE = .1;
+ static const double KP = -1.0 / 5.0;
+ void init(double dist, double maxSpeed);
+public:
+ DriveForward();
+ DriveForward(double dist);
+ DriveForward(double dist, double maxSpeed);
+ void Initialize();
+ void Execute();
+ bool IsFinished();
+ void End();
+ void Interrupted();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.cpp
new file mode 100644
index 0000000000..da6713a0f0
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.cpp
@@ -0,0 +1,31 @@
+#include "DriveWithJoystick.h"
+
+#include "Robot.h"
+
+DriveWithJoystick::DriveWithJoystick() {
+ Requires(Robot::drivetrain);
+}
+
+// Called just before this Command runs the first time
+void DriveWithJoystick::Initialize() {}
+
+// Called repeatedly when this Command is scheduled to run
+void DriveWithJoystick::Execute() {
+ Robot::drivetrain->TankDrive(Robot::oi->GetJoystick());
+}
+
+// Make this return true when this Command no longer needs to run execute()
+bool DriveWithJoystick::IsFinished() {
+ return false;
+}
+
+// Called once after isFinished returns true
+void DriveWithJoystick::End() {
+ Robot::drivetrain->Stop();
+}
+
+// Called when another command which requires one or more of the same
+// subsystems is scheduled to run
+void DriveWithJoystick::Interrupted() {
+ End();
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.h
new file mode 100644
index 0000000000..0dff411d42
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.h
@@ -0,0 +1,20 @@
+#ifndef DriveWithJoystick_H
+#define DriveWithJoystick_H
+
+#include "WPILib.h"
+
+/**
+ * This command allows PS3 joystick to drive the robot. It is always running
+ * except when interrupted by another command.
+ */
+class DriveWithJoystick: public Command {
+public:
+ DriveWithJoystick();
+ void Initialize();
+ void Execute();
+ bool IsFinished();
+ void End();
+ void Interrupted();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.cpp
new file mode 100644
index 0000000000..21d907f6f1
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.cpp
@@ -0,0 +1,32 @@
+#include "ExtendShooter.h"
+
+#include "Robot.h"
+
+ExtendShooter::ExtendShooter() {
+ Requires(Robot::shooter);
+ SetTimeout(1);
+}
+
+// Called just before this Command runs the first time
+void ExtendShooter::Initialize() {
+ Robot::shooter->ExtendBoth();
+}
+
+// Called repeatedly when this Command is scheduled to run
+void ExtendShooter::Execute() {}
+
+// Make this return true when this Command no longer needs to run execute()
+bool ExtendShooter::IsFinished() {
+ return IsTimedOut();
+}
+
+// Called once after isFinished returns true
+void ExtendShooter::End() {
+ Robot::shooter->RetractBoth();
+}
+
+// Called when another command which requires one or more of the same
+// subsystems is scheduled to run
+void ExtendShooter::Interrupted() {
+ End();
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.h
new file mode 100644
index 0000000000..7a8357235b
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.h
@@ -0,0 +1,19 @@
+#ifndef ExtendShooter_H
+#define ExtendShooter_H
+
+#include "WPILib.h"
+
+/**
+ * Extend the shooter and then retract it after a second.
+ */
+class ExtendShooter: public Command {
+public:
+ ExtendShooter();
+ void Initialize();
+ void Execute();
+ bool IsFinished();
+ void End();
+ void Interrupted();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.cpp
new file mode 100644
index 0000000000..35f90a66b2
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.cpp
@@ -0,0 +1,12 @@
+#include "LowGoal.h"
+
+#include "Robot.h"
+#include "Commands/SetPivotSetpoint.h"
+#include "Commands/SetCollectionSpeed.h"
+#include "Commands/ExtendShooter.h"
+
+LowGoal::LowGoal() {
+ AddSequential(new SetPivotSetpoint(Pivot::LOW_GOAL));
+ AddSequential(new SetCollectionSpeed(Collector::REVERSE));
+ AddSequential(new ExtendShooter());
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.h
new file mode 100644
index 0000000000..398b88d3e7
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.h
@@ -0,0 +1,14 @@
+#ifndef LowGoal_H
+#define LowGoal_H
+
+#include "WPILib.h"
+
+/**
+ * Spit the ball out into the low goal assuming that the robot is in front of it.
+ */
+class LowGoal: public CommandGroup {
+public:
+ LowGoal();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.cpp
new file mode 100644
index 0000000000..abd2a95809
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.cpp
@@ -0,0 +1,27 @@
+#include "OpenClaw.h"
+
+#include "Robot.h"
+
+OpenClaw::OpenClaw() {
+ Requires(Robot::collector);
+}
+
+// Called just before this Command runs the first time
+void OpenClaw::Initialize() {
+ Robot::collector->Open();
+}
+
+// Called repeatedly when this Command is scheduled to run
+void OpenClaw::Execute() {}
+
+// Make this return true when this Command no longer needs to run execute()
+bool OpenClaw::IsFinished() {
+ return Robot::collector->IsOpen();
+}
+
+// Called once after isFinished returns true
+void OpenClaw::End() {}
+
+// Called when another command which requires one or more of the same
+// subsystems is scheduled to run
+void OpenClaw::Interrupted() {}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.h
new file mode 100644
index 0000000000..47ef131e89
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.h
@@ -0,0 +1,19 @@
+#ifndef OpenClaw_H
+#define OpenClaw_H
+
+#include "WPILib.h"
+
+/**
+ * Opens the claw
+ */
+class OpenClaw: public Command {
+public:
+ OpenClaw();
+ void Initialize();
+ void Execute();
+ bool IsFinished();
+ void End();
+ void Interrupted();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.cpp
new file mode 100644
index 0000000000..46b0f17372
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.cpp
@@ -0,0 +1,28 @@
+#include "SetCollectionSpeed.h"
+
+#include "Robot.h"
+
+SetCollectionSpeed::SetCollectionSpeed(double speed) {
+ Requires(Robot::collector);
+ this->speed = speed;
+}
+
+// Called just before this Command runs the first time
+void SetCollectionSpeed::Initialize() {
+ Robot::collector->SetSpeed(speed);
+}
+
+// Called repeatedly when this Command is scheduled to run
+void SetCollectionSpeed::Execute() {}
+
+// Make this return true when this Command no longer needs to run execute()
+bool SetCollectionSpeed::IsFinished() {
+ return true;
+}
+
+// Called once after isFinished returns true
+void SetCollectionSpeed::End() {}
+
+// Called when another command which requires one or more of the same
+// subsystems is scheduled to run
+void SetCollectionSpeed::Interrupted() {}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.h
new file mode 100644
index 0000000000..b41fb75393
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.h
@@ -0,0 +1,23 @@
+#ifndef SetCollectionSpeed_H
+#define SetCollectionSpeed_H
+
+#include "WPILib.h"
+
+/**
+ * This command sets the collector rollers spinning at the given speed. Since
+ * there is no sensor for detecting speed, it finishes immediately. As a result,
+ * the spinners may still be adjusting their speed.
+ */
+class SetCollectionSpeed: public Command {
+private:
+ double speed;
+public:
+ SetCollectionSpeed(double speed);
+ void Initialize();
+ void Execute();
+ bool IsFinished();
+ void End();
+ void Interrupted();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.cpp
new file mode 100644
index 0000000000..2d0541bd5e
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.cpp
@@ -0,0 +1,30 @@
+#include "SetPivotSetpoint.h"
+
+#include "Robot.h"
+
+SetPivotSetpoint::SetPivotSetpoint(double setpoint) {
+ this->setpoint = setpoint;
+ Requires(Robot::pivot);
+}
+
+// Called just before this Command runs the first time
+void SetPivotSetpoint::Initialize() {
+ Robot::pivot->Enable();
+ Robot::pivot->SetSetpoint(setpoint);
+}
+
+// Called repeatedly when this Command is scheduled to run
+void SetPivotSetpoint::Execute() {}
+
+// Make this return true when this Command no longer needs to run execute()
+bool SetPivotSetpoint::IsFinished()
+{
+ return Robot::pivot->OnTarget();
+}
+
+// Called once after isFinished returns true
+void SetPivotSetpoint::End() {}
+
+// Called when another command which requires one or more of the same
+// subsystems is scheduled to run
+void SetPivotSetpoint::Interrupted() {}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.h
new file mode 100644
index 0000000000..adfaca6d7d
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.h
@@ -0,0 +1,24 @@
+#ifndef SetPivotSetpoint_H
+#define SetPivotSetpoint_H
+
+#include "WPILib.h"
+
+/**
+ * Moves the pivot to a given angle. This command finishes when it is within
+ * the tolerance, but leaves the PID loop running to maintain the position.
+ * Other commands using the pivot should make sure they disable PID!
+ */
+class SetPivotSetpoint: public Command {
+public:
+ SetPivotSetpoint(double setpoint);
+ void Initialize();
+ void Execute();
+ bool IsFinished();
+ void End();
+ void Interrupted();
+
+private:
+ double setpoint;
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.cpp
new file mode 100644
index 0000000000..5112484433
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.cpp
@@ -0,0 +1,14 @@
+#include "Shoot.h"
+
+#include "Robot.h"
+#include "Commands/WaitForPressure.h"
+#include "Commands/SetCollectionSpeed.h"
+#include "Commands/OpenClaw.h"
+#include "Commands/ExtendShooter.h"
+
+Shoot::Shoot() {
+ AddSequential(new WaitForPressure());
+ AddSequential(new SetCollectionSpeed(Collector::STOP));
+ AddSequential(new OpenClaw());
+ AddSequential(new ExtendShooter());
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.h
new file mode 100644
index 0000000000..290045491d
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.h
@@ -0,0 +1,14 @@
+#ifndef Shoot_H
+#define Shoot_H
+
+#include "WPILib.h"
+
+/**
+ * Shoot the ball at the current angle.
+ */
+class Shoot: public CommandGroup {
+public:
+ Shoot();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.cpp
new file mode 100644
index 0000000000..12d862f11d
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.cpp
@@ -0,0 +1,26 @@
+#include "WaitForBall.h"
+
+#include "Robot.h"
+
+WaitForBall::WaitForBall() {
+ Requires(Robot::collector);
+}
+
+// Called just before this Command runs the first time
+void WaitForBall::Initialize() {}
+
+// Called repeatedly when this Command is scheduled to run
+void WaitForBall::Execute() {}
+
+// Make this return true when this Command no longer needs to run execute()
+bool WaitForBall::IsFinished()
+{
+ return Robot::collector->HasBall();
+}
+
+// Called once after isFinished returns true
+void WaitForBall::End() {}
+
+// Called when another command which requires one or more of the same
+// subsystems is scheduled to run
+void WaitForBall::Interrupted() {}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.h
new file mode 100644
index 0000000000..3109b276a2
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.h
@@ -0,0 +1,21 @@
+#ifndef WaitForBall_H
+#define WaitForBall_H
+
+#include "WPILib.h"
+
+/**
+ * Wait until the collector senses that it has the ball. This command does
+ * nothing and is intended to be used in command groups to wait for this
+ * condition.
+ */
+class WaitForBall: public Command {
+public:
+ WaitForBall();
+ void Initialize();
+ void Execute();
+ bool IsFinished();
+ void End();
+ void Interrupted();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.cpp
new file mode 100644
index 0000000000..1e61a559e2
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.cpp
@@ -0,0 +1,27 @@
+#include "WaitForPressure.h"
+
+#include "Robot.h"
+
+WaitForPressure::WaitForPressure()
+{
+ Requires(Robot::pneumatics);
+}
+
+// Called just before this Command runs the first time
+void WaitForPressure::Initialize() {}
+
+// Called repeatedly when this Command is scheduled to run
+void WaitForPressure::Execute() {}
+
+// Make this return true when this Command no longer needs to run execute()
+bool WaitForPressure::IsFinished()
+{
+ return Robot::pneumatics->IsPressurized();
+}
+
+// Called once after isFinished returns true
+void WaitForPressure::End() {}
+
+// Called when another command which requires one or more of the same
+// subsystems is scheduled to run
+void WaitForPressure::Interrupted() {}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.h
new file mode 100644
index 0000000000..d097b64681
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.h
@@ -0,0 +1,20 @@
+#ifndef WaitForPressure_H
+#define WaitForPressure_H
+
+#include "WPILib.h"
+
+/**
+ * Wait until the pneumatics are fully pressurized. This command does nothing
+ * and is intended to be used in command groups to wait for this condition.
+ */
+class WaitForPressure: public Command {
+public:
+ WaitForPressure();
+ void Initialize();
+ void Execute();
+ bool IsFinished();
+ void End();
+ void Interrupted();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.cpp
new file mode 100644
index 0000000000..51698dfae2
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.cpp
@@ -0,0 +1,40 @@
+#include "OI.h"
+
+#include "Subsystems/Pivot.h"
+#include "Subsystems/Collector.h"
+#include "Commands/LowGoal.h"
+#include "Commands/Collect.h"
+#include "Commands/SetPivotSetpoint.h"
+#include "Commands/Shoot.h"
+#include "Commands/DriveForward.h"
+#include "Commands/SetCollectionSpeed.h"
+
+OI::OI() {
+ joystick = new Joystick(1);
+
+ R1 = new JoystickButton(joystick, 12);
+ R1->WhenPressed(new LowGoal());
+ R2 = new JoystickButton(joystick, 10);
+ R2->WhenPressed(new Collect());
+
+ L1 = new JoystickButton(joystick, 11);
+ L1->WhenPressed(new SetPivotSetpoint(Pivot::SHOOT));
+ L2 = new JoystickButton(joystick, 9);
+ L2->WhenPressed(new SetPivotSetpoint(Pivot::SHOOT_NEAR));
+
+ sticks = new DoubleButton(joystick, 2, 3);
+ sticks->WhenActive(new Shoot());
+
+
+ // SmartDashboard Buttons
+ SmartDashboard::PutData("Drive Forward", new DriveForward(2.25));
+ SmartDashboard::PutData("Drive Backward", new DriveForward(-2.25));
+ SmartDashboard::PutData("Start Rollers", new SetCollectionSpeed(Collector::FORWARD));
+ SmartDashboard::PutData("Stop Rollers", new SetCollectionSpeed(Collector::STOP));
+ SmartDashboard::PutData("Reverse Rollers", new SetCollectionSpeed(Collector::REVERSE));
+}
+
+
+Joystick* OI::GetJoystick() {
+ return joystick;
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.h
new file mode 100644
index 0000000000..83123e5cab
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.h
@@ -0,0 +1,17 @@
+#ifndef OI_H
+#define OI_H
+
+#include "WPILib.h"
+#include "Triggers/DoubleButton.h"
+
+class OI {
+private:
+ Joystick* joystick;
+ JoystickButton *L1, *L2, *R1, *R2;
+ DoubleButton* sticks;
+public:
+ OI();
+ Joystick* GetJoystick();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.cpp
new file mode 100644
index 0000000000..1b0e36132f
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.cpp
@@ -0,0 +1,90 @@
+
+#include "Robot.h"
+#include "Commands/DriveAndShootAutonomous.h"
+#include "Commands/DriveForward.h"
+
+DriveTrain* Robot::drivetrain = NULL;
+Pivot* Robot::pivot = NULL;
+Collector* Robot::collector = NULL;
+Shooter* Robot::shooter = NULL;
+Pneumatics* Robot::pneumatics = NULL;
+
+OI* Robot::oi = NULL;
+
+void Robot::RobotInit() {
+ drivetrain = new DriveTrain();
+ pivot = new Pivot();
+ collector = new Collector();
+ shooter = new Shooter();
+ pneumatics = new Pneumatics();
+
+ // Show what command your subsystem is running on the SmartDashboard
+ SmartDashboard::PutData(drivetrain);
+ SmartDashboard::PutData(pivot);
+ SmartDashboard::PutData(collector);
+ SmartDashboard::PutData(shooter);
+ SmartDashboard::PutData(pneumatics);
+
+ oi = new OI();
+
+ autonomousCommand = new DriveAndShootAutonomous();
+ lw = LiveWindow::GetInstance();
+
+ // instantiate the command used for the autonomous period
+ autoChooser = new SendableChooser();
+ autoChooser->AddDefault("Drive and Shoot", new DriveAndShootAutonomous());
+ autoChooser->AddObject("Drive Forward", new DriveForward());
+ SmartDashboard::PutData("Auto Mode", autoChooser);
+
+ pneumatics->Start(); // Pressurize the pneumatics.
+}
+
+void Robot::AutonomousInit() {
+ autonomousCommand = (Command*) autoChooser->GetSelected();
+ autonomousCommand->Start();
+}
+
+void Robot::AutonomousPeriodic() {
+ Scheduler::GetInstance()->Run();
+ Log();
+}
+
+void Robot::TeleopInit() {
+ // This makes sure that the autonomous stops running when
+ // teleop starts running. If you want the autonomous to
+ // continue until interrupted by another command, remove
+ // this line or comment it out.
+ if (autonomousCommand != NULL) {
+ autonomousCommand->Cancel();
+ }
+ std::cout << "Starting Teleop" << std::endl;
+}
+
+void Robot::TeleopPeriodic() {
+ Scheduler::GetInstance()->Run();
+ Log();
+}
+
+void Robot::TestPeriodic() {
+ lw->Run();
+}
+
+void Robot::DisabledInit() {
+ shooter->Unlatch();
+}
+
+void Robot::DisabledPeriodic() {
+ Log();
+}
+
+/**
+ * Log interesting values to the SmartDashboard.
+ */
+void Robot::Log() {
+ Robot::pneumatics->WritePressure();
+ SmartDashboard::PutNumber("Pivot Pot Value", pivot->GetAngle());
+ SmartDashboard::PutNumber("Left Distance", drivetrain->GetLeftEncoder()->GetDistance());
+ SmartDashboard::PutNumber("Right Distance", drivetrain->GetRightEncoder()->GetDistance());
+}
+
+START_ROBOT_CLASS(Robot);
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.h
new file mode 100644
index 0000000000..4bc7ae60a5
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.h
@@ -0,0 +1,48 @@
+/*
+ * Robot.h
+ *
+ * Created on: Jun 3, 2014
+ * Author: alex
+ */
+
+#ifndef MY_ROBOT_H_
+#define MY_ROBOT_H_
+
+#include "WPILib.h"
+#include "Commands/Command.h"
+
+#include "Subsystems/DriveTrain.h"
+#include "Subsystems/Pivot.h"
+#include "Subsystems/Collector.h"
+#include "Subsystems/Shooter.h"
+#include "Subsystems/Pneumatics.h"
+#include "OI.h"
+
+class Robot: public IterativeRobot {
+public:
+ static DriveTrain* drivetrain;
+ static Pivot* pivot;
+ static Collector* collector;
+ static Shooter* shooter;
+ static Pneumatics* pneumatics;
+ static OI* oi;
+
+private:
+ Command *autonomousCommand;
+ LiveWindow *lw;
+ SendableChooser* autoChooser;
+
+ void RobotInit();
+ void AutonomousInit();
+ void AutonomousPeriodic();
+ void TeleopInit();
+ void TeleopPeriodic();
+ void TestPeriodic();
+ void DisabledInit();
+ void DisabledPeriodic();
+
+ void Log();
+};
+
+
+#endif /* ROBOT_H_ */
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.cpp
new file mode 100644
index 0000000000..5f9a346663
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.cpp
@@ -0,0 +1,43 @@
+#include "Collector.h"
+
+Collector::Collector() :
+ Subsystem("Collector")
+{
+ // Configure devices
+ rollerMotor = new Victor(1, 6);
+ ballDetector = new DigitalInput(1, 10);
+ openDetector = new DigitalInput(1, 6);
+ piston = new Solenoid(1, 1);
+
+ // Put everything to the LiveWindow for testing.
+ // XXX: LiveWindow::GetInstance()->AddActuator("Collector", "Roller Motor", (Victor) rollerMotor);
+ LiveWindow::GetInstance()->AddSensor("Collector", "Ball Detector", ballDetector);
+ LiveWindow::GetInstance()->AddSensor("Collector", "Claw Open Detector", openDetector);
+ LiveWindow::GetInstance()->AddActuator("Collector", "Piston", piston);
+}
+
+bool Collector::HasBall() {
+ return ballDetector->Get(); // TODO: prepend ! to reflect real robot
+}
+
+void Collector::SetSpeed(double speed) {
+ rollerMotor->Set(-speed);
+}
+
+void Collector::Stop() {
+ rollerMotor->Set(0);
+}
+
+bool Collector::IsOpen() {
+ return openDetector->Get(); // TODO: prepend ! to reflect real robot
+}
+
+void Collector::Open() {
+ piston->Set(true);
+}
+
+void Collector::Close() {
+ piston->Set(false);
+}
+
+void Collector::InitDefaultCommand() {}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.h
new file mode 100644
index 0000000000..b84282422b
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.h
@@ -0,0 +1,70 @@
+#ifndef Collector_H
+#define Collector_H
+
+#include "Commands/Subsystem.h"
+#include "WPILib.h"
+
+/**
+ * The Collector subsystem has one motor for the rollers, a limit switch for ball
+ * detection, a piston for opening and closing the claw, and a reed switch to
+ * check if the piston is open.
+ */
+class Collector: public Subsystem
+{
+public:
+ // Constants for some useful speeds
+ static const double FORWARD = 1;
+ static const double STOP = 0;
+ static const double REVERSE = -1;
+
+private:
+ // Subsystem devices
+ SpeedController* rollerMotor;
+ DigitalInput* ballDetector;
+ Solenoid* piston;
+ DigitalInput* openDetector;
+
+public:
+ Collector();
+
+ /**
+ * NOTE: The current simulation model uses the the lower part of the claw
+ * since the limit switch wasn't exported. At some point, this will be
+ * updated.
+ *
+ * @return Whether or not the robot has the ball.
+ */
+ bool HasBall();
+
+ /**
+ * @param speed The speed to spin the rollers.
+ */
+ void SetSpeed(double speed);
+
+ /**
+ * Stop the rollers from spinning
+ */
+ void Stop();
+
+ /**
+ * @return Whether or not the claw is open.
+ */
+ bool IsOpen();
+
+ /**
+ * Open the claw up. (For shooting)
+ */
+ void Open();
+
+ /**
+ * Close the claw. (For collecting and driving)
+ */
+ void Close();
+
+ /**
+ * No default command.
+ */
+ void InitDefaultCommand();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.cpp
new file mode 100644
index 0000000000..cbf9da094d
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.cpp
@@ -0,0 +1,85 @@
+#include "DriveTrain.h"
+#include "Commands/DriveWithJoystick.h"
+#define _USE_MATH_DEFINES
+#include
+
+DriveTrain::DriveTrain() :
+ Subsystem("DriveTrain") {
+ // Configure drive motors
+ frontLeftCIM = new Victor(1, 1);
+ frontRightCIM = new Victor(1, 2);
+ backLeftCIM = new Victor(1, 3);
+ backRightCIM = new Victor(1, 4);
+ // XXX: LiveWindow::GetInstance()->AddActuator("DriveTrain", "Front Left CIM", (Victor) frontLeftCIM);
+ // XXX: LiveWindow::GetInstance()->AddActuator("DriveTrain", "Front Right CIM", (Victor) frontRightCIM);
+ // XXX: LiveWindow::GetInstance()->AddActuator("DriveTrain", "Back Left CIM", (Victor) backLeftCIM);
+ // XXX: LiveWindow::GetInstance()->AddActuator("DriveTrain", "Back Right CIM", (Victor) backRightCIM);
+
+ // Configure the RobotDrive to reflect the fact that all our motors are
+ // wired backwards and our drivers sensitivity preferences.
+ drive = new RobotDrive(frontLeftCIM, backLeftCIM, frontRightCIM, backRightCIM);
+ drive->SetSafetyEnabled(true);
+ drive->SetExpiration(0.1);
+ drive->SetSensitivity(0.5);
+ drive->SetMaxOutput(1.0);
+ drive->SetInvertedMotor(RobotDrive::kFrontLeftMotor, true);
+ drive->SetInvertedMotor(RobotDrive::kRearLeftMotor, true);
+ drive->SetInvertedMotor(RobotDrive::kFrontRightMotor, true);
+ drive->SetInvertedMotor(RobotDrive::kRearRightMotor, true);
+
+ // Configure encoders
+ rightEncoder = new Encoder(1, 1, 1, 2, true, Encoder::k4X);
+ leftEncoder = new Encoder(2, 5, 2, 6, false, Encoder::k4X);
+ rightEncoder->SetPIDSourceParameter(PIDSource::kDistance);
+ leftEncoder->SetPIDSourceParameter(PIDSource::kDistance);
+
+ #ifdef REAL
+ // Converts to feet
+ rightEncoder->SetDistancePerPulse(0.0785398);
+ leftEncoder->SetDistancePerPulse(0.0785398);
+ #else
+ // Convert to feet 4in diameter wheels with 360 tick simulated encoders
+ rightEncoder->SetDistancePerPulse((4.0/*in*/*M_PI)/(360.0*12.0/*in/ft*/));
+ leftEncoder->SetDistancePerPulse((4.0/*in*/*M_PI)/(360.0*12.0/*in/ft*/));
+ #endif
+
+ rightEncoder->Start();
+ leftEncoder->Start();
+ LiveWindow::GetInstance()->AddSensor("DriveTrain", "Right Encoder", rightEncoder);
+ LiveWindow::GetInstance()->AddSensor("DriveTrain", "Left Encoder", leftEncoder);
+
+ // Configure gyro
+ gyro = new Gyro(1, 2);
+ #ifdef REAL
+ gyro->SetSensitivity(0.007); // TODO: Handle more gracefully?
+ #endif
+ LiveWindow::GetInstance()->AddSensor("DriveTrain", "Gyro", gyro);
+}
+
+void DriveTrain::InitDefaultCommand() {
+ SetDefaultCommand(new DriveWithJoystick());
+}
+
+void DriveTrain::TankDrive(Joystick* joy) {
+ drive->TankDrive(joy->GetY(), joy->GetRawAxis(4));
+}
+
+void DriveTrain::TankDrive(double leftAxis, double rightAxis) {
+ drive->TankDrive(leftAxis, rightAxis);
+}
+
+void DriveTrain::Stop() {
+ drive->TankDrive(0.0, 0.0);
+}
+
+Encoder* DriveTrain::GetLeftEncoder() {
+ return leftEncoder;
+}
+
+Encoder* DriveTrain::GetRightEncoder() {
+ return rightEncoder;
+}
+
+double DriveTrain::GetAngle() {
+ return gyro->GetAngle();
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.h
new file mode 100644
index 0000000000..7080c0f29b
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.h
@@ -0,0 +1,62 @@
+#ifndef DriveTrain_H
+#define DriveTrain_H
+
+#include "Commands/Subsystem.h"
+#include "WPILib.h"
+
+/**
+ * The DriveTrain subsystem controls the robot's chassis and reads in
+ * information about it's speed and position.
+ */
+class DriveTrain: public Subsystem
+{
+private:
+ // Subsystem devices
+ SpeedController *frontLeftCIM, *frontRightCIM;
+ SpeedController *backLeftCIM, *backRightCIM;
+ RobotDrive* drive;
+ Encoder *rightEncoder, *leftEncoder;
+ Gyro* gyro;
+
+public:
+ DriveTrain();
+
+ /**
+ * When other commands aren't using the drivetrain, allow tank drive with
+ * the joystick.
+ */
+ void InitDefaultCommand();
+
+ /**
+ * @param joy PS3 style joystick to use as the input for tank drive.
+ */
+ void TankDrive(Joystick* joy);
+
+ /**
+ * @param leftAxis Left sides value
+ * @param rightAxis Right sides value
+ */
+ void TankDrive(double leftAxis, double rightAxis);
+
+ /**
+ * Stop the drivetrain from moving.
+ */
+ void Stop();
+
+ /**
+ * @return The encoder getting the distance and speed of left side of the drivetrain.
+ */
+ Encoder* GetLeftEncoder();
+
+ /**
+ * @return The encoder getting the distance and speed of right side of the drivetrain.
+ */
+ Encoder* GetRightEncoder();
+
+ /**
+ * @return The current angle of the drivetrain.
+ */
+ double GetAngle();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.cpp
new file mode 100644
index 0000000000..90b39fe730
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.cpp
@@ -0,0 +1,53 @@
+#include "Pivot.h"
+
+Pivot::Pivot() :
+ PIDSubsystem("Pivot", 7.0, 0.0, 8.0)
+{
+ SetAbsoluteTolerance(0.005);
+ GetPIDController()->SetContinuous(false);
+ #ifdef SIMULATION
+ // PID is different in simulation.
+ GetPIDController()->SetPID(0.5, 0.00001, 4.5);
+ SetAbsoluteTolerance(2.5);
+ #endif
+
+ // Motor to move the pivot.
+ motor = new Victor(5);
+
+ // Sensors for measuring the position of the pivot.
+ upperLimitSwitch = new DigitalInput(13);
+ lowerLimitSwitch = new DigitalInput(12);
+
+ // 0 degrees is vertical facing up.
+ // Angle increases the more forward the pivot goes.
+ pot = new AnalogPotentiometer(1);
+
+ // Put everything to the LiveWindow for testing.
+ LiveWindow::GetInstance()->AddSensor("Pivot", "Upper Limit Switch", upperLimitSwitch);
+ LiveWindow::GetInstance()->AddSensor("Pivot", "Lower Limit Switch", lowerLimitSwitch);
+ // XXX: LiveWindow::GetInstance()->AddSensor("Pivot", "Pot", (AnalogPotentiometer) pot);
+ // XXX: LiveWindow::GetInstance()->AddActuator("Pivot", "Motor", (Victor) motor);
+ LiveWindow::GetInstance()->AddActuator("Pivot", "PIDSubsystem Controller", GetPIDController());
+}
+
+void InitDefaultCommand() {}
+
+double Pivot::ReturnPIDInput() {
+ return pot->Get();
+}
+
+void Pivot::UsePIDOutput(double output) {
+ motor->PIDWrite(output);
+}
+
+bool Pivot::IsAtUpperLimit() {
+ return upperLimitSwitch->Get(); // TODO: inverted from real robot (prefix with !)
+}
+
+bool Pivot::IsAtLowerLimit() {
+ return lowerLimitSwitch->Get(); // TODO: inverted from real robot (prefix with !)
+}
+
+double Pivot::GetAngle() {
+ return pot->Get();
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.h
new file mode 100644
index 0000000000..177cb373be
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.h
@@ -0,0 +1,61 @@
+#ifndef Pivot_H
+#define Pivot_H
+
+#include "Commands/PIDSubsystem.h"
+#include "WPILib.h"
+
+/**
+ * The Pivot subsystem contains the Van-door motor and the pot for PID control
+ * of angle of the pivot and claw.
+ */
+class Pivot: public PIDSubsystem
+{
+public:
+ // Constants for some useful angles
+ static const double COLLECT = 105;
+ static const double LOW_GOAL = 90;
+ static const double SHOOT = 45;
+ static const double SHOOT_NEAR = 30;
+
+private:
+ // Subsystem devices
+ DigitalInput* upperLimitSwitch;
+ DigitalInput* lowerLimitSwitch;
+ Potentiometer* pot;
+ SpeedController* motor;
+
+public:
+ Pivot();
+
+ /**
+ * No default command, if PID is enabled, the current setpoint will be maintained.
+ */
+ void InitDefaultCommand() {}
+
+ /**
+ * @return The angle read in by the potentiometer
+ */
+ double ReturnPIDInput();
+
+ /**
+ * Set the motor speed based off of the PID output
+ */
+ void UsePIDOutput(double output);
+
+ /**
+ * @return If the pivot is at its upper limit.
+ */
+ bool IsAtUpperLimit();
+
+ /**
+ * @return If the pivot is at its lower limit.
+ */
+ bool IsAtLowerLimit();
+
+ /**
+ * @return The current angle of the pivot.
+ */
+ double GetAngle();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.cpp
new file mode 100644
index 0000000000..fcaf9b61c6
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.cpp
@@ -0,0 +1,44 @@
+#include "Pneumatics.h"
+
+Pneumatics::Pneumatics() :
+ Subsystem("Pneumatics")
+{
+ pressureSensor = new AnalogChannel(3);
+ #ifdef REAL
+ compressor = new Compressor(uint8_t(1)); // TODO: (1, 14, 1, 8);
+ #endif
+
+ LiveWindow::GetInstance()->AddSensor("Pneumatics", "Pressure Sensor", pressureSensor);
+}
+
+/**
+ * No default command
+ */
+void Pneumatics::InitDefaultCommand() {}
+
+/**
+ * Start the compressor going. The compressor automatically starts and stops as it goes above and below maximum pressure.
+ */
+void Pneumatics::Start() {
+ #ifdef REAL
+ compressor->Start();
+ #endif
+}
+
+/**
+ * @return Whether or not the system is fully pressurized.
+ */
+bool Pneumatics::IsPressurized() {
+ #ifdef REAL
+ return MAX_PRESSURE <= pressureSensor->GetVoltage();
+ #else
+ return true; // NOTE: Simulation always has full pressure
+ #endif
+}
+
+/**
+ * Puts the pressure on the SmartDashboard.
+ */
+void Pneumatics::WritePressure() {
+ SmartDashboard::PutNumber("Pressure", pressureSensor->GetVoltage());
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.h
new file mode 100644
index 0000000000..12dc394df7
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.h
@@ -0,0 +1,46 @@
+#ifndef Pneumatics_H
+#define Pneumatics_H
+
+#include "Commands/Subsystem.h"
+#include "WPILib.h"
+
+/**
+ * The Pneumatics subsystem contains the compressor and a pressure sensor.
+ *
+ * NOTE: The simulator currently doesn't support the compressor or pressure sensors.
+ */
+class Pneumatics: public Subsystem
+{
+private:
+ AnalogChannel* pressureSensor;
+ #ifdef REAL
+ Compressor* compressor;
+ #endif
+
+ static const double MAX_PRESSURE = 2.55;
+
+public:
+ Pneumatics();
+
+ /**
+ * No default command
+ */
+ void InitDefaultCommand();
+
+ /**
+ * Start the compressor going. The compressor automatically starts and stops as it goes above and below maximum pressure.
+ */
+ void Start();
+
+ /**
+ * @return Whether or not the system is fully pressurized.
+ */
+ bool IsPressurized();
+
+ /**
+ * Puts the pressure on the SmartDashboard.
+ */
+ void WritePressure();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.cpp
new file mode 100644
index 0000000000..2db03fe897
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.cpp
@@ -0,0 +1,88 @@
+#include "Shooter.h"
+
+Shooter::Shooter() :
+ Subsystem("Shooter")
+{
+ // Configure Devices
+ hotGoalSensor = new DigitalInput(1, 3);
+ piston1 = new DoubleSolenoid(1, 3, 4);
+ piston2 = new DoubleSolenoid(1, 5, 6);
+ latchPiston = new Solenoid(1, 2);
+ piston1ReedSwitchFront = new DigitalInput(1, 9);
+ piston1ReedSwitchBack = new DigitalInput(1, 11);
+
+ // Put everything to the LiveWindow for testing.
+ LiveWindow::GetInstance()->AddSensor("Shooter", "Hot Goal Sensor", hotGoalSensor);
+ LiveWindow::GetInstance()->AddSensor("Shooter", "Piston1 Reed Switch Front ", piston1ReedSwitchFront);
+ LiveWindow::GetInstance()->AddSensor("Shooter", "Piston1 Reed Switch Back ", piston1ReedSwitchBack);
+ LiveWindow::GetInstance()->AddActuator("Shooter", "Latch Piston", latchPiston);
+}
+
+void Shooter::InitDefaultCommand()
+{
+ // Set the default command for a subsystem here.
+ //SetDefaultCommand(new MySpecialCommand());
+}
+
+void Shooter::ExtendBoth() {
+ piston1->Set(DoubleSolenoid::kForward);
+ piston2->Set(DoubleSolenoid::kForward);
+}
+
+void Shooter::RetractBoth() {
+ piston1->Set(DoubleSolenoid::kReverse);
+ piston2->Set(DoubleSolenoid::kReverse);
+}
+
+void Shooter::Extend1() {
+ piston1->Set(DoubleSolenoid::kForward);
+}
+
+void Shooter::Retract1() {
+ piston1->Set(DoubleSolenoid::kReverse);
+}
+
+void Shooter::Extend2() {
+ piston2->Set(DoubleSolenoid::kReverse);
+}
+
+void Shooter::Retract2() {
+ piston2->Set(DoubleSolenoid::kForward);
+}
+
+void Shooter::Off1() {
+ piston1->Set(DoubleSolenoid::kOff);
+}
+
+void Shooter::Off2() {
+ piston2->Set(DoubleSolenoid::kOff);
+}
+
+void Shooter::Unlatch() {
+ latchPiston->Set(true);
+}
+
+void Shooter::Latch() {
+ latchPiston->Set(false);
+}
+
+void Shooter::ToggleLatchPosition() {
+ latchPiston->Set(!latchPiston->Get());
+}
+
+bool Shooter::Piston1IsExtended() {
+ return !piston1ReedSwitchFront->Get();
+}
+
+bool Shooter::Piston1IsRetracted() {
+ return !piston1ReedSwitchBack->Get();
+}
+
+void Shooter::OffBoth() {
+ piston1->Set(DoubleSolenoid::kOff);
+ piston2->Set(DoubleSolenoid::kOff);
+}
+
+bool Shooter::GoalIsHot() {
+ return hotGoalSensor->Get();
+}
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.h
new file mode 100644
index 0000000000..7f3063c1d9
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.h
@@ -0,0 +1,117 @@
+#ifndef Shooter_H
+#define Shooter_H
+
+#include "Commands/Subsystem.h"
+#include "WPILib.h"
+
+/**
+ * The Shooter subsystem handles shooting. The mechanism for shooting is
+ * slightly complicated because it has to pneumatic cylinders for shooting, and
+ * a third latch to allow the pressure to partially build up and reduce the
+ * effect of the airflow. For shorter shots, when full power isn't needed, only
+ * one cylinder fires.
+ *
+ * NOTE: Simulation currently approximates this as as single pneumatic cylinder
+ * and ignores the latch.
+ */
+class Shooter: public Subsystem
+{
+private:
+ // Devices
+ DoubleSolenoid* piston1;
+ DoubleSolenoid* piston2;
+ Solenoid* latchPiston;
+ DigitalInput* piston1ReedSwitchFront;
+ DigitalInput* piston1ReedSwitchBack;
+ DigitalInput* hotGoalSensor; // NOTE: Currently ignored in simulation
+
+public:
+ Shooter();
+ void InitDefaultCommand();
+
+ /**
+ * Extend both solenoids to shoot.
+ */
+ void ExtendBoth();
+
+ /**
+ * Retract both solenoids to prepare to shoot.
+ */
+ void RetractBoth();
+
+ /**
+ * Extend solenoid 1 to shoot.
+ */
+ void Extend1();
+
+
+ /**
+ * Retract solenoid 1 to prepare to shoot.
+ */
+ void Retract1();
+
+ /**
+ * Extend solenoid 2 to shoot.
+ */
+ void Extend2();
+
+ /**
+ * Retract solenoid 2 to prepare to shoot.
+ */
+ void Retract2();
+
+ /**
+ * Turns off the piston1 double solenoid. This won't actuate anything
+ * because double solenoids preserve their state when turned off. This
+ * should be called in order to reduce the amount of time that the coils are
+ * powered.
+ */
+ void Off1();
+
+ /**
+ * Turns off the piston1 double solenoid. This won't actuate anything
+ * because double solenoids preserve their state when turned off. This
+ * should be called in order to reduce the amount of time that the coils are
+ * powered.
+ */
+ void Off2();
+
+ /**
+ * Release the latch so that we can shoot
+ */
+ void Unlatch();
+
+ /**
+ * Latch so that pressure can build up and we aren't limited by air flow.
+ */
+ void Latch();
+
+ /**
+ * Toggles the latch postions
+ */
+ void ToggleLatchPosition();
+
+ /**
+ * @return Whether or not piston 1 is fully extended.
+ */
+ bool Piston1IsExtended();
+
+ /**
+ * @return Whether or not piston 1 is fully retracted.
+ */
+ bool Piston1IsRetracted();
+
+ /**
+ * Turns off all double solenoids. Double solenoids hold their position when
+ * they are turned off. We should turn them off whenever possible to extend
+ * the life of the coils
+ */
+ void OffBoth();
+
+ /**
+ * @return Whether or not the goal is hot as read by the banner sensor
+ */
+ bool GoalIsHot();
+};
+
+#endif
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.cpp
new file mode 100644
index 0000000000..a07d2f0b6b
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.cpp
@@ -0,0 +1,19 @@
+/*
+ * DoubleButton.cpp
+ *
+ * Created on: Jun 24, 2014
+ * Author: alex
+ */
+
+#include "DoubleButton.h"
+
+DoubleButton::DoubleButton(Joystick* joy, int button1, int button2) {
+ this->joy = joy;
+ this->button1 = button1;
+ this->button2 = button2;
+}
+
+bool DoubleButton::Get() {
+ return joy->GetRawButton(button1) && joy->GetRawButton(button2);
+}
+
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.h
new file mode 100644
index 0000000000..91ff2eb85a
--- /dev/null
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.h
@@ -0,0 +1,24 @@
+/*
+ * DoubleButton.h
+ *
+ * Created on: Jun 24, 2014
+ * Author: alex
+ */
+
+#ifndef DOUBLEBUTTON_H_
+#define DOUBLEBUTTON_H_
+
+#include "WPILib.h"
+
+class DoubleButton : public Trigger {
+private:
+ Joystick* joy;
+ int button1, button2;
+
+public:
+ DoubleButton(Joystick* joy, int button1, int button2);
+
+ bool Get();
+};
+
+#endif /* DOUBLEBUTTON_H_ */
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/examples.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/examples.xml
index 3fffe38ae3..e5b8fc1687 100644
--- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/examples.xml
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/examples.xml
@@ -137,6 +137,110 @@
destination="src/Subsystems/Wrist.h">
-
+
+ PacGoat
+ A fully functional example CommandBased program for FRC Team 190's 2014 robot. This code can run on your computer if it supports simulation.
+
+ CommandBased Robot
+ Simulation
+ 2014 Season
+
+
+ src
+ src/Commands
+ src/Subsystems
+ src/Triggers
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/CloseClaw.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/CloseClaw.java
index 80219e7c14..25529ec2cc 100644
--- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/CloseClaw.java
+++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/CloseClaw.java
@@ -7,7 +7,7 @@ import edu.wpi.first.wpilibj.command.Command;
/**
* Close the claw.
*
- * NOTE: It doesn't wait for the claw to close since their is no sensor to
+ * NOTE: It doesn't wait for the claw to close since there is no sensor to
* detect that.
*/
public class CloseClaw extends Command {