Format speed as percentage

This commit is contained in:
Yash Karandikar 2022-11-11 21:10:56 -06:00
parent dcd0307186
commit 3fe756cdaf

View file

@ -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 {
@ -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();
}