Using Limits to Control Range of Motion
@TeleOp
public class HelloRobot_ArmEncoder extends LinearOpMode {
private DcMotor arm;
static final double COUNTS_PER_MOTOR_REV = 288;
static final double GEAR_REDUCTION = 2.7778;
static final double COUNTS_PER_GEAR_REV = COUNTS_PER_MOTOR_REV * GEAR_REDUCTION;
static final double COUNTS_PER_DEGREE = COUNTS_PER_GEAR_REV/360;
@Override
public void runOpMode() {
arm = hardwareMap.get(DcMotor.class, "arm");
waitForStart();
while (opModeIsActive()) {
telemetry.addData("Status", "Running");
telemetry.update();
}
}
}Creating minPosition and maxPosition
Adjusting our If/Else Statement
Overriding Limits
Adding a Gamepad Override
Adding a Touch Sensor Limit
Last updated
Was this helpful?

