| title | ERPM Gain Calculation and Calibration Guide | |||||
|---|---|---|---|---|---|---|
| author | hyeongjoon-yang | |||||
| date | 2026-02-03 01:12:52 +0900 | |||||
| categories |
|
|||||
| tags |
|
|||||
| image |
|
|||||
| lang | en | |||||
| lang_ref | erpm-gain-calibration | |||||
| math | true |
When controlling a motor by speed rather than throttle, it is critical to find the proportional constant that maps user commands to the actual hardware setup. This constant affects odometry drift, and a wrong value can lead to control errors and accidents. This post summarizes the ERPM gain concept, theoretical calculation, and practical calibration.
VESC converts a speed command (m/s) into ERPM (Electrical RPM) and sends it to the motor. ERPM is the motor's RPM multiplied by the number of pole pairs.
The speed–ERPM relationship can be expressed with a gain and offset:
VESC ROS packages use this relationship to convert speed commands into ERPM.
ERPM gain depends on hardware. Key factors include:
- Motor pole pairs: ERPM equals RPM multiplied by pole pairs. For example, the Traxxas Velineon 3500 is a 4‑pole motor, so pole pairs = 2.
- Gear ratio: The final ratio from pinion–spur and differential–shaft gears. Example for Traxxas Fiesta: 12:83 and 13:37.
- Wheel radius: Measure directly or check manufacturer specs. For Traxxas Fiesta, wheel diameter is ~10 cm, so radius is 0.05 m.
We calculate the theoretical ERPM gain for a Traxxas Fiesta with a Velineon motor.
| Item | Value |
|---|---|
| Motor | Traxxas Velineon 3500 (4‑pole) |
| Pole pairs | 2 |
| Pinion–spur ratio | 12 : 83 |
| Diff–shaft ratio | 13 : 37 |
| Wheel diameter | 10 cm |
| Wheel radius | 0.05 m |
The final gear ratio is the product of the pinion–spur ratio and the diff–shaft ratio.
Plugging in the values gives a theoretical speed_to_erpm_gain of ~7520 for the Traxxas Fiesta + Velineon setup. Update the value in vesc.yaml accordingly.
If the exact hardware specs are unknown or theoretical calculation is difficult, you can estimate ERPM gain experimentally.
This is the most direct and accurate method.
What you need
- A high‑speed camera (phone slow‑motion works)
- A marker on the tire (tape, etc.)
Steps
- Place a rotation marker on the tire.
- Command a constant speed. (PID tuning is required to hold steady speed.)
- Measure the time for one full rotation using the high‑speed video.
- Compute the actual speed from rotation time and wheel circumference.
Calculation example
| Item | Value |
|---|---|
| Commanded speed | 1.0 m/s |
| Time for 1 rotation | 0.25 sec |
| Wheel circumference | 0.314m (radius 0.05m) |
| Actual speed | 0.314 / 0.25 = 1.256 m/s |
In this case, the actual speed (1.256 m/s) is higher than the commanded speed (1.0 m/s), so the gain should be decreased.
Adjusting gain
- If actual speed is higher than commanded, decrease the gain.
- If actual speed is lower, increase the gain.
This method uses ROS odometry.
What you need
- Tape measure or distance marker
- Start‑line tape
- A vehicle with servo offset tuning done
Steps
- Mark the start position.
- Reset or record
/vesc/odomposition to zero. - Drive straight for a fixed distance (e.g., 5 m) at low speed.
- Compare the actual distance with the
/vesc/odomdistance.
Calibration formula $$ \text{new_gain} = \text{old_gain} \times \frac{\text{odom_distance}}{\text{actual_distance}} $$
For example, if old gain is 7520 and odom shows 5.5 m while the actual distance is 5 m:
Repeat until odom distance matches the actual distance.
ERPM gain calibration is fundamental for accurate speed control and odometry in autonomous vehicles. If calibration is off, odometry drift can accumulate and cause localization failures and other accidents. Take the time to measure carefully and tune the gain precisely.
