-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDriverControlTest.kt
More file actions
30 lines (25 loc) · 1 KB
/
DriverControlTest.kt
File metadata and controls
30 lines (25 loc) · 1 KB
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
package org.firstinspires.ftc.teamcode
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
import com.qualcomm.robotcore.eventloop.opmode.TeleOp
import com.qualcomm.robotcore.hardware.DcMotor
import com.qualcomm.robotcore.hardware.Gamepad
@TeleOp
class DriverControlTest: LinearOpMode() {
override fun runOpMode() {
val robot = Hardware(hardwareMap)
val prevGamepad = Gamepad()
prevGamepad.copy(gamepad1)
robot.leftMotor.mode = DcMotor.RunMode.STOP_AND_RESET_ENCODER
robot.leftMotor.targetPosition = 0
robot.leftMotor.mode = DcMotor.RunMode.RUN_TO_POSITION
robot.leftMotor.power = 0.5
waitForStart()
while (opModeIsActive()) {
robot.resetCache()
telemetry.addLine("encoder pos: ${robot.leftMotor.currentPosition}")
telemetry.addLine("target pos: ${robot.leftMotor.targetPosition}")
telemetry.addLine("motor mode: ${robot.leftMotor.mode}")
telemetry.update()
}
}
}