Skip to content

Commit

Permalink
Commenting programs
Browse files Browse the repository at this point in the history
  • Loading branch information
kcabo10 committed Mar 1, 2019
1 parent f2cf350 commit 4d194d5
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class CraterProgramNoLight extends LinearOpMode {
private String goldPosition = "";

/**
* The main body of our code which contains the set of commands carried out in our crater side autonomous program.
* This method is the main body of our code which contains the set of commands carried out in our crater side autonomous program.
*/
@Override
public void runOpMode() {
Expand Down Expand Up @@ -471,6 +471,7 @@ public void runOpMode() {
}

/**
* This method prints telemetry for our autonomous program
* @param codePos This is the value we use in telemetry to see where in the code we are
*/
private void printTelemetry(int codePos) {
Expand All @@ -482,7 +483,7 @@ private void printTelemetry(int codePos) {
}

/**
* Lowers lift while reading the sampling
* This method lowers the lift while reading the sampling
*/
private void lowerLift() {
robot.lift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
Expand All @@ -493,7 +494,7 @@ private void lowerLift() {
}

/**
* Calls Tensor Flow in order to read gold mineral position
* This method calls Tensor Flow in order to read gold mineral position
*/
public void getMineralPosition() {
int debounceCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ public void runOpMode() {
}

/**
* This method prints telemetry for our autonomous program
* @param codePos This is the value we use in telemetry to see where in the code we are
*/
private void printTelemetry(int codePos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ public void runOpMode() {
}

/**
* This method prints telemetry for our autonomous program
* @param codePos This is the value we use in telemetry to see where in the code we are
*/
private void printTelemetry(int codePos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ public void runOpMode() {
}

/**
* This method prints telemetry for our autonomous program
* @param codePos This is the value we use in telemetry to see where in the code we are
*/
private void printTelemetry(int codePos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@

import org.firstinspires.ftc.teamcode.sensors.SensorMB1242;

/**
* @author Beep Patrol
* <p>
* <b>Summary:</b>
* <p>
* This is our Hardware Map that contains all the motors, servos, and sensors that we use on the
* robot. We pull this Hardware Map in all the programs we use a part of the robot. In this program
* we intialize the encoders on the motors we want to call the encoder for.
*/
public class HardwareBeep {

// Set Public OpMode Members
Expand Down Expand Up @@ -43,7 +52,7 @@ public HardwareBeep() {
}

/**
* Initializes standard hardware snterfaces
* Initializes standard hardware interfaces
*/
public void init(HardwareMap ahwMap) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import org.firstinspires.ftc.robotcore.external.navigation.AxesReference;
import org.firstinspires.ftc.robotcore.external.navigation.Orientation;

//@Autonomous(name="Michael Gryo Testing 4", group="Exercises")
//@Disabled

public class LibraryGyro {

HardwareBeep robot = null;
Expand All @@ -27,7 +24,6 @@ public class LibraryGyro {
double errSum, lastErr;
double kp, ki, kd;


/**
* The hardware class needs to be initialized before this function is called
*/
Expand Down Expand Up @@ -55,7 +51,6 @@ private void resetAngle() {

/**
* Get current cumulative angle rotation from last reset.
*
* @return Angle in degrees. + = left, - = right.
*/
public double getAngle() {
Expand All @@ -82,7 +77,6 @@ else if (deltaAngle > 180)

/**
* See if we are moving in a straight line and if not return a power correction value.
*
* @return Power adjustment, + is adjust left - is adjust right.
*/
private double checkDirection() {
Expand Down Expand Up @@ -117,13 +111,24 @@ public void ComputePID() {

}

/**
*
* @param Kp
* @param Ki
* @param Kd
*/
public void SetTunings(double Kp, double Ki, double Kd) {
kp = Kp;
ki = Ki;
kd = Kd;
}


/**
*
* @param targetHeading
* @return
*/
public double turnGyro(float targetHeading) {
int original_anglez = 0;
// BNO055IMU imu;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public void init(HardwareBeep myRobot, Telemetry myTelemetry, DcMotor myMotor) {

/**
*
* @param speed
* @param encoderTicks
* @param angle
* @param speed This allows us to input a speed when we call this function.
* @param encoderTicks Input how far you want to drive using the encoder ticks.
* @param angle Input what angle you want it to drive.
*/
public void gyroDrive(double speed,
int encoderTicks,
Expand Down Expand Up @@ -152,9 +152,9 @@ public void gyroDrive(double speed,

/**
*
* @param speed
* @param angle
* @param PCoeff
* @param speed Input your desired speed.
* @param angle This is the angle the function is fed by the readings to determine the error
* @param PCoeff Proportional Gain Coefficient
* @return
*/
boolean onHeading(double speed, double angle, double PCoeff) {
Expand Down Expand Up @@ -200,7 +200,6 @@ boolean onHeading(double speed, double angle, double PCoeff) {

/**
* getError determines the error between the target angle and the robot's current heading
*
* @param targetAngle Desired angle (relative to global reference established at last Gyro Reset).
* @return error angle: Degrees in the range +/- 180. Centered on the robot's frame of reference
* +ve error means the robot should turn LEFT (CCW) to reduce error.
Expand All @@ -218,7 +217,6 @@ public double getError(double targetAngle) {

/**
* returns desired steering force. +/- 1 range. +ve = steer left
*
* @param error Error angle in robot relative degrees
* @param PCoeff Proportional Gain Coefficient
* @return
Expand All @@ -229,10 +227,10 @@ public double getSteer(double error, double PCoeff) {

/**
*
* @param speed
* @param encoderTicks
* @param angle
* @param PCoeff
* @param speed When you call the function input the desired speed
* @param encoderTicks Input the distance you want to drive in encoder ticks
* @param angle What angle you would like to drive
* @param PCoeff Proportional Gain Coefficient
*/
public void gyroDriveVariableP(double speed,
int encoderTicks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

/**
* This Our OpMode that illustrates TensorFlow Object Detection API to determine the position of the
* gold and silver minerals.
* gold and silver minerals. For this Library we set the phone light to be off.
*/
public class LibraryTensorFlowObjectDetectionNoLight {
private static final String TFOD_MODEL_ASSET = "RoverRuckus.tflite";
Expand All @@ -61,17 +61,22 @@ public class LibraryTensorFlowObjectDetectionNoLight {
private TFObjectDetector tfod;

/**
*
* @param newHardwareBeep
* @param newTelemetry
* This method sets the hardware map and telemetry for TensorFlow
* @param newHardwareBeep This is the hardware we use to initialize TensorFlow to the phone
* @param newTelemetry This is the parameter that calls the telemetry for us to use
*/
public LibraryTensorFlowObjectDetectionNoLight(HardwareBeep newHardwareBeep, Telemetry newTelemetry) {
public LibraryTensorFlowObjectDetectionNoLight(HardwareBeep newHardwareBeep, Telemetry
newTelemetry) {

robot = newHardwareBeep;
telemetry = newTelemetry;

}

/**
* This method initializes vuforia and returns the gold mineral position
* @return Returns gold mineral position
*/
public String findMineral() {
// The TFObjectDetector uses the camera frames from the VuforiaLocalizer, so we create that
// first.
Expand Down Expand Up @@ -132,7 +137,10 @@ public String findMineral() {
return goldPosition;
}

// read mineral function
/**
* This method has an algorithm that reads the right two minerals.
* @return Returns the current gold position.
*/
public String readMineral() {
String currentPos = "";
ElapsedTime timer = new ElapsedTime();
Expand Down Expand Up @@ -225,7 +233,9 @@ public String readMineral() {
return currentPos;
}

// this is the function that initializes the Tensor Flow program
/**
* This method initializes the Tensor Flow program on the phone
*/
private void initVuforia() {
// Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine
VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters();
Expand All @@ -237,7 +247,10 @@ private void initVuforia() {
vuforia = ClassFactory.getInstance().createVuforia(parameters);
}

// this funciton is for the phone light
/**
* This method turns on the the phone light
* @param on This is the value we use to set the phone light to "ON"
*/
private void phoneLight(boolean on) {

// if you set the phone light to true than it turns on the phone flashlight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

/**
* This Our OpMode that illustrates TensorFlow Object Detection API to determine the position of the
* gold and silver minerals.
* gold and silver minerals. This library sets the phone light to be on.
*/
public class LibraryTensorFlowObjectDetectionWithLight {
private static final String TFOD_MODEL_ASSET = "RoverRuckus.tflite";
Expand Down

0 comments on commit 4d194d5

Please sign in to comment.