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

Commit

Permalink
Updated op modes to work with new 2.x FTC SDK software.
Browse files Browse the repository at this point in the history
  • Loading branch information
ftctechnh committed Sep 8, 2016
1 parent 07cfe41 commit 3da211e
Show file tree
Hide file tree
Showing 16 changed files with 103 additions and 47 deletions.
5 changes: 3 additions & 2 deletions opModes/PushBotAuto.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

//------------------------------------------------------------------------------
//
// PushBotAuto
//

/**
* Provide a basic autonomous operational mode that uses the left and right
* drive motors and associated encoders implemented using a state machine for
* the Push Bot.
*
* @author SSI Robotics
* @version 2015-08-01-06-01
* @version 2016-09-05-06-01
*/
public class PushBotAuto extends PushBotTelemetry

Expand Down
5 changes: 3 additions & 2 deletions opModes/PushBotAutoSensors.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

//------------------------------------------------------------------------------
//
// PushBotAutoSensors
//

/**
* Provide a basic autonomous operational mode that uses the left and right
* drive motors and associated encoders, the left arm motor and associated touch
* sensor, IR seeker V3 and optical distance sensor implemented using a state
* machine for the Push Bot.
*
* @author SSI Robotics
* @version 2015-08-13-19-48
* @version 2016-09-05-19-48
*/
public class PushBotAutoSensors extends PushBotTelemetrySensors

Expand Down
11 changes: 8 additions & 3 deletions opModes/PushBotDriveTouch.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.TouchSensor;

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

telemetry.addData("isPressed", String.valueOf(touchSensor.isPressed()));
telemetry.update();

idle();

// Wait for a hardware cycle to allow other processes to run
waitOneFullHardwareCycle();
}

}
Expand Down
21 changes: 10 additions & 11 deletions opModes/PushBotHardware.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

import com.qualcomm.ftccommon.DbgLog;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorController;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.Range;

Expand All @@ -20,7 +19,7 @@
* calls to methods will fail, but will not cause the application to crash.
*
* @author SSI Robotics
* @version 2015-08-13-20-04
* @version 2016-09-05-20-04
*/
public class PushBotHardware extends OpMode

Expand Down Expand Up @@ -391,7 +390,7 @@ public void run_using_left_drive_encoder ()
if (v_motor_left_drive != null)
{
v_motor_left_drive.setMode
( DcMotorController.RunMode.RUN_USING_ENCODERS
( DcMotor.RunMode.RUN_USING_ENCODER
);
}

Expand All @@ -410,7 +409,7 @@ public void run_using_right_drive_encoder ()
if (v_motor_right_drive != null)
{
v_motor_right_drive.setMode
( DcMotorController.RunMode.RUN_USING_ENCODERS
( DcMotor.RunMode.RUN_USING_ENCODER
);
}

Expand Down Expand Up @@ -447,10 +446,10 @@ public void run_without_left_drive_encoder ()
if (v_motor_left_drive != null)
{
if (v_motor_left_drive.getMode () ==
DcMotorController.RunMode.RESET_ENCODERS)
DcMotor.RunMode.STOP_AND_RESET_ENCODER)
{
v_motor_left_drive.setMode
( DcMotorController.RunMode.RUN_WITHOUT_ENCODERS
( DcMotor.RunMode.RUN_WITHOUT_ENCODER
);
}
}
Expand All @@ -470,10 +469,10 @@ public void run_without_right_drive_encoder ()
if (v_motor_right_drive != null)
{
if (v_motor_right_drive.getMode () ==
DcMotorController.RunMode.RESET_ENCODERS)
DcMotor.RunMode.STOP_AND_RESET_ENCODER)
{
v_motor_right_drive.setMode
( DcMotorController.RunMode.RUN_WITHOUT_ENCODERS
( DcMotor.RunMode.RUN_WITHOUT_ENCODER
);
}
}
Expand Down Expand Up @@ -511,7 +510,7 @@ public void reset_left_drive_encoder ()
if (v_motor_left_drive != null)
{
v_motor_left_drive.setMode
( DcMotorController.RunMode.RESET_ENCODERS
( DcMotor.RunMode.STOP_AND_RESET_ENCODER
);
}

Expand All @@ -530,7 +529,7 @@ public void reset_right_drive_encoder ()
if (v_motor_right_drive != null)
{
v_motor_right_drive.setMode
( DcMotorController.RunMode.RESET_ENCODERS
( DcMotor.RunMode.STOP_AND_RESET_ENCODER
);
}

Expand Down
4 changes: 2 additions & 2 deletions opModes/PushBotHardwareSensors.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

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

Expand Down
4 changes: 2 additions & 2 deletions opModes/PushBotIrEvent.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

//------------------------------------------------------------------------------
//
Expand All @@ -9,7 +9,7 @@
* IR seeker implemented using a state machine for the Push Bot.
*
* @author SSI Robotics
* @version 2015-08-16-08-41
* @version 2016-09-05-08-41
*/
public class PushBotIrEvent extends PushBotTelemetrySensors

Expand Down
14 changes: 9 additions & 5 deletions opModes/PushBotIrSeek.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.qualcomm.ftcrobotcontroller.opmodes;

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
package org.firstinspires.ftc.teamcode;

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

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

//IrSeekerSensor irSeeker;
IrSeekerSensor irSeeker;
DcMotor leftMotor;
DcMotor rightMotor;
Expand Down Expand Up @@ -48,8 +51,9 @@ public void runOpMode() throws InterruptedException {
telemetry.addData("Seeker", irSeeker.toString());
telemetry.addData("Speed", " Left=" + leftMotor.getPower() + " Right=" + rightMotor.getPower());

//Wait one hardware cycle to avoid taxing the processor
waitOneFullHardwareCycle();
telemetry.update();

idle();
}

}
Expand Down
8 changes: 7 additions & 1 deletion opModes/PushBotManual.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

//------------------------------------------------------------------------------
//
// PushBotManual
//

import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

/**
* Provide a basic manual operational mode that uses the left and right
* drive motors, left arm motor, servo motors and gamepad input from two
Expand All @@ -12,6 +15,9 @@
* @author SSI Robotics
* @version 2015-08-01-06-01
*/
@TeleOp(name="PushBotManual", group = "pushbot")
//@Disabled
// comment out the above line if you want this op mode to be enabled.
public class PushBotManual extends PushBotTelemetry

{
Expand Down
8 changes: 7 additions & 1 deletion opModes/PushBotManual1.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

//------------------------------------------------------------------------------
//
// PushBotManual
//

import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

/**
* Provide a basic manual operational mode that uses the left and right
* drive motors, left arm motor, servo motors and gamepad input from only one
Expand All @@ -12,6 +16,8 @@
* @author SSI Robotics
* @version 2015-09-05-20-12
*/
@TeleOp(name="PushBotManual", group = "pushbot")
@Disabled
public class PushBotManual1 extends PushBotTelemetry

{
Expand Down
9 changes: 8 additions & 1 deletion opModes/PushBotManualSensors.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

//------------------------------------------------------------------------------
//
// PushBotManualSensors
//

import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

/**
* Provide a basic manual operational mode that uses the left and right
* drive motors, left arm motor, servo motors and gamepad input from two
Expand All @@ -14,6 +18,9 @@
* @author SSI Robotics
* @version 2015-08-25-14-40
*/
@TeleOp(name = "PushBotManualSensors", group = "pushbot")
@Disabled
// comment out the above line if you want this op mode to be enabled.
public class PushBotManualSensors extends PushBotTelemetrySensors

{
Expand Down
9 changes: 8 additions & 1 deletion opModes/PushBotOdsDetectEvent.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

//------------------------------------------------------------------------------
//
// PushBotOdsDetectEvent
//

import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

/**
* Provide a basic autonomous operational mode that demonstrates the use of an
* optical distance sensor to detect a line implemented using a state machine
Expand All @@ -12,6 +16,9 @@
* @author SSI Robotics
* @version 2015-08-30-11-45
*/
@TeleOp(name = "PushBotOdsDetectEvent", group = "pushbot")
@Disabled
// comment out the above line if you want this op mode to be enabled.
public class PushBotOdsDetectEvent extends PushBotTelemetrySensors

{
Expand Down
9 changes: 8 additions & 1 deletion opModes/PushBotOdsFollowEvent.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.qualcomm.ftcrobotcontroller.opmodes;
package org.firstinspires.ftc.teamcode;

//------------------------------------------------------------------------------
//
// PushBotOdsFollowEvent
//

import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

/**
* Provide a basic autonomous operational mode that demonstrates the use of an
* optical distance sensor to follow a line implemented using a state machine
Expand All @@ -12,6 +16,9 @@
* @author SSI Robotics
* @version 2015-08-30-11-45
*/
@TeleOp(name = "PushBotOdsFollowEvent", group = "pushbot")
@Disabled
// comment out the above line if you want this op mode to be enabled.
public class PushBotOdsFollowEvent extends PushBotTelemetrySensors

{
Expand Down
Loading

0 comments on commit 3da211e

Please sign in to comment.