Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B1 #6

Merged
merged 2 commits into from
Oct 25, 2019
Merged

B1 #6

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions TeamCode/src/main/java/org/firstinspires/ftc/teamcode/meh.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.GyroSensor;
import com.qualcomm.robotcore.util.ElapsedTime;

import org.firstinspires.ftc.teamcode;
import org.firstinspires.ftc.teamcode.teamMethods;

@TeleOp(name="test2", group="test") //fix this
public class meh extends teamMethods {
private ElapsedTime runtime = new ElapsedTime();

//these values should be determined based off hardware being used
/*
private static final double ticksPerRev = 1;
private static final double gearRatio = 1;
private static final double wheelDiameter = 1;
private static final double ticksPerInch = (ticksPerRev * gearRatio) / (wheelDiameter * 3.1415); //the math changes on mecanum. fix and find formula.
*/

//Initialized by: Initialization Button (i think)
public void init() {
telemetry.addData("Status", "Initializing");

// Initialize the hardware variables. Note that the strings used here as parameters
// to 'get' must correspond to the names assigned during the robot configuration
// step (using the FTC Robot Controller app on the phone).
leftDriveFront = hardwareMap.get(DcMotor.class, "left_drive_front");
leftDriveBack = hardwareMap.get(DcMotor.class, "left_drive_back");
rightDriveFront = hardwareMap.get(DcMotor.class, "right_drive_front");
rightDriveBack = hardwareMap.get(DcMotor.class, "right_drive_back");
robotGyro = hardwareMap.get(GyroSensor.class,"gyrosensor");

// Most robots need the motor on one side to be reversed to drive forward
// Reverse the motor that runs backwards when connected directly to the battery
leftDriveFront.setDirection(DcMotor.Direction.FORWARD);
leftDriveBack.setDirection(DcMotor.Direction.FORWARD);
rightDriveFront.setDirection(DcMotor.Direction.REVERSE);
rightDriveBack.setDirection(DcMotor.Direction.REVERSE);

telemetry.addData("Encoders and GyroSensor","Resetting");
leftDriveFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
leftDriveBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
rightDriveFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
rightDriveBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
robotGyro.calibrate();

leftDriveFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
leftDriveBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
rightDriveFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
rightDriveBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);

// Tell the driver that initialization is complete.
telemetry.addData("Status", "Initialized");
}

//Initialized by: Start / runs once
@Override
public void start() {
runtime.reset();
}


//Initialized by: After Start, Before Stop / loops
@Override
public void loop() {
}

//Initialized by: Stop / runs once
@Override
public void stop() {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public abstract class teamMethods extends OpMode {
public GyroSensor robotGyro = null;

//X = a, Y = b
private final double Xdistance = 8;
private final double Ydistance = 8;
//The distances are in inches
private final double Xdistance = 9.27;
private final double Ydistance = 10.02;
private double XYcombinedD = Xdistance + Ydistance;

private static final double COUNTS_PER_MOTOR_REV = 1440 ; // eg: TETRIX Motor Encoder
Expand Down