Compare commits
2 commits
dcd0307186
...
17387ad419
Author | SHA1 | Date | |
---|---|---|---|
Yash Karandikar | 17387ad419 | ||
Yash Karandikar | 3fe756cdaf |
|
@ -4,6 +4,7 @@ import com.qualcomm.robotcore.eventloop.opmode.OpMode;
|
|||
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||
import com.qualcomm.robotcore.hardware.DcMotor;
|
||||
import com.qualcomm.robotcore.hardware.DcMotorSimple;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
@TeleOp(name = "TELEOP - USE THIS ONE")
|
||||
public class DriveTeleOp extends OpMode {
|
||||
|
@ -31,7 +32,7 @@ public class DriveTeleOp extends OpMode {
|
|||
strafe = gamepad1.left_stick_x;
|
||||
turn = gamepad1.right_stick_x;
|
||||
powerLift = -1 * gamepad2.left_stick_y;
|
||||
if (gamepad1.left_bumper && last_left_bumper != gamepad1.left_bumper) speed = Math.max(0, speed - 0.15);
|
||||
if (gamepad1.left_bumper && last_left_bumper != gamepad1.left_bumper) speed = Math.max(0.15, speed - 0.15);
|
||||
if (gamepad1.right_bumper && last_right_bumper != gamepad1.right_bumper) speed = Math.min(1, speed + 0.15);
|
||||
|
||||
last_left_bumper = gamepad1.left_bumper;
|
||||
|
@ -61,7 +62,8 @@ public class DriveTeleOp extends OpMode {
|
|||
motorLiftLeft.setPower(powerLift);
|
||||
motorLiftRight.setPower(powerLift);
|
||||
|
||||
telemetry.addData("speed", String.format("%.2f", speed));
|
||||
DecimalFormat df = new DecimalFormat("#%");
|
||||
telemetry.addData("speed", df.format(speed));
|
||||
telemetry.update();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue