Dead Wheel Encoders
What are Dead Wheels?
Dead wheels are unpowered, free-spinning wheels equipped with encoders. Unlike drive wheels, they are not affected by slippage from driving the robot, making them ideal for accurate position tracking in FTC robots.
Advantages of Dead Wheel Encoders
Using dead wheels for odometry greatly improves accuracy because they are isolated from drivetrain forces. This reduces errors from wheel slip and provides more reliable encoder readings for autonomous navigation.
Hardware Setup and Placement
Dead wheels are typically mounted on the robot chassis in parallel and perpendicular orientations. Proper placement is crucial for accurate tracking.
Reading Encoder Values in Android Studio
// 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
To convert encoder ticks to robot position, you need to know the wheel diameter, encoder resolution, and the distance between wheels. The basic formula is:
By combining the distances from each wheel, you can estimate the robot's X, Y, and heading.
You can also determine the inches/tick ratio manually by moving your robot forward/laterally and dividing the distance traveled by the number of ticks recorded.
distance = (ticks / ticks_per_revolution) * wheel_circumferenceBy combining the distances from each wheel, you can estimate the robot's X, Y, and heading.
You can also determine the inches/tick ratio manually by moving your robot forward/laterally and dividing the distance traveled by the number of ticks recorded.
Sample Calculation Code
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
Common issues include incorrect encoder direction, mechanical binding, or misalignment. Always verify encoder readings and check for smooth wheel rotation.
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.