-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/LearningTeleOpfor17334.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.firstinspires.ftc.teamcode.opmode; | ||
|
||
import com.acmerobotics.dashboard.config.Config; | ||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; | ||
import com.qualcomm.robotcore.eventloop.opmode.TeleOp; | ||
import com.qualcomm.robotcore.hardware.DcMotor; | ||
|
||
@Config | ||
|
||
@TeleOp | ||
public class LearningTeleOpfor17334 extends LinearOpMode { | ||
private DcMotor leftFrontMotor; | ||
private DcMotor rightFrontMotor; | ||
private DcMotor leftBackMotor; | ||
|
||
@Override | ||
public void runOpMode() throws InterruptedException { | ||
|
||
leftFrontMotor = hardwareMap.get(DcMotor.class, "left_front_left_dw"); | ||
rightFrontMotor = hardwareMap.get(DcMotor.class, "right_front"); | ||
waitForStart(); | ||
while(opModeIsActive()){ | ||
if (gamepad1.right_stick_y>=0.1) { | ||
leftFrontMotor.setPower(1); | ||
rightFrontMotor.setPower(-1); | ||
} else if (gamepad1.right_stick_y<=-0.1) { | ||
leftFrontMotor.setPower(-1); | ||
rightFrontMotor.setPower(1); | ||
} else { | ||
leftFrontMotor.setPower(0); | ||
rightFrontMotor.setPower(0); | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...de/src/main/java/org/firstinspires/ftc/teamcode/opmode/components/TrumanLearnsTeleOP.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package org.firstinspires.ftc.teamcode.opmode.components; | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; | ||
import com.qualcomm.robotcore.eventloop.opmode.TeleOp; | ||
import com.qualcomm.robotcore.hardware.CRServo; | ||
import com.qualcomm.robotcore.hardware.DcMotor; | ||
import com.qualcomm.robotcore.hardware.DcMotorSimple; | ||
import com.qualcomm.robotcore.hardware.Servo; | ||
import com.qualcomm.robotcore.hardware.ServoController; | ||
|
||
import org.firstinspires.ftc.robotcore.internal.camera.delegating.DelegatingCaptureSequence; | ||
|
||
|
||
@TeleOp | ||
|
||
public class TrumanLearnsTeleOP extends LinearOpMode { | ||
private DcMotor topLeftMotor; | ||
private DcMotor topRightMotor; | ||
private DcMotor bottomLeftMotor; | ||
private DcMotor bottomRightMotor; | ||
private CRServo tail; | ||
@Override | ||
public void runOpMode() throws InterruptedException { | ||
float ly; | ||
float lx; | ||
float rx; | ||
topLeftMotor = hardwareMap.get(DcMotor.class,"FL"); | ||
topRightMotor = hardwareMap.get(DcMotor.class,"FR"); | ||
bottomLeftMotor = hardwareMap.get(DcMotor.class,"BL"); | ||
bottomRightMotor = hardwareMap.get(DcMotor.class,"BR"); | ||
topLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE); | ||
bottomLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE); | ||
//tail = hardwareMap.get(CRServo.class,"servo"); ONLY FOR DOG | ||
int tailAngle = 1; | ||
double motorSpeed = 0.3; | ||
waitForStart(); | ||
while (opModeIsActive()){ | ||
lx=gamepad1.left_stick_x; | ||
ly=gamepad1.left_stick_y; | ||
rx=gamepad1.right_stick_x; | ||
topLeftMotor.setPower((ly-lx-rx)*motorSpeed); | ||
// topRightMotor.setPower((ly-lx-rx)*motorSpeed); | ||
// bottomLeftMotor.setPower((ly-lx+rx)*motorSpeed); | ||
// bottomRightMotor.setPower((-rx+lx+ly)*motorSpeed); | ||
/* | ||
if (gamepad1.a) { | ||
tail.setDirection(DcMotorSimple.Direction.FORWARD); | ||
} | ||
else { | ||
tail.setDirection(DcMotorSimple.Direction.REVERSE); | ||
} | ||
*/ | ||
// System.out.println(); | ||
} | ||
} | ||
} | ||
|