-
Notifications
You must be signed in to change notification settings - Fork 3
/
WebcamPERIM热茶.java
445 lines (363 loc) · 22.2 KB
/
WebcamPERIM热茶.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
//rleyvacortes22
//rmehta22
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
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.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;
import org.firstinspires.ftc.robotcore.external.ClassFactory;
import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName;
import org.firstinspires.ftc.robotcore.external.matrices.OpenGLMatrix;
import org.firstinspires.ftc.robotcore.external.matrices.VectorF;
import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackableDefaultListener;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackables;
import java.util.ArrayList;
import java.util.List;
import static org.firstinspires.ftc.robotcore.external.navigation.AngleUnit.DEGREES;
import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.XYZ;
import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.YZX;
import static org.firstinspires.ftc.robotcore.external.navigation.AxesReference.EXTRINSIC;
import static org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection.BACK;
@Autonomous(name="Nav Webcam", group ="TeamAuto")
//@Disabled
public class WebcamPERIM热茶 extends LinearOpMode {
// IMPORTANT: If you are using a USB WebCam, you must select CAMERA_CHOICE = BACK; and PHONE_IS_PORTRAIT = false;
private static final VuforiaLocalizer.CameraDirection CAMERA_CHOICE = BACK;
private static final boolean PHONE_IS_PORTRAIT = false;
private static final String VUFORIA_KEY = "ARCMwn7/////AAABmSQG7//BnE5ypZMB2YbULPg5zvN2gLbFOF3QXmgJhKfQcjT7vDIGWjO/I7hKJic4AamtURicl5A8b8oMG/NYWe82F1PAe9ZlKOFN4IBtcRMZhWhi3+UePOkwgqYmwxos1FQaMbNgfQhjmjcS0jpthI3Y+5A/tF8FD4ysrkOmoI/l2HypAxqyUBO6ZUuta9mjzbPxHnO0aRGwBSHYO5Pc8jyA6QDqv2AzgoeVc+WQWogI+w6mY9hhqS7vCBb0LUqALe0nFNwc9YbOfnT4D4O9iQLLWtdBoNG7IHgfxc2qBqFHKtR2jKOLeistzA4TPcjypH8Bg3R5aPAMRtZ8kn17vLoAGSrMYBIgB5wvRQfelEmq";
// Since ImageTarget trackables use mm to specifiy their dimensions, we must use mm for all the physical dimension.
// We will define some constants and conversions here
private static final float mmPerInch = 25.4f;
private static final float mmTargetHeight = (6) * mmPerInch; // the height of the center of the target image above the floor
// Constant for Stone Target
private static final float stoneZ = 2.00f * mmPerInch;
// Constants for the center support targets
private static final float bridgeZ = 6.42f * mmPerInch;
private static final float bridgeY = 23 * mmPerInch;
private static final float bridgeX = 5.18f * mmPerInch;
private static final float bridgeRotY = 59; // Units are degrees
private static final float bridgeRotZ = 180;
// Constants for perimeter targets
private static final float halfField = 72 * mmPerInch;
private static final float quadField = 36 * mmPerInch;
// Class Members
private OpenGLMatrix lastLocation = null;
private VuforiaLocalizer vuforia = null;
/**
* This is the webcam we are to use. As with other hardware devices such as motors and
* servos, this device is identified using the robot configuration tool in the FTC application.
*/
WebcamName webcamName = null;
private boolean targetVisible = false;
private float phoneXRotate = 0;
private float phoneYRotate = 0;
private float phoneZRotate = 0;
private ElapsedTime runtime = new ElapsedTime();
static final double COUNTS_PER_MOTOR_REV = 1440 ; // eg: TETRIX Motor Encoder
static final double DRIVE_GEAR_REDUCTION = 2.0 ; // This is < 1.0 if geared UP
static final double WHEEL_DIAMETER_INCHES = 4.0 ; // For figuring circumference
static final double COUNTS_PER_INCH = (COUNTS_PER_MOTOR_REV * DRIVE_GEAR_REDUCTION) / (WHEEL_DIAMETER_INCHES * 3.1415);
static final double DRIVE_SPEED = 0.6;
static final double TURN_SPEED = 0.5;
private DcMotor leftBack;
private DcMotor rightBack;
private DcMotor leftFront;
private DcMotor rightFront;
Servo gripper;
DcMotor vertTrans;
DcMotor horizTrans;
DcMotor leftRoller;
DcMotor rightRoller;
CRServo leftServo;
CRServo rightServo;
@Override public void runOpMode() {
/*
* Retrieve the camera we are to use.
*/
webcamName = hardwareMap.get(WebcamName.class, "EyeCream");
leftBack = hardwareMap.get(DcMotor.class, "leftBack");
leftBack.setDirection(DcMotor.Direction.FORWARD);
leftBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
leftBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
rightBack = hardwareMap.get(DcMotor.class, "rightBack");
rightBack.setDirection(DcMotor.Direction.REVERSE);
rightBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
rightBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
leftFront = hardwareMap.get(DcMotor.class, "leftFront");
leftFront.setDirection(DcMotor.Direction.REVERSE);
leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
leftFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
rightFront = hardwareMap.get(DcMotor.class, "rightFront");
rightFront.setDirection(DcMotor.Direction.FORWARD);
rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
rightFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
gripper = hardwareMap.get(Servo.class, "gripper");
vertTrans = hardwareMap.get(DcMotor.class, "vertTrans");
horizTrans = hardwareMap.get(DcMotor.class, "horizTrans");
leftRoller = hardwareMap.get(DcMotor.class, "leftRoller");
leftRoller.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
leftRoller.setDirection(DcMotor.Direction.FORWARD);
rightRoller = hardwareMap.get(DcMotor.class, "rightRoller");
rightRoller.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
rightRoller.setDirection(DcMotor.Direction.FORWARD);
leftServo = hardwareMap.get(CRServo.class, "leftServo");
rightServo = hardwareMap.get(CRServo.class, "rightServo");
leftServo.setPower(0.0);
rightServo.setPower(0.0);
/*
* Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine.
* We can pass Vuforia the handle to a camera preview resource (on the RC phone);
* If no camera monitor is desired, use the parameter-less constructor instead (commented out below).
*/
int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", hardwareMap.appContext.getPackageName());
VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId);
// VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters();
parameters.vuforiaLicenseKey = VUFORIA_KEY;
parameters.cameraName = webcamName;
// Instantiate the Vuforia engine
vuforia = ClassFactory.getInstance().createVuforia(parameters);
// Load the data sets for the trackable objects. These particular data
// sets are stored in the 'assets' part of our application.
VuforiaTrackables targetsSkyStone = this.vuforia.loadTrackablesFromAsset("Skystone");
VuforiaTrackable stoneTarget = targetsSkyStone.get(0);
stoneTarget.setName("Stone Target");
VuforiaTrackable blueRearBridge = targetsSkyStone.get(1);
blueRearBridge.setName("Blue Rear Bridge");
VuforiaTrackable redRearBridge = targetsSkyStone.get(2);
redRearBridge.setName("Red Rear Bridge");
VuforiaTrackable redFrontBridge = targetsSkyStone.get(3);
redFrontBridge.setName("Red Front Bridge");
VuforiaTrackable blueFrontBridge = targetsSkyStone.get(4);
blueFrontBridge.setName("Blue Front Bridge");
VuforiaTrackable red1 = targetsSkyStone.get(5);
red1.setName("Red Perimeter 1");
VuforiaTrackable red2 = targetsSkyStone.get(6);
red2.setName("Red Perimeter 2");
VuforiaTrackable front1 = targetsSkyStone.get(7);
front1.setName("Front Perimeter 1");
VuforiaTrackable front2 = targetsSkyStone.get(8);
front2.setName("Front Perimeter 2");
VuforiaTrackable blue1 = targetsSkyStone.get(9);
blue1.setName("Blue Perimeter 1");
VuforiaTrackable blue2 = targetsSkyStone.get(10);
blue2.setName("Blue Perimeter 2");
VuforiaTrackable rear1 = targetsSkyStone.get(11);
rear1.setName("Rear Perimeter 1");
VuforiaTrackable rear2 = targetsSkyStone.get(12);
rear2.setName("Rear Perimeter 2");
// For convenience, gather together all the trackable objects in one easily-iterable collection */
List<VuforiaTrackable> allTrackables = new ArrayList<VuforiaTrackable>();
allTrackables.addAll(targetsSkyStone);
// Set the position of the Stone Target. Since it's not fixed in position, assume it's at the field origin.
// Rotated it to to face forward, and raised it to sit on the ground correctly.
// This can be used for generic target-centric approach algorithms
stoneTarget.setLocation(OpenGLMatrix
.translation(0, 0, stoneZ)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, -90)));
//Set the position of the bridge support targets with relation to origin (center of field)
blueFrontBridge.setLocation(OpenGLMatrix
.translation(-bridgeX, bridgeY, bridgeZ)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 0, bridgeRotY, bridgeRotZ)));
blueRearBridge.setLocation(OpenGLMatrix
.translation(-bridgeX, bridgeY, bridgeZ)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 0, -bridgeRotY, bridgeRotZ)));
redFrontBridge.setLocation(OpenGLMatrix
.translation(-bridgeX, -bridgeY, bridgeZ)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 0, -bridgeRotY, 0)));
redRearBridge.setLocation(OpenGLMatrix
.translation(bridgeX, -bridgeY, bridgeZ)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 0, bridgeRotY, 0)));
//Set the position of the perimeter targets with relation to origin (center of field)
red1.setLocation(OpenGLMatrix
.translation(quadField, -halfField, mmTargetHeight)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 180)));
red2.setLocation(OpenGLMatrix
.translation(-quadField, -halfField, mmTargetHeight)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 180)));
front1.setLocation(OpenGLMatrix
.translation(-halfField, -quadField, mmTargetHeight)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0 , 90)));
front2.setLocation(OpenGLMatrix
.translation(-halfField, quadField, mmTargetHeight)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 90)));
blue1.setLocation(OpenGLMatrix
.translation(-quadField, halfField, mmTargetHeight)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 0)));
blue2.setLocation(OpenGLMatrix
.translation(quadField, halfField, mmTargetHeight)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 0)));
rear1.setLocation(OpenGLMatrix
.translation(halfField, quadField, mmTargetHeight)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0 , -90)));
rear2.setLocation(OpenGLMatrix
.translation(halfField, -quadField, mmTargetHeight)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, -90)));
//
// Create a transformation matrix describing where the phone is on the robot.
//
// NOTE !!!! It's very important that you turn OFF your phone's Auto-Screen-Rotation option.
// Lock it into Portrait for these numbers to work.
//
// Info: The coordinate frame for the robot looks the same as the field.
// The robot's "forward" direction is facing out along X axis, with the LEFT side facing out along the Y axis.
// Z is UP on the robot. This equates to a bearing angle of Zero degrees.
//
// The phone starts out lying flat, with the screen facing Up and with the physical top of the phone
// pointing to the LEFT side of the Robot.
// The two examples below assume that the camera is facing forward out the front of the robot.
// We need to rotate the camera around it's long axis to bring the correct camera forward.
if (CAMERA_CHOICE == BACK) {
phoneYRotate = -90;
} else {
phoneYRotate = 90;
}
// Rotate the phone vertical about the X axis if it's in portrait mode
if (PHONE_IS_PORTRAIT) {
phoneXRotate = 90 ;
}
// Next, translate the camera lens to where it is on the robot.
// In this example, it is centered (left to right), but forward of the middle of the robot, and above ground level.
final float CAMERA_FORWARD_DISPLACEMENT = 4.0f * mmPerInch; // eg: Camera is 4 Inches in front of robot-center
final float CAMERA_VERTICAL_DISPLACEMENT = 8.0f * mmPerInch; // eg: Camera is 8 Inches above ground
final float CAMERA_LEFT_DISPLACEMENT = 0; // eg: Camera is ON the robot's center line
OpenGLMatrix robotFromCamera = OpenGLMatrix
.translation(CAMERA_FORWARD_DISPLACEMENT, CAMERA_LEFT_DISPLACEMENT, CAMERA_VERTICAL_DISPLACEMENT)
.multiplied(Orientation.getRotationMatrix(EXTRINSIC, YZX, DEGREES, phoneYRotate, phoneZRotate, phoneXRotate));
// Let all the trackable listeners know where the phone is.
for (VuforiaTrackable trackable : allTrackables) {
((VuforiaTrackableDefaultListener) trackable.getListener()).setPhoneInformation(robotFromCamera, parameters.cameraDirection);
}
// WARNING:
// In this sample, we do not wait for PLAY to be pressed. Target Tracking is started immediately when INIT is pressed.
// This sequence is used to enable the new remote DS Camera Preview feature to be used with this sample.
// CONSEQUENTLY do not put any driving commands in this loop.
// To restore the normal opmode structure, just un-comment the following line:
waitForStart();
// Note: To use the remote camera preview:
// AFTER you hit Init on the Driver Station, use the "options menu" to select "Camera Stream"
// Tap the preview window to receive a fresh image.
targetsSkyStone.activate();
while (!isStopRequested()) {
gripper.setPosition(0.9);
encoderDrive(1.0,36.0,36.0,36.0,36.0);
// check all the trackable targets to see which one (if any) is visible.
targetVisible = false;
for (VuforiaTrackable trackable : allTrackables) { //Scans row of stones as moving down, if the boolean to detect skystone is true, stops
while (!((VuforiaTrackableDefaultListener)trackable.getListener()).isVisible()) {
encoderDrive(1.0, 3.0,-3.0,-3.0,3.0);
if (((VuforiaTrackableDefaultListener)trackable.getListener()).isVisible()) {
telemetry.addData("Visible Target", trackable.getName());
targetVisible = true;
break;
// getUpdatedRobotLocation() will return null if no new information is available since
// the last time that call was made, or if the trackable is not currently visible.
//OpenGLMatrix robotLocationTransform = ((VuforiaTrackableDefaultListener)trackable.getListener()).getUpdatedRobotLocation();
//if (robotLocationTransform != null) {
// lastLocation = robotLocationTransform;
//}
}
}
//rollers are activated, and robot moves forward for 2 feet. It then grips stone.
leftRoller.setPower(-1.0);
rightRoller.setPower(1.0);
leftServo.setPower(-1.0);
rightServo.setPower(1.0);
encoderDrive(1.0,24,24,24,24);
gripper.setPosition(0.7);
//moves back 36 inches, goes under colored bridge, turn robot around, goes up until wall image is detected
encoderDrive(1.0,-36,-36,-36,-36);
leftBack.setDirection(DcMotor.Direction.FORWARD);
rightBack.setDirection(DcMotor.Direction.FORWARD);
leftFront.setDirection(DcMotor.Direction.FORWARD);
rightFront.setDirection(DcMotor.Direction.FORWARD);
encoderDrive(1.0, 3.0, 3.0, 3.0, 3.0);
leftBack.setDirection(DcMotor.Direction.FORWARD);
rightBack.setDirection(DcMotor.Direction.REVERSE);
leftFront.setDirection(DcMotor.Direction.REVERSE);
rightFront.setDirection(DcMotor.Direction.FORWARD);
while (!((VuforiaTrackableDefaultListener)trackable.getListener()).isVisible()) {
encoderDrive(1.0,20,20,20,20);
if (((VuforiaTrackableDefaultListener) trackable.getListener()).isVisible()) {
telemetry.addData("Visible Target", trackable.getName());
targetVisible = true;
break;
}
}
//turn right, move out horizontal translator, drop stone, move translator back in, move up vertical translator, back up to foundation, drop vertical translator, move forward blank inches
leftBack.setDirection(DcMotor.Direction.FORWARD);
rightBack.setDirection(DcMotor.Direction.FORWARD);
leftFront.setDirection(DcMotor.Direction.FORWARD);
rightFront.setDirection(DcMotor.Direction.FORWARD);
encoderDrive(1.0, 3.0, 3.0, 3.0, 3.0);
leftBack.setDirection(DcMotor.Direction.FORWARD);
rightBack.setDirection(DcMotor.Direction.REVERSE);
leftFront.setDirection(DcMotor.Direction.REVERSE);
rightFront.setDirection(DcMotor.Direction.FORWARD);
horizTrans.setTargetPosition(3700);
horizTrans.setPower(1.0);
gripper.setPosition(0.9);
horizTrans.setTargetPosition(0);
horizTrans.setPower(1.0);
vertTrans.setTargetPosition(600);
encoderDrive(1.0,-10, -10,-10,-10);
vertTrans.setTargetPosition(0);
vertTrans.setPower(0);
encoderDrive(1.0,24,24,24,24);
vertTrans.setTargetPosition(800);
encoderDrive(1.0, 25.0,-25.0,-25.0,25.0);
}
// Provide feedback as to where the robot is located (if we know).
if (targetVisible) {
// express position (translation) of robot in inches.
VectorF translation = lastLocation.getTranslation();
telemetry.addData("Pos (in)", "{X, Y, Z} = %.1f, %.1f, %.1f",
translation.get(0) / mmPerInch, translation.get(1) / mmPerInch, translation.get(2) / mmPerInch);
// express the rotation of the robot in degrees.
Orientation rotation = Orientation.getOrientation(lastLocation, EXTRINSIC, XYZ, DEGREES);
telemetry.addData("Rot (deg)", "{Roll, Pitch, Heading} = %.0f, %.0f, %.0f", rotation.firstAngle, rotation.secondAngle, rotation.thirdAngle);
}
else {
telemetry.addData("Visible Target", "none");
}
telemetry.update();
}
// Disable Tracking when we are done;
targetsSkyStone.deactivate();
}
public void encoderDrive(double speed, double fLeftInches, double fRightInches, double bLeftInches, double bRightInches) {
int fLeftTarget;
int fRightTarget;
int bLeftTarget;
int bRightTarget;
if (opModeIsActive()) {
fLeftTarget = leftFront.getCurrentPosition() + (int)(fLeftInches * COUNTS_PER_INCH);
fRightTarget = rightFront.getCurrentPosition() + (int)(fRightInches * COUNTS_PER_INCH);
bLeftTarget = leftBack.getCurrentPosition() + (int)(bLeftInches * COUNTS_PER_INCH);
bRightTarget = rightBack.getCurrentPosition() + (int)(bRightInches * COUNTS_PER_INCH);
leftFront.setTargetPosition(fLeftTarget);
rightFront.setTargetPosition(fRightTarget);
leftBack.setTargetPosition(bLeftTarget);
rightBack.setTargetPosition(bRightTarget);
runtime.reset();
leftFront.setPower(Math.abs(speed));
rightFront.setPower(Math.abs(speed));
leftBack.setPower(Math.abs(speed));
rightBack.setPower(Math.abs(speed));
// leftFront.setPower(0);
// rightFront.setPower(0);
// leftBack.setPower(0);
// rightBack.setPower(0);
leftFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
rightFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
leftBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
rightBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
}
}
}