mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Merge "[artf3717] Added isEnabled to Teleop Loops in Samples."
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user