Skip to content

Homework: how far did it actually go?

W1Homework
SolvePhase 1 of 220 XP

Ticks to inches

An encoder is a sensor that counts as a motor turns. It does not know about inches. It counts ticks, and it is your job to turn those into a distance.

Three steps:

  1. How far the wheel goes in one turn - that is the circumference, Math.PI times the diameter.
  2. How many turns happened - ticks divided by ticks per revolution.
  3. How far the robot went - turns times circumference.

Print all three, exactly as Java gives them. Do not round anything.

The checks are looking for

  • Main needs a method: public static void main(String[] args)That line is where your program starts. Leave it exactly as it is and write inside it.

What it should print

Circumference: 12.566370614359172
Revolutions: 48.76190476190476
Inches: 612.7601671001805

Beta

3 hints left. Asking is free.

Next up is Level up But a real encoder counts in whole numbers

Press Run and the robot drives here. After a Check, any test that drove the robot has a “Replay this” button next to it.

Homework: how far did it actually go? · Robot On-Ramp