From 767686ae2e8f2e484597dfc6b6c4c8ee9a2fe2eb Mon Sep 17 00:00:00 2001 From: James Kuszmaul Date: Mon, 27 Oct 2014 15:52:37 -0400 Subject: [PATCH] [artf3717] Added isEnabled to Teleop Loops in Samples. Anywhere in the sample programs where there was just a isOperatorControl() in the while loop for Teleop, added an "&& isEnabled()". Change-Id: Ib81e8bab79923e262c314a073a591855cbf06846 --- .../resources/templates/examples/ArcadeDrive/src/Robot.cpp | 2 +- .../resources/templates/examples/CANPDP/src/Robot.cpp | 2 +- .../resources/templates/examples/Encoder/src/Robot.cpp | 2 +- .../resources/templates/examples/MecanumDrive/src/Robot.cpp | 2 +- .../resources/templates/examples/MotorControl/src/Robot.cpp | 2 +- .../templates/examples/MotorControlEncoder/src/Robot.cpp | 2 +- .../resources/templates/examples/Relay/src/Robot.cpp | 2 +- .../resources/templates/examples/Solenoid/src/Robot.cpp | 2 +- .../resources/templates/sample/Robot.cpp | 2 +- .../MecanumDrive/src/org/usfirst/frc/team190/robot/Robot.java | 2 +- .../MotorControl/src/org/usfirst/frc/team190/robot/Robot.java | 2 +- .../TankDrive/src/org/usfirst/frc/team190/robot/Robot.java | 2 +- .../resources/templates/sample/Robot.java | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/ArcadeDrive/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/ArcadeDrive/src/Robot.cpp index 823e33553d..1ac2827868 100755 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/ArcadeDrive/src/Robot.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/ArcadeDrive/src/Robot.cpp @@ -28,7 +28,7 @@ public: */ void OperatorControl() { - while (IsOperatorControl()) + while (IsOperatorControl() && IsEnabled()) { myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick) Wait(0.005); // wait for a motor update time diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANPDP/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANPDP/src/Robot.cpp index 2e66765e67..2477ff3cda 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANPDP/src/Robot.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANPDP/src/Robot.cpp @@ -27,7 +27,7 @@ public: */ void OperatorControl() { - while (IsOperatorControl()) + while (IsOperatorControl() && IsEnabled()) { // Get the current going through channel 7, in Amperes. // The PDP returns the current in increments of 0.125A. diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Encoder/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Encoder/src/Robot.cpp index e0fd3020a1..27f3ef86f6 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Encoder/src/Robot.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Encoder/src/Robot.cpp @@ -66,7 +66,7 @@ public: */ void OperatorControl() { - while (IsOperatorControl()) + while (IsOperatorControl() && IsEnabled()) { // Retrieve the net displacement of the Encoder since the lsat Reset. SmartDashboard::PutNumber("Encoder Distance", m_encoder.GetDistance()); diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MecanumDrive/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MecanumDrive/src/Robot.cpp index c1f9d8a8ff..aa3522062b 100755 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MecanumDrive/src/Robot.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MecanumDrive/src/Robot.cpp @@ -34,7 +34,7 @@ public: void OperatorControl() { robotDrive.SetSafetyEnabled(false); - while (IsOperatorControl()) + while (IsOperatorControl() && IsEnabled()) { // Use the joystick X axis for lateral movement, Y axis for forward movement, and Z axis for rotation. // This sample does not use field-oriented drive, so the gyro input is set to zero. diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControl/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControl/src/Robot.cpp index 2ae77b0205..567e71faa6 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControl/src/Robot.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControl/src/Robot.cpp @@ -31,7 +31,7 @@ public: * Runs the motor from the output of a Joystick. */ void OperatorControl() { - while (IsOperatorControl()) { + while (IsOperatorControl() && IsEnabled()) { // Set the motor controller's output. // This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards). m_motor.Set(m_stick.GetY()); diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControlEncoder/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControlEncoder/src/Robot.cpp index dce8fc4239..e9f0751837 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControlEncoder/src/Robot.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControlEncoder/src/Robot.cpp @@ -39,7 +39,7 @@ public: * Simultaneously displays encoder values on the SmartDashboard. */ void OperatorControl() { - while (IsOperatorControl()) { + while (IsOperatorControl() && IsEnabled()) { // Set the motor controller's output. // This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards). m_motor.Set(m_stick.GetY()); diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Relay/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Relay/src/Robot.cpp index c7c83ed795..8d199b2dc2 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Relay/src/Robot.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Relay/src/Robot.cpp @@ -39,7 +39,7 @@ public: */ void OperatorControl() { - while (IsOperatorControl()) + while (IsOperatorControl() && IsEnabled()) { // Retrieve the button values. GetRawButton will return // true if the button is pressed and false if not. diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Solenoid/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Solenoid/src/Robot.cpp index c8f91e7406..54e28d11b5 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Solenoid/src/Robot.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Solenoid/src/Robot.cpp @@ -51,7 +51,7 @@ public: */ void OperatorControl() { - while (IsOperatorControl()) + while (IsOperatorControl() && IsEnabled()) { // The output of GetRawButton is true/false depending on whether // the button is pressed; Set takes a boolean for for whether to diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/sample/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/sample/Robot.cpp index eb19704735..627f7f6ba6 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/sample/Robot.cpp +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/sample/Robot.cpp @@ -40,7 +40,7 @@ public: void OperatorControl() { myRobot.SetSafetyEnabled(true); - while (IsOperatorControl()) + while (IsOperatorControl() && IsEnabled()) { myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick) Wait(0.005); // wait for a motor update time diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MecanumDrive/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MecanumDrive/src/org/usfirst/frc/team190/robot/Robot.java index c4834bfcc2..4c82203076 100755 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MecanumDrive/src/org/usfirst/frc/team190/robot/Robot.java +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MecanumDrive/src/org/usfirst/frc/team190/robot/Robot.java @@ -39,7 +39,7 @@ public class Robot extends SampleRobot { */ public void operatorControl() { robotDrive.setSafetyEnabled(true); - while (isOperatorControl()) { + while (isOperatorControl() && isEnabled()) { // Use the joystick X axis for lateral movement, Y axis for forward movement, and Z axis for rotation. // This sample does not use field-oriented drive, so the gyro input is set to zero. diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MotorControl/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MotorControl/src/org/usfirst/frc/team190/robot/Robot.java index 7b1bb3da4c..3afd18751d 100755 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MotorControl/src/org/usfirst/frc/team190/robot/Robot.java +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MotorControl/src/org/usfirst/frc/team190/robot/Robot.java @@ -32,7 +32,7 @@ public class Robot extends SampleRobot { * Runs the motor from a joystick. */ public void operatorControl() { - while (isOperatorControl()) { + while (isOperatorControl() && isEnabled()) { // Set the motor's output. // This takes a number from -1 (100% speed in reverse) to +1 (100% speed going forward) motor.set(stick.getY()); 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 index 3f47e7e830..3af139b29f 100755 --- 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 @@ -37,7 +37,7 @@ public class Robot extends SampleRobot { */ public void operatorControl() { myRobot.setSafetyEnabled(true); - while (isOperatorControl()) { + while (isOperatorControl() && isEnabled()) { 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/sample/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/sample/Robot.java index 56da2a82af..9bed59e805 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/sample/Robot.java +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/sample/Robot.java @@ -48,7 +48,7 @@ public class Robot extends SampleRobot { */ public void operatorControl() { myRobot.setSafetyEnabled(true); - while (isOperatorControl()) { + while (isOperatorControl() && isEnabled()) { myRobot.arcadeDrive(stick); // drive with arcade style (use right stick) Timer.delay(0.005); // wait for a motor update time }