mirror of
https://github.com/TimeCrafters/FTC_2022
synced 2025-12-16 11:12:35 +00:00
Tank drive w/ bumper strafe yay
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
package org.timecrafters.minibots.cyberarm.engines;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||||
|
import org.timecrafters.minibots.cyberarm.states.MecanumRobot;
|
||||||
|
import org.timecrafters.minibots.cyberarm.states.PingPongState;
|
||||||
|
|
||||||
|
@TeleOp (name = "Sodi PingPong")
|
||||||
|
|
||||||
|
public class PingPongEngine extends CyberarmEngine {
|
||||||
|
|
||||||
|
MecanumRobot robot;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
|
||||||
|
robot = new MecanumRobot(this);
|
||||||
|
|
||||||
|
addState(new PingPongState(robot));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package org.timecrafters.minibots.cyberarm.states;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
|
||||||
|
public class PingPongState extends CyberarmState {
|
||||||
|
|
||||||
|
private final MecanumRobot robot;
|
||||||
|
public PingPongState(MecanumRobot robot) {
|
||||||
|
this.robot = robot;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
|
||||||
|
if (engine.gamepad1.left_bumper) {
|
||||||
|
robot.frontLeftDrive.setPower(1);
|
||||||
|
robot.backLeftDrive.setPower(-1);
|
||||||
|
robot.backRightDrive.setPower(1);
|
||||||
|
robot.frontRightDrive.setPower(-1);
|
||||||
|
}
|
||||||
|
else if (engine.gamepad1.right_bumper) {
|
||||||
|
robot.frontLeftDrive.setPower(-1);
|
||||||
|
robot.backLeftDrive.setPower(1);
|
||||||
|
robot.frontRightDrive.setPower(1);
|
||||||
|
robot.backRightDrive.setPower(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
robot.backLeftDrive.setPower(engine.gamepad1.left_stick_y);
|
||||||
|
robot.frontLeftDrive.setPower(engine.gamepad1.left_stick_y);
|
||||||
|
robot.backRightDrive.setPower(engine.gamepad1.right_stick_y);
|
||||||
|
robot.frontRightDrive.setPower(engine.gamepad1.right_stick_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user