diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/TankDrive/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/TankDrive/src/org/usfirst/frc/team190/robot/Robot.java new file mode 100755 index 0000000000..ed082207ae --- /dev/null +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/TankDrive/src/org/usfirst/frc/team190/robot/Robot.java @@ -0,0 +1,46 @@ +package $package; + + +import edu.wpi.first.wpilibj.SampleRobot; +import edu.wpi.first.wpilibj.RobotDrive; +import edu.wpi.first.wpilibj.Joystick; +import edu.wpi.first.wpilibj.Timer; + +/** + * This is a demo program showing the use of the RobotDrive class, specifically it + * contains the code necessary to operate a robot with tank drive. + * + * The VM is configured to automatically run this class, and to call the + * functions corresponding to each mode, as described in the SampleRobot + * documentation. If you change the name of this class or the package after + * creating this project, you must also update the manifest file in the resource + * directory. + * + * WARNING: While it may look like a good choice to use for your code if you're inexperienced, + * don't. Unless you know what you are doing, complex code will be much more difficult under + * this system. Use IterativeRobot or Command-Based instead if you're new. + */ +public class Robot extends SampleRobot { + RobotDrive myRobot; // class that handles basic drive operations + Joystick leftStick; // set to ID 1 in DriverStation + Joystick rightStick; // set to ID 2 in DriverStation + public Robot() { + myRobot = new RobotDrive(0, 1); + myRobot.setExpiration(0.1); + leftStick = new Joystick(1); + rightStick = new Joystick(2); + } + + + /** + * Runs the motors with tank steering. + */ + public void operatorControl() { + myRobot.setSafetyEnabled(true); + while (isOperatorControl()) { + myRobot.tankDrive(leftStick, rightStick); + Timer.delay(0.005); // wait for a motor update time + } + } + +} 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 old mode 100644 new mode 100755 index c8ebc7a77b..e85e2396b3 --- 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 @@ -19,6 +19,8 @@ Getting Started with Java Examples for getting started with FRC Java + + Getting Started An example program which demonstrates the simplest autonomous and @@ -34,6 +36,22 @@ destination="src/$package-dir/Robot.java"> + + + Tank Drive + Demonstrate the use of the RobotDrive class doing teleop driving with tank steering + + Getting Started with Java + + + src/$package-dir + + + + + + CommandBased Robot Examples for CommandBased robot programs.