Skip to main content

Stage 9: Closed-Loop Flywheel Velocity

Apply encoder feedback in Launcher.java. setPower() is still useful for many mechanisms, but a flywheel needs a measured velocity target that stays consistent as conditions change.

Your Task

  1. Change the flywheel to DcMotorEx and map it with the exact configured launcher name.
  2. Select RUN_USING_ENCODER and set reasonable velocity PIDF coefficients.
  3. Scale the right trigger into a target velocity and call setVelocity().
  4. Read getVelocity() and report both target and measured values through telemetry.

Make the conversion readable enough that a teammate can change wheel size without rewriting the routine.

The simulator's small battery readout starts at 13.0 V and drains only while the OpMode is running. Compare an open-loop setPower() launcher with setVelocity(): the measured open-loop speed will fall with voltage, while a reachable velocity target should remain steady. If that loss continues long enough, the normal code-hint area will explain what the motor command is doing.

Coding Challenge Simulator

Telemark Unit 10 Comprehensive Coding Challenge
The editor opens your saved cumulative DECODE project and adds only the files introduced by this stage.
Use Init and Start to check every unit objective. Passing every check demonstrates full unit mastery.
Complete the stage across its file tabs. The requirement panel checks the compiled project, and a passing stage saves a read-only snapshot.

Passed every challenge check?

Mark the unit mastered to record every lesson objective and continue directly to the next unit. Your progress will be saved in this browser.

Stuck on this lesson?

Ask about anything on this page. It can see which lesson you have open and which part you are reading.