VEX V5 PYTHON | 06.1 TRACKING-WHEEL GEOMETRY

Guide objective

Choose a tracking-wheel layout, define signed mounting offsets and verify sensor geometry before estimating robot position.

01 | WHAT A TRACKING WHEEL MEASURES

A tracking wheel is an unpowered wheel that rolls on the floor and turns an encoder or Rotation Sensor. It measures motion along its rolling direction.

Because it is independent of the drive motor, it can observe movement that motor rotation alone may miss. It still depends on floor contact and can slip, bounce or lift.

Tracking wheels provide measurements for odometry. Odometry combines motion measurements over time to estimate robot position and heading. Mounting a wheel does not automatically create a field-position system.

02 | CHOOSE A LAYOUT

Choose measurements that match the movement you need to observe
LayoutMeasuresHeading source / limitation
One forward tracker + inertialForward travel and turningCannot directly measure sideways travel
One forward + one sideways tracker + inertialTwo body translation directions and turningRequires reliable inertial heading
Two parallel forward trackers + one sideways trackerForward, sideways and differential turningParallel wheel spacing supplies heading estimate

A forward tracker’s rolling direction is parallel to normal forward travel. A sideways tracker rolls left/right. These labels describe the direction measured, not where the wheel is mounted.

The three-wheel layout uses two separated parallel measurement lines. Two parallel trackers alone do not directly measure sideways motion.

03 | MOUNT FOR CONSISTENT CONTACT

  1. Use a free-rolling wheel and a low-friction shaft or bearing arrangement.
  2. Keep its measurement direction aligned with the intended robot axis.
  3. Maintain floor contact with a suitable compliant or spring-loaded mount.
  4. Allow enough suspension travel for normal floor variation without dragging.
  5. Protect the wheel and shaft from game objects and mechanism collisions.
  6. Route cables so suspension and steering do not pull them tight.

An omni wheel can roll normally along its measurement direction while its rollers accommodate crosswise movement. It must still grip well enough along the measured direction.

Too little contact pressure permits lift-off; excessive pressure adds drag and changes wheel compression. Check the mount with the robot’s normal load and mechanisms in their different positions.

04 | DEFINE A BODY FRAME BEFORE USING SIGNS

This guide uses +X to the robot’s right, +Y forward and positive rotation clockwise, viewed from above. The body axes rotate with the robot.

Select a fixed reference point on the chassis, usually a meaningful point near the drivetrain centre. Document its location precisely. The equations use offsets from this chosen point; it does not have to be the instantaneous centre of every turn.

Two perpendicular tracking wheels and signed offsetsTop view with forward upward and right to the right. Forward tracker is left of the reference; sideways tracker is behind it. Horizontal offset for the forward tracker and vertical offset for the sideways tracker are marked.+Y FORWARD+X RIGHTReference OFORWARD TRACKERxF = -120 mmyS = -100 mmSIDEWAYS TRACKERTop view; illustrative layout, not to scale
Measure perpendicular offsets from the selected robot reference point. Wheel rectangles indicate rolling direction.

A field frame remains fixed to the field. Body-frame movement must later be transformed into that field frame before updating field X/Y.

Other libraries may use forward X, left Y or anticlockwise-positive rotation. Their offset signs and equations can differ. Do not combine conventions without conversion.

05 | MEASURE THE PERPENDICULAR OFFSET

Measure to the wheel’s rolling measurement line
Tracker directionRelevant offsetExample
Forward / backwardSigned left/right distance xF from O120 mm left: xF = -120 mm
Right / leftSigned forward/back distance yS from O100 mm behind: yS = -100 mm

For a forward tracker, its fore/aft location does not change its ideal rotational component along the forward axis. Its left/right offset does.

For a sideways tracker, its left/right location does not change its ideal rotational component along the sideways axis. Its fore/aft offset does.

The relevant offset is perpendicular to the rolling direction. Measuring diagonally from the reference to the sensor housing gives the wrong value. Use the wheel contact line and actual rigid geometry.

06 | TURNING MAKES OFFSET WHEELS ROLL

During a turn about the selected reference point, an offset wheel follows an arc. Its sensor can report travel even when that reference point has no translation.

For clockwise angle change θ in radians and our declared axes:

Forward tracker: measured travel = centre forward travel - xF × θ.

Sideways tracker: measured travel = centre sideways travel + yS × θ.

Therefore remove the rotational components with:

centre_forward = measured_forward + forward_x_offset * theta_rad
centre_sideways = measured_sideways - side_y_offset * theta_rad

These are signed rolling-distance relations. For small sample intervals they provide local translation increments for later integration. They are not a complete finite-turn field displacement calculation.

07 | WORK THROUGH A PURE TURN

Use xF = -120 mm, yS = -100 mm and a clockwise 90-degree turn about O. Convert 90 degrees to π/2 radians, approximately 1.571.

The reference point stayed still; the offset wheels did not
Measurement / correctionCalculationResult
Forward wheel raw travel-(-120) × 1.571+188.5 mm
Sideways wheel raw travel(-100) × 1.571-157.1 mm
Corrected forward188.5 + (-120) × 1.571Approximately 0 mm
Corrected sideways-157.1 - (-100) × 1.571Approximately 0 mm

Using 90 directly instead of radians would exaggerate the correction by about 57.3 times.

During an actual turn the chosen point may also translate. Residual corrected movement is not automatically a sensor error. Test against a physically marked reference and a controlled rotation.

08 | GEOMETRY WITH TWO PARALLEL TRACKERS

For forward trackers at signed offsets xL and xR, with xR greater than xL:

# Signed measured wheel travel in mm; clockwise theta in radians.
theta = (left_travel - right_travel) / (right_x - left_x)
centre_forward = left_travel + left_x * theta
# Equivalent check:
centre_forward_check = right_travel + right_x * theta

For symmetric offsets -120 and +120 mm, the separation is 240 mm. A clockwise pure turn gives positive travel on the left and negative travel on the right.

This is tracking-wheel separation, not automatically the drive wheel track width. Measure the actual parallel tracking lines.

Wheel slip and calibration differences affect the inferred angle. An inertial sensor can provide an independent comparison; deciding how to combine them belongs to later odometry work.

09 | SENSOR DIRECTION AND DISTANCE SCALE

Use multi-turn position() readings and signed changes between samples. Do not use a single-turn angle that wraps every revolution for accumulated wheel travel.

Set the forward sensor sign so pushing straight forward increases position. Set the sideways sensor sign so a controlled rightward displacement increases position.

For direct coupling, wheel turns per sensor turn is 1. If gearing separates the wheel and sensor, measure the ratio explicitly.

Wheel travel = sensor turn change × wheel turns per sensor turn × π × effective diameter. Nominal wheel size is a starting estimate; the next guide calibrates the scale.

10 | TWO-WHEEL SENSOR-ONLY DIAGNOSTIC

The example uses forward and sideways Rotation Sensors on Smart Ports 17 and 18, and an inertial sensor on 20. It contains no motor commands.

Paste below # Begin project code, retaining generated VEX imports and Brain setup above it. Measure offsets and verify directions before setting GEOMETRY_CONFIGURED true. Use sensor reversal flags appropriate to your mounting.

# =============================================================================
# TEAM [MY TEAM NAME / NUMBER] | TWO-WHEEL GEOMETRY DIAGNOSTIC
# =============================================================================
# Keep generated VEX imports and brain above '# Begin project code'.
# Manual declarations: do not also create these names in Devices.
# Forward tracker: Rotation Sensor port 17, positive for robot forward.
# Sideways tracker: Rotation Sensor port 18, positive for robot right.
# Inertial: port 20; verified clockwise-positive accumulated rotation.
# NO MOTOR COMMANDS. Manually move the supported robot on the floor.
import math
forward_tracker = Rotation(Ports.PORT17, False)
side_tracker = Rotation(Ports.PORT18, False)
inertial = Inertial(Ports.PORT20)

GEOMETRY_CONFIGURED = False
FORWARD_DIAMETER_MM = 69.85       # Example 2.75-inch nominal wheel
SIDE_DIAMETER_MM = 69.85          # Calibrate effective diameter later
FORWARD_WHEEL_TURNS_PER_SENSOR_TURN = 1.0
SIDE_WHEEL_TURNS_PER_SENSOR_TURN = 1.0
FORWARD_X_MM = -120.0            # Forward wheel is left of reference
SIDE_Y_MM = -100.0               # Sideways wheel is behind reference
POLL_MS = 50

# =============================================================================
# BODY FRAME: +X RIGHT, +Y FORWARD, +THETA CLOCKWISE
# =============================================================================
def turns_to_mm(delta_turns, diameter, ratio):
    return delta_turns * math.pi * diameter * ratio

def remove_rotation(forward_mm, sideways_mm, theta_rad,
                    forward_x_mm, side_y_mm):
    forward_centre = forward_mm + forward_x_mm * theta_rad
    sideways_centre = sideways_mm - side_y_mm * theta_rad
    return forward_centre, sideways_centre

# =============================================================================
# DIAGNOSTIC ONLY: PER-INTERVAL VALUES, NOT GLOBAL FIELD X/Y
# =============================================================================
if not GEOMETRY_CONFIGURED:
    print("Measure geometry and verify sensor directions first.")
else:
    # Keep the robot still. This setup call may block.
    inertial.calibrate()
    previous_f = forward_tracker.position(TURNS)
    previous_s = side_tracker.position(TURNS)
    previous_rotation = inertial.rotation(DEGREES)
    print("raw_forward_mm,raw_side_mm,clockwise_deg,centre_forward_mm,centre_side_mm")
    while True:
        if not inertial.installed() or inertial.is_calibrating():
            print("Inertial unavailable; stop diagnostic.")
            break
        try:
            f = forward_tracker.position(TURNS)
            s = side_tracker.position(TURNS)
            rotation = inertial.rotation(DEGREES)
            if not all(math.isfinite(v) for v in (f, s, rotation)):
                print("Invalid feedback; stop diagnostic.")
                break
            forward_mm = turns_to_mm(f - previous_f, FORWARD_DIAMETER_MM,
                                    FORWARD_WHEEL_TURNS_PER_SENSOR_TURN)
            side_mm = turns_to_mm(s - previous_s, SIDE_DIAMETER_MM,
                                 SIDE_WHEEL_TURNS_PER_SENSOR_TURN)
            delta_deg = rotation - previous_rotation
            theta = math.radians(delta_deg)
            centre_f, centre_s = remove_rotation(
                forward_mm, side_mm, theta, FORWARD_X_MM, SIDE_Y_MM)
            print("%.2f,%.2f,%.2f,%.2f,%.2f" %
                  (forward_mm, side_mm, delta_deg, centre_f, centre_s))
            previous_f, previous_s, previous_rotation = f, s, rotation
        except Exception:
            print("Sensor read failed; stop diagnostic.")
            break
        wait(POLL_MS, MSEC)

The output reports each sample interval, not cumulative field position. It removes rotation using accumulated inertial rotation changes, then prints corrected local travel.

Separate sensor reads are not an atomic snapshot. Keep diagnostic movement slow; later production odometry needs appropriate sampling, timing checks and consistent sensor updates.

For a non-holonomic drive, do not force it sideways against its tyres. Verify sideways sensor sign by rolling that wheel directly with the robot supported, then test floor behaviour through permitted movement.

11 | CHECK THE GEOMETRY BEFORE ODOMETRY

Record physical motion, raw sensors and corrected increments
TestExpected pattern
Straight forward / reverseForward sign changes; sideways reading small if aligned
Sideways wheel sign checkRightward rolling corresponds to positive reading
Controlled rotation about ORaw readings match signed rotational components
Clockwise then anticlockwiseRotational terms reverse sign
Repeat with normal loadContact and scale remain reasonably consistent
Move mechanisms through rangeMount and cable clearance remain valid

Compare repeated trials. A reversed sign is a configuration problem, while a systematic scale error suggests diameter or gearing. Variable residuals suggest contact, slip, flex or inconsistent rotation geometry.

Mark offsets on a robot diagram and remeasure them after changing the chassis or tracking-wheel mount.

12 | WHAT THIS SETUP DOES NOT SOLVE

Tracking wheels do not guarantee drift-free field position. Contact loss, wheel compression, slip and sensor errors accumulate over time.

The correction formulas separate rotational rolling from local translation. Integrating translation into field X/Y requires a heading transformation and appropriate treatment of finite arcs. Simply adding every local forward increment to field Y is wrong after the robot turns.

Good mounting and a shared coordinate convention come before advanced algorithms. Keep raw measurements available so later odometry errors can be traced back to the hardware.

CHALLENGES | MOUNT, MEASURE AND EXPLAIN

  1. Choose: justify a one-, two- or three-wheel layout for your robot.
  2. Draw: label O, body axes, rolling directions and signed offsets.
  3. Measure: record perpendicular offsets rather than diagonal sensor distances.
  4. Calculate: predict raw travel for a clockwise 45-degree pure turn.
  5. Verify: document forward and sideways sensor signs.
  6. Test: compare raw and corrected increments across three controlled trials.
  7. Diagnose: explain a possible cause of residual translation during a turn.
  8. Distinguish: explain why corrected local increments are not yet global field coordinates.
Success evidence

A labelled mounting diagram, offset measurements, signed calculations and diagnostic log. Record which assumptions were verified and which calibration or odometry steps remain.

OFFICIAL AND TECHNICAL REFERENCES

Check coordinate conventions when comparing references. The diagram, signed examples and diagnostic are independently written learning material. VEX and VEXcode are trademarks of their respective owners.