Instructional Material: Using Encoders Quiz
1. What is an encoder? How does it work?
2. There are three main settings for encoders. Briefly explain what each does (which is running at a set speed, which is running at a set power?)
motor.setmode(DcMotor.RunMode.RUN_TO_POSITION);
motor.setmode(DcMotor.RunMode.RUN_USING_ENCODER);
motor.setmode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
3. Describe the process for setting a motor to turn one full rotation and then stop.
4. Describe the process for setting a motor to run at a consistent speed for two seconds and then stop.
5. This code is supposed to make the motor turn half a rotation. It never moves. There are two errors, what are they? (This is not a configuration problem)
motor = hardwareMap.dcMotor.get("ml"); motor.setMode(DcMotor.RunMode.RUN_WITH_ENCODERS); startPosition = motor.getCurrentPosition(); waitForStart(); motor.setTargetPosition(startPosition + 500);
Here are the answers.