Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Commit 3da211e

Browse files
committed
Updated op modes to work with new 2.x FTC SDK software.
1 parent 07cfe41 commit 3da211e

16 files changed

+103
-47
lines changed

opModes/PushBotAuto.java

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
package com.qualcomm.ftcrobotcontroller.opmodes;
1+
package org.firstinspires.ftc.teamcode;
22

33
//------------------------------------------------------------------------------
44
//
55
// PushBotAuto
66
//
7+
78
/**
89
* Provide a basic autonomous operational mode that uses the left and right
910
* drive motors and associated encoders implemented using a state machine for
1011
* the Push Bot.
1112
*
1213
* @author SSI Robotics
13-
* @version 2015-08-01-06-01
14+
* @version 2016-09-05-06-01
1415
*/
1516
public class PushBotAuto extends PushBotTelemetry
1617

opModes/PushBotAutoSensors.java

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
package com.qualcomm.ftcrobotcontroller.opmodes;
1+
package org.firstinspires.ftc.teamcode;
22

33
//------------------------------------------------------------------------------
44
//
55
// PushBotAutoSensors
66
//
7+
78
/**
89
* Provide a basic autonomous operational mode that uses the left and right
910
* drive motors and associated encoders, the left arm motor and associated touch
1011
* sensor, IR seeker V3 and optical distance sensor implemented using a state
1112
* machine for the Push Bot.
1213
*
1314
* @author SSI Robotics
14-
* @version 2015-08-13-19-48
15+
* @version 2016-09-05-19-48
1516
*/
1617
public class PushBotAutoSensors extends PushBotTelemetrySensors
1718

opModes/PushBotDriveTouch.java

100644100755
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
package com.qualcomm.ftcrobotcontroller.opmodes;
1+
package org.firstinspires.ftc.teamcode;
22

33
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
4+
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
45
import com.qualcomm.robotcore.hardware.DcMotor;
56
import com.qualcomm.robotcore.hardware.TouchSensor;
67

@@ -10,6 +11,9 @@
1011
* will run its motors unless a touch sensor
1112
* is pressed.
1213
*/
14+
@TeleOp(name = "PushBotDriveTouch", group = "pushbot")
15+
//@Disabled
16+
// comment out the above line if you want this op mode to be enabled.
1317
public class PushBotDriveTouch extends LinearOpMode {
1418
DcMotor leftMotor;
1519
DcMotor rightMotor;
@@ -42,9 +46,10 @@ public void runOpMode() throws InterruptedException {
4246
}
4347

4448
telemetry.addData("isPressed", String.valueOf(touchSensor.isPressed()));
49+
telemetry.update();
50+
51+
idle();
4552

46-
// Wait for a hardware cycle to allow other processes to run
47-
waitOneFullHardwareCycle();
4853
}
4954

5055
}

opModes/PushBotHardware.java

100644100755
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
package com.qualcomm.ftcrobotcontroller.opmodes;
1+
package org.firstinspires.ftc.teamcode;
22

33
import com.qualcomm.ftccommon.DbgLog;
44
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
55
import com.qualcomm.robotcore.hardware.DcMotor;
6-
import com.qualcomm.robotcore.hardware.DcMotorController;
76
import com.qualcomm.robotcore.hardware.Servo;
87
import com.qualcomm.robotcore.util.Range;
98

@@ -20,7 +19,7 @@
2019
* calls to methods will fail, but will not cause the application to crash.
2120
*
2221
* @author SSI Robotics
23-
* @version 2015-08-13-20-04
22+
* @version 2016-09-05-20-04
2423
*/
2524
public class PushBotHardware extends OpMode
2625

@@ -391,7 +390,7 @@ public void run_using_left_drive_encoder ()
391390
if (v_motor_left_drive != null)
392391
{
393392
v_motor_left_drive.setMode
394-
( DcMotorController.RunMode.RUN_USING_ENCODERS
393+
( DcMotor.RunMode.RUN_USING_ENCODER
395394
);
396395
}
397396

@@ -410,7 +409,7 @@ public void run_using_right_drive_encoder ()
410409
if (v_motor_right_drive != null)
411410
{
412411
v_motor_right_drive.setMode
413-
( DcMotorController.RunMode.RUN_USING_ENCODERS
412+
( DcMotor.RunMode.RUN_USING_ENCODER
414413
);
415414
}
416415

@@ -447,10 +446,10 @@ public void run_without_left_drive_encoder ()
447446
if (v_motor_left_drive != null)
448447
{
449448
if (v_motor_left_drive.getMode () ==
450-
DcMotorController.RunMode.RESET_ENCODERS)
449+
DcMotor.RunMode.STOP_AND_RESET_ENCODER)
451450
{
452451
v_motor_left_drive.setMode
453-
( DcMotorController.RunMode.RUN_WITHOUT_ENCODERS
452+
( DcMotor.RunMode.RUN_WITHOUT_ENCODER
454453
);
455454
}
456455
}
@@ -470,10 +469,10 @@ public void run_without_right_drive_encoder ()
470469
if (v_motor_right_drive != null)
471470
{
472471
if (v_motor_right_drive.getMode () ==
473-
DcMotorController.RunMode.RESET_ENCODERS)
472+
DcMotor.RunMode.STOP_AND_RESET_ENCODER)
474473
{
475474
v_motor_right_drive.setMode
476-
( DcMotorController.RunMode.RUN_WITHOUT_ENCODERS
475+
( DcMotor.RunMode.RUN_WITHOUT_ENCODER
477476
);
478477
}
479478
}
@@ -511,7 +510,7 @@ public void reset_left_drive_encoder ()
511510
if (v_motor_left_drive != null)
512511
{
513512
v_motor_left_drive.setMode
514-
( DcMotorController.RunMode.RESET_ENCODERS
513+
( DcMotor.RunMode.STOP_AND_RESET_ENCODER
515514
);
516515
}
517516

@@ -530,7 +529,7 @@ public void reset_right_drive_encoder ()
530529
if (v_motor_right_drive != null)
531530
{
532531
v_motor_right_drive.setMode
533-
( DcMotorController.RunMode.RESET_ENCODERS
532+
( DcMotor.RunMode.STOP_AND_RESET_ENCODER
534533
);
535534
}
536535

opModes/PushBotHardwareSensors.java

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.qualcomm.ftcrobotcontroller.opmodes;
1+
package org.firstinspires.ftc.teamcode;
22

33
import com.qualcomm.ftccommon.DbgLog;
44
import com.qualcomm.robotcore.hardware.IrSeekerSensor;
@@ -20,7 +20,7 @@
2020
* calls to methods will fail, but will not cause the application to crash.
2121
*
2222
* @author SSI Robotics
23-
* @version 2015-08-13-20-04
23+
* @version 2016-09-05-20-04
2424
*/
2525
public class PushBotHardwareSensors extends PushBotTelemetry
2626

opModes/PushBotIrEvent.java

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.qualcomm.ftcrobotcontroller.opmodes;
1+
package org.firstinspires.ftc.teamcode;
22

33
//------------------------------------------------------------------------------
44
//
@@ -9,7 +9,7 @@
99
* IR seeker implemented using a state machine for the Push Bot.
1010
*
1111
* @author SSI Robotics
12-
* @version 2015-08-16-08-41
12+
* @version 2016-09-05-08-41
1313
*/
1414
public class PushBotIrEvent extends PushBotTelemetrySensors
1515

opModes/PushBotIrSeek.java

100644100755
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
package com.qualcomm.ftcrobotcontroller.opmodes;
2-
3-
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
1+
package org.firstinspires.ftc.teamcode;
42

53
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
4+
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
65
import com.qualcomm.robotcore.hardware.DcMotor;
76
import com.qualcomm.robotcore.hardware.IrSeekerSensor;
87
import com.qualcomm.robotcore.util.Range;
@@ -12,12 +11,16 @@
1211
* An example linear op mode where the pushbot
1312
* will track an IR beacon.
1413
*/
14+
@TeleOp(name = "PushBotIrSeek", group = "pushbot")
15+
//@Disabled
16+
// comment out the above line if you want this op mode to be enabled.
1517
public class PushBotIrSeek extends LinearOpMode {
1618
final static double kBaseSpeed = 0.15; // Higher values will cause the robot to move faster
1719

1820
final static double kMinimumStrength = 0.08; // Higher values will cause the robot to follow closer
1921
final static double kMaximumStrength = 0.60; // Lower values will cause the robot to stop sooner
2022

23+
//IrSeekerSensor irSeeker;
2124
IrSeekerSensor irSeeker;
2225
DcMotor leftMotor;
2326
DcMotor rightMotor;
@@ -48,8 +51,9 @@ public void runOpMode() throws InterruptedException {
4851
telemetry.addData("Seeker", irSeeker.toString());
4952
telemetry.addData("Speed", " Left=" + leftMotor.getPower() + " Right=" + rightMotor.getPower());
5053

51-
//Wait one hardware cycle to avoid taxing the processor
52-
waitOneFullHardwareCycle();
54+
telemetry.update();
55+
56+
idle();
5357
}
5458

5559
}

opModes/PushBotManual.java

100644100755
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
package com.qualcomm.ftcrobotcontroller.opmodes;
1+
package org.firstinspires.ftc.teamcode;
22

33
//------------------------------------------------------------------------------
44
//
55
// PushBotManual
66
//
7+
8+
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
9+
710
/**
811
* Provide a basic manual operational mode that uses the left and right
912
* drive motors, left arm motor, servo motors and gamepad input from two
@@ -12,6 +15,9 @@
1215
* @author SSI Robotics
1316
* @version 2015-08-01-06-01
1417
*/
18+
@TeleOp(name="PushBotManual", group = "pushbot")
19+
//@Disabled
20+
// comment out the above line if you want this op mode to be enabled.
1521
public class PushBotManual extends PushBotTelemetry
1622

1723
{

opModes/PushBotManual1.java

100644100755
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
package com.qualcomm.ftcrobotcontroller.opmodes;
1+
package org.firstinspires.ftc.teamcode;
22

33
//------------------------------------------------------------------------------
44
//
55
// PushBotManual
66
//
7+
8+
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
9+
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
10+
711
/**
812
* Provide a basic manual operational mode that uses the left and right
913
* drive motors, left arm motor, servo motors and gamepad input from only one
@@ -12,6 +16,8 @@
1216
* @author SSI Robotics
1317
* @version 2015-09-05-20-12
1418
*/
19+
@TeleOp(name="PushBotManual", group = "pushbot")
20+
@Disabled
1521
public class PushBotManual1 extends PushBotTelemetry
1622

1723
{

opModes/PushBotManualSensors.java

100644100755
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
package com.qualcomm.ftcrobotcontroller.opmodes;
1+
package org.firstinspires.ftc.teamcode;
22

33
//------------------------------------------------------------------------------
44
//
55
// PushBotManualSensors
66
//
7+
8+
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
9+
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
10+
711
/**
812
* Provide a basic manual operational mode that uses the left and right
913
* drive motors, left arm motor, servo motors and gamepad input from two
@@ -14,6 +18,9 @@
1418
* @author SSI Robotics
1519
* @version 2015-08-25-14-40
1620
*/
21+
@TeleOp(name = "PushBotManualSensors", group = "pushbot")
22+
@Disabled
23+
// comment out the above line if you want this op mode to be enabled.
1724
public class PushBotManualSensors extends PushBotTelemetrySensors
1825

1926
{

0 commit comments

Comments
 (0)