-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRRTestTele.java
63 lines (52 loc) · 2.37 KB
/
RRTestTele.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package org.firstinspires.ftc.teamcode;
import com.acmerobotics.roadrunner.geometry.Pose2d;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import org.firstinspires.ftc.teamcode.drive.SampleMecanumDrive;
/**
* This opmode demonstrates how to create a teleop using just the SampleMecanumDrive class without
* the need for an external robot class. This will allow you to do some cool things like
* incorporating live trajectory following in your teleop. Check out TeleOpAgumentedDriving.java for
* an example of such behavior.
* <p>
* This opmode is essentially just LocalizationTest.java with a few additions and comments.
*/
@TeleOp(group = "advanced")
@Disabled
public class RRTestTele extends LinearOpMode {
@Override
public void runOpMode() throws InterruptedException {
// Initialize SampleMecanumDrive
SampleMecanumDrive drive = new SampleMecanumDrive(hardwareMap);
// We want to turn off velocity control for teleop
// Velocity control per wheel is not necessary outside of motion profiled auto
drive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
// Retrieve our pose from the PoseStorage.currentPose static field
// See AutoTransferPose.java for further details
drive.setPoseEstimate(new Pose2d(0, 0, Math.toRadians(45)));
// we actually need to implement this later
// drive.setPoseEstimate(PoseStorage.currentPose);
waitForStart();
if (isStopRequested()) return;
while (opModeIsActive() && !isStopRequested()) {
drive.setWeightedDrivePower(
new Pose2d(
-gamepad1.left_stick_y,
-gamepad1.left_stick_x,
-gamepad1.right_stick_x
)
);
// Update everything. Odometry. Etc.
drive.update();
// Read pose
Pose2d poseEstimate = drive.getPoseEstimate();
// Print pose to telemetry
telemetry.addData("x", poseEstimate.getX());
telemetry.addData("y", poseEstimate.getY());
telemetry.addData("heading", poseEstimate.getHeading());
telemetry.update();
}
}
}