A limited rotation servo can turn from 0 degrees to a certain amount of degrees. This range of rotation is represented by [0, 1], where 0 is 0 degrees and 1 is fully rotated.
To turn a servo, use the setPosition()
method.
Servo myServo = hardwareMap.get(Servo.class, "servo);myServo.setPosition(0.5);
Continuous rotation servos are like motors but they are servos. If you are using them for some reason, you must access then through the hardwareMap
with the CRServo
class.
Servo crServo = hardwareMap.get(CRServo.class, "cr-servo");
Continuous rotation servos work like motors in the sense that they receive a power that makes them go fast, slow, or reverse. You use the setPosition()
method to power a continuous rotation servo.
Telemetry allows you to send and show data on the Driver Station app. This is typically used for debugging or troubleshooting. Telemetry is used through the telemetry
variable available in the OpMode
class and LinearOpMode
class.
To add a line of data to the telemetry log, use the addLine
method.
telemetry.addLine("Hello telemetry!");
The addData
method works similarly to the addLine
method. However, using the addData
method formats the data like this: "CAPTION: VALUE".
telemetry.addData("CAPTION", "VALUE");
When the update
method is called, the telemetry log data is cleared sent to the Driver Station app and appears on the screen. If you use the update
method without adding more data to the telemetry log, then the telemetry on the Driver Station app will be empty.
telemetry.update()
The gamepad is available with the gamepad1
and gamepad2
variables in the OpMode
and LinearOpMode
classes.