-
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.
Merge remote-tracking branch 'origin/apriltag' into apriltag
- Loading branch information
Showing
3 changed files
with
122 additions
and
14 deletions.
There are no files selected for viewing
24 changes: 14 additions & 10 deletions
24
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/hardware/AnalogTest.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
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
68 changes: 68 additions & 0 deletions
68
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/TeleOp.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,68 @@ | ||
package org.firstinspires.ftc.teamcode.opmode; | ||
|
||
import com.acmerobotics.roadrunner.geometry.Pose2d; | ||
import com.acmerobotics.roadrunner.geometry.Vector2d; | ||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; | ||
import com.qualcomm.robotcore.hardware.DcMotor; | ||
import com.qualcomm.robotcore.hardware.DcMotorEx; | ||
|
||
import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; | ||
import org.firstinspires.ftc.teamcode.drive.testbot.TestBotDrive; | ||
import org.firstinspires.ftc.teamcode.util.GlobalOpMode; | ||
import org.firstinspires.ftc.teamcode.vision.AprilTagCamera; | ||
|
||
@com.qualcomm.robotcore.eventloop.opmode.TeleOp | ||
public class TeleOp extends LinearOpMode { | ||
|
||
@Override | ||
public void runOpMode() throws InterruptedException { | ||
GlobalOpMode.opMode = this; | ||
TestBotDrive drive = new TestBotDrive(hardwareMap); | ||
|
||
AprilTagCamera[] cameras = new AprilTagCamera[3]; | ||
cameras[0] = new AprilTagCamera(hardwareMap.get(WebcamName.class, "Left"), 8, Math.toRadians(70), Math.toRadians(-45)); | ||
cameras[1] = new AprilTagCamera(hardwareMap.get(WebcamName.class, "Center"), 7, Math.toRadians(90), Math.toRadians(0)); | ||
cameras[2] = new AprilTagCamera(hardwareMap.get(WebcamName.class, "Right"), 8, Math.toRadians(-70), Math.toRadians(45)); | ||
|
||
waitForStart(); | ||
|
||
|
||
while (!isStopRequested()) { | ||
// Read pose | ||
Pose2d poseEstimate = drive.getPoseEstimate(); | ||
|
||
// Create a vector from the gamepad x/y inputs | ||
// Then, rotate that vector by the inverse of that heading | ||
Vector2d input = new Vector2d(-gamepad1.left_stick_y, -gamepad1.left_stick_x).rotated(-poseEstimate.getHeading()); | ||
|
||
// Pass in the rotated input + right stick value for rotation | ||
// Rotation is not part of the rotated input thus must be passed in separately | ||
drive.setWeightedDrivePower(new Pose2d(input.getX(), input.getY(), -gamepad1.right_stick_x)); | ||
|
||
// TODO: Add controls to gamepad 2 as well | ||
if (gamepad1.a) { | ||
// Intake running while A is held | ||
} else { | ||
// Turn off intake when A released | ||
} | ||
|
||
if (gamepad1.b) { | ||
// Move pixel hand servo to release 1 pixel | ||
// TODO: Do we need to debounce and count presses? Svit mentioned a "pixel cassette" that drops multiple pixels | ||
} else { | ||
// Close pixel hand servo | ||
} | ||
|
||
if (gamepad1.right_bumper && gamepad1.left_bumper) { | ||
// Launch the airplane | ||
// TODO: Check for endgame? | ||
} | ||
|
||
// Set bar hang motor power to gamepad1.right_trigger - gamepad1.left_trigger for analog control | ||
|
||
} | ||
|
||
|
||
|
||
} | ||
} |