Dead Wheel Encoders
What are Dead Wheels?
Dead wheels spin freely and are not driven by the motors. Encoders on those wheels measure motion with less slip than counting only on powered drive wheels.
Advantages of Dead Wheel Encoders
Because dead wheels are not pushing the robot, their encoders usually see cleaner counts during acceleration, turns, and pushing matches—when drive-wheel slip is worst.
Hardware Setup and Placement
Mount one pair parallel to the drivetrain (forward/back) and often a third wheel perpendicular for lateral motion. Measure distances between wheel centers carefully; bad geometry shows up as curved “straight” drives.
Reading Encoder Values in Android Studio
Configure each encoder as a DcMotor in the Robot Configuration, then read positions in your OpMode:
// Declare encoder variables
DcMotor leftEncoder, rightEncoder, centerEncoder;
@Override
public void runOpMode() {
leftEncoder = hardwareMap.get(DcMotor.class, "leftEncoder");
rightEncoder = hardwareMap.get(DcMotor.class, "rightEncoder");
centerEncoder = hardwareMap.get(DcMotor.class, "centerEncoder");
waitForStart();
while (opModeIsActive()) {
int leftTicks = leftEncoder.getCurrentPosition();
int rightTicks = rightEncoder.getCurrentPosition();
int centerTicks = centerEncoder.getCurrentPosition();
telemetry.addData("Left Encoder", leftTicks);
telemetry.addData("Right Encoder", rightTicks);
telemetry.addData("Center Encoder", centerTicks);
telemetry.update();
}
}
Calculating Robot Position from Encoders
Convert ticks to distance with wheel diameter and counts per revolution:
distance = (ticks / ticks_per_revolution) * wheel_circumference
Combine per-wheel distances in your odometry math to update X, Y, and heading. You can also calibrate inches per tick by driving a known distance and dividing by the tick change.
Sample Calculation Code
Example conversion to inches:
double TICKS_PER_REV = 8192; // Example for REV Through Bore Encoder
double WHEEL_DIAMETER_INCHES = 2.0;
double WHEEL_CIRCUMFERENCE = Math.PI * WHEEL_DIAMETER_INCHES;
int ticks = leftEncoder.getCurrentPosition();
double distanceInches = (ticks / TICKS_PER_REV) * WHEEL_CIRCUMFERENCE;
Troubleshooting Dead Wheel Odometry
If counts run backward, flip encoder direction in config or code. Binding, loose mounts, or debris on the wheel also produce jumps—spin each wheel by hand and watch telemetry before trusting auto.
Further Reading
Practice Exercise
Write code to read all three dead wheel encoders and display their values on telemetry. Then, calculate the distance traveled by each wheel in inches.
- Initialize three encoders in your op mode.
- Display their tick values on telemetry.
- Convert the tick values to inches and display those as well.