From d5c73c95dca32bf001288fdf8dac6873a92b2b04 Mon Sep 17 00:00:00 2001 From: Thomas Clark Date: Tue, 12 Aug 2014 14:52:22 -0400 Subject: [PATCH] Fix the example programs Remove the test examples that don't do anything helpful Fix the PacGoat and GearsBot examples to compile Change-Id: Ic11ca7a97a5b52524fe60dc24fcec6ecfae7ebb7 --- .../GearsBot/src/Subsystems/DriveTrain.cpp | 3 -- .../GearsBot/src/Subsystems/DriveTrain.h | 1 - .../examples/Network Table Counter/Robot.cpp | 24 --------- .../PacGoat/src/Commands/CheckForHotGoal.h | 2 +- .../src/Commands/DriveAndShootAutonomous.cpp | 1 + .../PacGoat/src/Subsystems/DriveTrain.cpp | 2 - .../examples/Simple Robot Example/Robot.java | 17 ------ .../resources/templates/examples/examples.xml | 47 +++------------- .../examples/Network Table Counter/Robot.java | 39 -------------- .../examples/Simple Robot Example/Robot.java | 17 ------ .../resources/templates/examples/examples.xml | 53 ++++--------------- 11 files changed, 17 insertions(+), 189 deletions(-) delete mode 100644 eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Network Table Counter/Robot.cpp delete mode 100644 eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Simple Robot Example/Robot.java delete mode 100644 eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Network Table Counter/Robot.java delete mode 100644 eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Simple Robot Example/Robot.java diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.cpp index 635308b72a..ce6254c47a 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.cpp @@ -26,9 +26,6 @@ DriveTrain::DriveTrain() : Subsystem("DriveTrain") { right_encoder->SetDistancePerPulse((double) (4.0/12.0*M_PI) / 360.0); #endif - left_encoder->Start(); - right_encoder->Start(); - rangefinder = new AnalogInput(6); gyro = new Gyro(1); diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.h index 1467471646..19aae19138 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.h +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.h @@ -1,7 +1,6 @@ #ifndef DriveTrain_H #define DriveTrain_H -#include "Commands/Subsystem.h" #include "WPILib.h" /** diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Network Table Counter/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Network Table Counter/Robot.cpp deleted file mode 100644 index 41a0274a84..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Network Table Counter/Robot.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -using namespace std; - -// This is a simple robot program -int main() -{ - NetworkTable::SetServerMode(); - NetworkTable::SetTeam(190); - NetworkTable* table = NetworkTable::GetTable("SmartDashboard"); - cout << "Started up" << endl; - - long i = 0; - while (true) - { - cout << i << endl; - table->PutNumber("i", i); - i++; - - sleep(1); - } - - return 0; -} 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 index 8fbbe08162..d069045d44 100644 --- 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 @@ -9,7 +9,7 @@ * 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 { +class CheckForHotGoal : public Command { public: CheckForHotGoal(double time); void Initialize(); 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 index 01ce83c1cd..5148bbc9b3 100644 --- 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 @@ -6,6 +6,7 @@ #include "Commands/SetPivotSetpoint.h" #include "Commands/DriveForward.h" #include "Commands/Shoot.h" +#include "Commands/CheckForHotGoal.h" DriveAndShootAutonomous::DriveAndShootAutonomous() { AddSequential(new CloseClaw()); 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 index 36ce60afb3..5c8f092b24 100644 --- 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 @@ -43,8 +43,6 @@ DriveTrain::DriveTrain() : 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); diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Simple Robot Example/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Simple Robot Example/Robot.java deleted file mode 100644 index 045087fe16..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Simple Robot Example/Robot.java +++ /dev/null @@ -1,17 +0,0 @@ -package $package; - -/** - * Simplest possible robot program - * - * @author Team $team-number - */ -public class Robot { - - /** - * @param args Input.... - */ - public static void main(String[] args) { - // Do stuff here! - } - -} 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 e5b8fc1687..e373c1f9e4 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 @@ -1,5 +1,6 @@ + CommandBased Robot Examples for CommandBased robot programs. - - Simulation - Examples that can be run in simulation. - - - - Simple Robot Example - The simplest possible program that compiles. This - shows the structure of a simple program that does nothing at - all. - - Simple Robot - - - src - - - - - - - - Network Table Counter - A simple program that increments a network table - variable once every second. This shows the structure of a simple - program that only uses network tables. - - Simple Robot - Network Tables - - - src - - - - - GearsBot @@ -59,7 +27,6 @@ supports simulation. CommandBased Robot - Simulation src @@ -137,14 +104,12 @@ 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 diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Network Table Counter/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Network Table Counter/Robot.java deleted file mode 100644 index edf5564b26..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Network Table Counter/Robot.java +++ /dev/null @@ -1,39 +0,0 @@ -package $package; - -import edu.wpi.first.wpilibj.networktables.NetworkTable; - -/** - * An example of a network table counter. - * - * @author Team $team-number - */ -public class Robot { - - private static NetworkTable table; - - /** - * @param args - */ - public static void main(String[] args) { - NetworkTable.setServerMode(); - NetworkTable.setTeam(190); - table = NetworkTable.getTable("SmartDashboard"); - System.out.println("Started up"); - - long i = 0; - while (true) { - System.out.println(i); - table.putNumber("i", i); - i++; - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Simple Robot Example/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Simple Robot Example/Robot.java deleted file mode 100644 index 045087fe16..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Simple Robot Example/Robot.java +++ /dev/null @@ -1,17 +0,0 @@ -package $package; - -/** - * Simplest possible robot program - * - * @author Team $team-number - */ -public class Robot { - - /** - * @param args Input.... - */ - public static void main(String[] args) { - // Do stuff here! - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/examples.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/examples.xml index e8577ee373..9e432d1b08 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/examples.xml +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/examples.xml @@ -1,63 +1,30 @@ + + + CommandBased Robot + Examples for CommandBased robot programs. + GearsBot A fully functional example CommandBased program for WPIs GearsBot robot. This code can run on your computer if it supports simulation. CommandBased Robot - Simulation src/$package-dir @@ -90,8 +57,6 @@ 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/$package-dir