EncodersNEORACER DOCS
NEORACER DOCS
These docs are public and open source.Edit on GitHub
HARDWARE / SENSORS

MOTOR-SHAFT ENCODERS.

Quadrature motor-shaft encoders sit on the drivetrain and report how far each wheel has turned. The MCU (microcontroller unit) reads them per wheel and integrates the counts into a velocity estimate, which it publishes on /odom. That is the car telling you, between LiDAR scans, how far and how fast it has travelled.

Dead reckoning between scansQuadrature A/BPer-wheel readMCU integrated/odom · nav_msgs/Odometry
01 / WHY QUADRATURE

QUADRATURE ENCODING.

A single-channel encoder only counts ticks, so it can tell you the wheel moved but not which way. Quadrature uses two channels (A and B) that are physically offset, and the order in which their edges arrive recovers direction as well as speed. That is what lets the odometry distinguish rolling forward from rolling backward, which matters the moment the car reverses out of a wall.

02 / TICKS TO ODOMETRY

FROM COUNTS TO /odom.

01

Read per wheel

Each wheel has its own count, sampled on the MCU.
The MCU watches the A/B edges from each motor shaft and keeps a running tick count per wheel. Reading the wheels separately is what makes left-versus-right motion observable, not just the average speed of the car.
02

Integrated to velocity

The MCU turns the change in counts into a speed.
Between samples the MCU looks at how many ticks each wheel gained, divides by the time elapsed, and forms a velocity estimate. That estimate is the useful product, the raw counts mostly stay on the microcontroller.
03

Published on /odom

The estimate leaves the car as nav_msgs/Odometry.
The velocity estimate is wrapped in a standard nav_msgs/Odometry message and published on /odom, where the rest of the stack can subscribe to it the same way it subscribes to any other topic.
03 / RESOLUTION TRADEOFF

THE RESOLUTION TRADEOFF.

Counts per revolution (CPR) is the knob that sets how finely the encoder resolves motion. A higher CPR means each tick covers a smaller slice of wheel travel, so the odometry is finer. The cost is that every edge is an interrupt the MCU has to service, so a higher count puts more load on the microcontroller. The two pull against each other, which is the tension worth keeping in mind when you read an odometry value and wonder how precise it really is.

04 / WHY THE STACK CARES

FUSION WITH LiDAR.

On its own, odometry drifts. Run long enough and the dead-reckoning position wanders away from the truth. That is fine, because the osracer SLAM and Nav2 stack does not trust it alone. It fuses the odometry from /odom with the LiDAR scans, using the encoders to fill in the motion between scans and the LiDAR to correct the drift. Together they let the car map and localise, which neither signal does well by itself.

  • Encoders give continuous, high-rate motion between LiDAR frames.
  • LiDAR gives absolute structure that pins the drift back down.
  • The /odom topic is where the fused estimate starts, listed alongside every other ROS 2 topic.
05 / AT A GLANCE

SPECIFICATIONS.

FieldValue
Encoder typeQuadrature (A/B channels)
ReadPer wheel
IntegrationMCU (microcontroller unit)
Topic/odom
Messagenav_msgs/Odometry