Be advised that this looks a lot different than it used to. But it's also a lot easier.
Also of note: Most TeleOp cases will look identical, except that they will use different robots
or different control schemes. As such, you can usually take the RobotATestTeleOp (which looks
similar to the code below) as a template and modify those two fields as needed, and the rest
of the code will still work. Rarely will you need to create a whole new TeleOp.
A more common scenario would be creating a new control scheme.
package org.firstinspires.ftc.teamcode.fy23;
// some imports here
@TeleOp()
public class NewTeleOp extends OpMode {
Robot robot;
// IndyTeleOpScheme is what we're used to. FieldyTeleOpScheme offers field-oriented driving.
IndyTeleOpScheme controlScheme;
// This will store the state the controller is in.
TeleOpState controlState;
public void init() {
robot = new Robot(RobotRoundhouse.getRobotAParameters(hardwareMap));
controlScheme = new IndyTeleOpScheme(driver:gamepad1, manipulator:gamepad2);
}
public void loop() {
// update controller state
controlState = controlScheme.getState();
// handle movement
robot.drive.applyDTS(controlState.getDTS().normalize());
// handle pivot arm
robot.arm.setPivotPower(controlState.getPivotPower());
robot.arm.setElevatorPower(controlState.getElevatorPower());
// handle claw
robot.claw.setState(controlState.getClawState());
// handle plane launcher
if controlState.isLaunch() {
robot.planeLauncher.launch();
}
// call robot.update - This is very important!
robot.update();
}
}
TeleOp has three important components: