Skip to content

Commit

Permalink
Got rid of some unnecessary variables, need to fix lift bug and creat…
Browse files Browse the repository at this point in the history
…e autonomous OpModes (#49)
  • Loading branch information
lachlanPaul committed Nov 3, 2023
1 parent 0384ca0 commit d6cb8cb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

/**
* Wheatley robot configuration and hardware declarations
* <p>
* NOTE: As of initial writing, we have nearly no idea what hardware specifications we will be using
* This is almost all guessing and taking hints from new SDK features, mostly copied from DinoMighty
*
* @author Lachlan Paul, 2023
*/
Expand All @@ -27,14 +24,30 @@ public class WheatleyConfig extends RobotConfig {
// left_rear = hardwareMap.get(DcMotor.class, "left_rear");

// Declares all necessary motors

// Expansion 1: fl
public DcMotor frontLeft;

// Expansion 0: bl
public DcMotor backLeft;

// Expansion 2: fr
public DcMotor frontRight;

// Expansion 3: br
public DcMotor backRight;

// Control 0: ra
public DcMotor rotator;

// Control Servo 0: ls

public DcMotor leftServo;

// Control Servo 1: rs
public DcMotor rightServo;

// USB device "webcam"
public WebcamName webcam;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@

public class WheatleyLift extends BunyipsComponent {

private final DcMotor clawArm;
private double armPower;
private final double clawPower;

private final DcMotor arm;
private double armPower = 0.0;
private final Servo leftServo;
private final Servo rightServo;

Expand All @@ -30,11 +28,9 @@ public class WheatleyLift extends BunyipsComponent {
private Boolean leftClawState = false;
private Boolean rightClawState = false;

public WheatleyLift(@NonNull BunyipsOpMode opMode, Double armPower, DcMotor clawArm, double clawPower, Servo leftServo, Servo rightServo) {
public WheatleyLift(@NonNull BunyipsOpMode opMode, DcMotor arm, Servo leftServo, Servo rightServo) {
super(opMode);
this.clawArm = clawArm;
this.clawPower = clawPower;
this.armPower = armPower;
this.arm = arm;
this.leftServo = leftServo;
this.rightServo = rightServo;

Expand Down Expand Up @@ -72,11 +68,11 @@ public void rightClaw() {

public void update() {

clawArm.setPower(clawPower);
arm.setPower(armPower);

// Can update telemetry functions too
// The modified telemetry function takes in a value to show on the Driver Station, and
// whether or not to keep it on the screen upon the next activeLoop.
getOpMode().addTelemetry("Lift Arm Position: " + clawArm.getCurrentPosition(), false);
getOpMode().addTelemetry("Lift Arm Position: " + arm.getCurrentPosition(), false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ protected void onInit() {
protected void activeLoop() {

drive.setSpeedUsingController(gamepad1.left_stick_x, gamepad1.left_stick_y, gamepad1.right_stick_x);
drive.update();

lift.armLift(gamepad2.left_stick_y);
lift.update();

if (gamepad2.x) {
lift.leftClaw();
Expand Down

0 comments on commit d6cb8cb

Please sign in to comment.