Skip to content

Commit

Permalink
Added JavaDocs to HardwareBeep and TeleOp
Browse files Browse the repository at this point in the history
  • Loading branch information
kylie1234 committed Feb 23, 2019
1 parent e7f3135 commit dbbb0bc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public class CraterProgramNoLight extends LinearOpMode {
// Calling the Library Gyro Drive program to use the gyro drive function
LibraryGyroDrive gyroDrive = new LibraryGyroDrive();
// Calling the Library Grid Nav Library to use the grid navigation functions
LibraryGridNavigation gridNavigation = new LibraryGridNavigation();
private LibraryGridNavigation gridNavigation = new LibraryGridNavigation();
// Calling the Library Tensor Flow No Light to use the Tensor Flow function without
// initializing the light
LibraryTensorFlowObjectDetectionNoLight tensorFlow =
private LibraryTensorFlowObjectDetectionNoLight tensorFlow =
new LibraryTensorFlowObjectDetectionNoLight(robot, telemetry);
// Declaring gold position value to read what position Tensor Flow sees the gold mineral in
String goldPosition = "";
private String goldPosition = "";

/**
* The main body of our code which contains the set of commands carried out in our crater side autonomous program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public class HardwareBeep {
public HardwareBeep() {
}

// Initialize Standard Hardware Interfaces
/**
* Initializes standard hardware snterfaces
*/
public void init(HardwareMap ahwMap) {

// Telemetry Switches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
public class TeleOpProgram extends OpMode {

// Declaring timers for the arm and basket.
public ElapsedTime armtime = new ElapsedTime();
public ElapsedTime baskettime = new ElapsedTime();
private ElapsedTime armtime = new ElapsedTime();
private ElapsedTime baskettime = new ElapsedTime();
// Setting arm_state, arm_extrusion_state, and basket_state values to zero for arm state machine.
int arm_state = 0;
int arm_extrusion_state = 0;
int basket_state = 0;
private int arm_state = 0;
private int arm_extrusion_state = 0;
private int basket_state = 0;
// Calling hardware map.
private HardwareBeep robot = new HardwareBeep();
// Setting value to track whether the Y and A buttons are pressed to zero which is not pressed.
Expand All @@ -34,31 +34,39 @@ public class TeleOpProgram extends OpMode {
private double scaleFactor = 1;
private double scaleTurningSpeed = 1;

// reverseDirection, when called, reverses the value of direction.
public void reverseDirection() {
/**
* Reverses the direction of the mecanum drive.
*/
private void reverseDirection() {
if (direction == 1) {
direction = -1;
} else if (direction == -1) {
direction = 1;
}
}

// When scaleFactor is called the value is set to either .5 or 1.
public void scaleFactor() {
/**
* Scales the speed of the robot to .5.
*/
private void scaleFactor() {
if (scaleFactor == 0.5) {
scaleFactor = 1;
} else if (scaleFactor == 1) {
scaleFactor = 0.5;
}
}

// Initializing hardware map
/**
* Initializes hardware map.
*/
public void init() {
robot.init(hardwareMap);
telemetry.addData("Say", "Hello Driver");
}

// Setting motor power to zero
/**
* Sets motor power to zero
*/
public void init_loop() {
robot.lift.setPower(0);
robot.latch.setPower(0);
Expand All @@ -68,6 +76,9 @@ public void init_loop() {

}

/**
* The main body of our code which contains the code for each of the features on our robot used in teleOp
*/
public void loop() {

double r = Math.hypot(gamepad1.left_stick_x, gamepad1.left_stick_y);
Expand Down Expand Up @@ -316,12 +327,13 @@ public void loop() {
telemetry.update();
}

/**
* Sets the buttons to not being pressed, sets the motor power to zero, and terminates the program.
*/
public void stop() {

// Set the buttons to not being pressed
buttonYPressed = 0;
buttonAPressed = 0;
// Set the motor powers to zero
robot.lift.setPower(0);
robot.latch.setPower(0);
robot.intake.setPower(0);
Expand Down

0 comments on commit dbbb0bc

Please sign in to comment.