<commit_before>package org.ftc8702.opmodes.test;

import com.qualcomm.hardware.modernrobotics.ModernRoboticsI2cRangeSensor;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;

import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;
import org.ftc8702.configurations.test.BenCharisRangeConfig;
import org.ftcbootstrap.ActiveOpMode;

@Autonomous(name = "Test: ChEnDriveToCrater Test", group = "Test")
public class ChEnDriveToCrater extends ActiveOpMode {

    private static final double FORWARD_TURN_RIGHT_SPEED = 0.3;
    private static final double FORWARD_LEFT_SPEED = 0.11;
    private static final double FORWARD_SPEED = 0.2;
    private static final double FINAL_DISTANCE = 30;

    private BenCharisRangeConfig robotConfig;
    private ModernRoboticsI2cRangeSensor rangeSensor;

    private boolean isRightMotorStopped = false;
    private boolean isLeftMotorStopped = false;
    private double getDistance;

    @Override
    protected void onInit() {
        // do stuff at initialization stage
        robotConfig = BenCharisRangeConfig.newConfig(hardwareMap, getTelemetryUtil());
        rangeSensor = robotConfig.rangeSensor;
    }
    protected void ForwardandTurn() {
        robotConfig.motorR.setPower(isRightMotorStopped ? 0.0 : FORWARD_TURN_RIGHT_SPEED);
        robotConfig.motorL.setPower(isLeftMotorStopped ? 0.0 : FORWARD_LEFT_SPEED);
    }

    protected void Forward() {
        robotConfig.motorR.setPower(isRightMotorStopped ? 0.0 : FORWARD_SPEED);
        robotConfig.motorL.setPower(isLeftMotorStopped ? 0.0 : FORWARD_SPEED);
    }
    @Override
    protected void activeLoop() throws InterruptedException {
        getDistance = rangeSensor.getDistance(DistanceUnit.CM);

        if (getDistance > FINAL_DISTANCE) {
            telemetry.addLine("forward and turn");
            ForwardandTurn();
        }
        else {
            telemetry.addLine("forward only");
            Forward();
        }

        telemetry.addData("cm", "%.2f cm", getDistance);
        telemetry.update();
    }
}<commit_msg>changed to stop and go to drive to crater<commit_after>package org.ftc8702.opmodes.test;

import com.qualcomm.hardware.modernrobotics.ModernRoboticsI2cRangeSensor;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;

import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;
import org.ftc8702.configurations.test.BenCharisRangeConfig;
import org.ftcbootstrap.ActiveOpMode;

@Autonomous(name = "Test: ChEnDriveToCrater Test", group = "Test")
public class ChEnDriveToCrater extends ActiveOpMode {

    private static final double FORWARD_TURN_RIGHT_SPEED = 0.3;
    private static final double FORWARD_LEFT_SPEED = 0.11;
    private static final double FORWARD_SPEED = 0.2;
    private static final double FINAL_DISTANCE = 30;
    private static final long PAUSE_DURATION_MS = 500;

    private BenCharisRangeConfig robotConfig;
    private ModernRoboticsI2cRangeSensor rangeSensor;

    private double distanceToWallInCM;

    @Override
    protected void onInit() {
        // do stuff at initialization stage
        robotConfig = BenCharisRangeConfig.newConfig(hardwareMap, getTelemetryUtil());
        rangeSensor = robotConfig.rangeSensor;
    }

    protected void ForwardandTurn() {
        Forward();
        stopRobot();
        turn();
        stopRobot();
    }

    protected void stopRobot() {
        robotConfig.motorR.setPower(0.0);
        robotConfig.motorL.setPower(0.0);
        sleep(PAUSE_DURATION_MS);
    }

    protected void turn() {
        robotConfig.motorR.setPower(FORWARD_TURN_RIGHT_SPEED);
        robotConfig.motorL.setPower(FORWARD_LEFT_SPEED);
        sleep(PAUSE_DURATION_MS);
    }

    protected void Forward() {
        robotConfig.motorR.setPower(FORWARD_SPEED);
        robotConfig.motorL.setPower(FORWARD_SPEED);
        sleep(PAUSE_DURATION_MS);
    }
    @Override
    protected void activeLoop() throws InterruptedException {
        distanceToWallInCM = rangeSensor.getDistance(DistanceUnit.CM);

        if (distanceToWallInCM > FINAL_DISTANCE) {
            telemetry.addLine("forward and turn");
            ForwardandTurn();
        }
        else {
            telemetry.addLine("forward only");
            Forward();
        }

        telemetry.addData("cm", "%.2f cm", distanceToWallInCM);
        telemetry.update();
    }
}
{'fraction_non_alphanumeric': 0.08595003438001375, 'fraction_numerical': 0.012606005042402018, 'mean_word_length': 3.372745490981964, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4822396', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1311, 'n_words': 253}