[Robot Hardware 05] - Actuators (4): Torque Ripple
How PWM, current sampling, d–q axes, and encoder electrical-angle error become torque ripple
Suppose a high-level controller commands 5 Nm. In an ideal simulator, joint torque is described by one line:
The real motor drive does something very different. It converts the torque command into a q-axis current reference, synthesizes voltage by switching the three-phase inverter on and off, and measures the current at a few short time windows in between. It projects that current onto the d–q axes using the rotor angle reported by the encoder, then calculates the voltage for the next PWM cycle.
In other words, the fact that the controller sent a constant number does not mean that constant electromagnetic torque was produced. Periodic errors synchronized with rotor position, switching state, and sampling time exist between the two. This is the torque ripple discussed in this post.
The QDD actuator from the previous post is designed to transmit motor torque to the output shaft relatively transparently through a low reduction ratio and low friction. But high mechanical transparency also means that errors from the motor and driver can reach the output shaft more directly. In a high-ratio transmission, small motor torque ripple may be partly hidden by transmission friction and elasticity. In a system like QDD that targets current-based torque control and low output impedance, electrical-angle error, current-measurement error, and inverter nonlinearity can be observed more directly in joint torque and contact force.
Separating torque ripple from low-repeatability noise, the actual electromagnetic torque can be represented conceptually as
\[\tau_e(t)=\bar{\tau}_e+\tau_{\mathrm{position}}(\theta_e) +\tau_{\mathrm{switch}}(t) +\tau_{\mathrm{estimation}}(\theta_e,t)+n_\tau(t)\]The first three variation terms are synchronized with position, switching state, or estimation error and repeat similarly when the same state is traversed. $n_\tau(t)$ instead represents low-repeatability sensor, quantization, and environmental noise.
First Separate What Kind of Ripple It Is
Seeing joint torque fluctuate in an experiment does not mean there is only one cause. At least five layers should be distinguished.
-
Torque that exists even without current
Cogging torque occurs because the magnetic reluctance between a slotted stator and permanent magnets changes with rotor position. It is one source of the periodic sticking felt when the current command is zero and the rotor is turned slowly by hand. Slot count, pole count, magnet shape, and skew determine its period.[1]
-
Spatial harmonics of electromagnetic torque produced by current
If winding distribution and back-EMF are not perfectly sinusoidal, or if magnetic materials saturate, torque can vary with rotor position even when average q-axis current is constant. This is close to an error inherent in the motor’s electromagnetic geometry.
-
PWM switching ripple
PWM creates average voltage by switching a finite DC bus rather than applying continuous voltage. Because PWM frequency is finite, voltage and current ripple appears around the switching frequency and its multiples.
-
Low-order harmonics caused by inverter nonlinearity
Dead time, voltage drop across power devices, and turn-on/off asymmetry make actual phase voltage differ from the command. This error can create not only high-frequency components near the carrier, but also low-order current and torque harmonics such as 5th and 7th current harmonics in the stationary frame and a repeating 6th-order component in the rotor frame.[4,5]
-
False q-axis current caused by sensing and coordinate transformation
Current-sensor offset, gain, and bandwidth errors, together with encoder electrical-angle error, mix the d and q axes. The controller believes that
i_qis constant, but the actual rotor frame may contain a different current vector.[2,3]
These phenomena can overlap in the measured torque spectrum. It is therefore difficult to make a design decision from “what percentage is the torque ripple?” alone. Check whether the component remains with zero current, whether it is synchronized with rotor position, whether it moves with electrical frequency, and whether it follows PWM frequency or its alias.
The d and q Axes Are Not Physical Axes; They Are the Coordinate Frame We Trust
FOC (Field-Oriented Control) transforms three-phase current into a coordinate frame rotating with the rotor flux. The d-axis is aligned with the permanent-magnet flux and the q-axis is orthogonal to it.[8] For an ideal SPMSM, torque can be written as
\[\tau_e=\frac{3}{2}p\lambda_m i_q\]Here, $p$ is the number of pole pairs and $\lambda_m$ is permanent-magnet flux linkage. An IPMSM also has reluctance torque:
\[\tau_e=\frac{3}{2}p \left[ \lambda_m i_q+(L_d-L_q)i_di_q \right]\]The command i_d=0, i_q=constant is therefore a powerful approximation. The problem is that this coordinate frame is built from the angle reported by the encoder. If the encoder zero is wrong, or if mounting eccentricity, magnet-ring pole-pitch error, or interpolation error exists, the q-axis believed by the controller is misaligned with the actual q-axis.[2,3]
Let the control-frame electrical-angle error be $\Delta\theta_e$, and suppose the controller produces $\hat i_d=0$ and $\hat i_q=I$. With one sign convention, the actual axes approximately see
\[i_d\approx I\sin\Delta\theta_e,\qquad i_q\approx I\cos\Delta\theta_e\]A constant angle offset reduces average torque and creates unwanted d-axis current. A position-dependent angle error is worse. If $\Delta\theta_e$ changes periodically with the rotor, q-axis current and torque also change periodically. Electrical angle advances $p$ times faster than mechanical angle:
\[\Delta\theta_e=p\,\Delta\theta_m\]In a high-pole-count pancake motor, a small mechanical-angle error can therefore become a substantial electrical-angle error. This is why “we installed a high-resolution encoder” does not solve the problem by itself. Check absolute accuracy, eccentricity, zero calibration, and delay separately from resolution.
Sensor and computation delay should also be distinguished from a fixed angle offset. If total delay is $T_d$ and electrical angular velocity is $\omega_e$, the angle error caused by delay is approximately
\[\Delta\theta_{e,\mathrm{delay}}\approx\omega_eT_d\]Thus, even with the same sensor and computation delay, the angle used for the d–q transform falls further behind as speed increases. For a small angle error, $\sin\Delta\theta_e\approx\Delta\theta_e$ and $\cos\Delta\theta_e\approx1-\Delta\theta_e^2/2$. Unwanted $i_d$ therefore grows to first order with the error, while average torque reduction begins at second order.
When Should Current Be Read Between PWM Edges?
Winding current changes continuously because of inductance, but the digital controller sees a sample at a particular instant. If that instant is chosen poorly, the measured value is wrong even when the sensor itself is working correctly.
Near a MOSFET switching edge, large $dv/dt$ and $di/dt$ occur. Common-mode transients, diode reverse recovery, ringing, and amplifier settling overlap the small differential voltage across the shunt resistor. If the sample is taken immediately after a gate transition, the control loop interprets this transient response as an actual phase-current change.[4,5]
A practical sampling window must satisfy three conditions:
- Blanking time and amplifier settling time after the switching edge must be over.
- The phase current must actually flow through the shunt being measured.
- There must be enough time before the next switching edge for ADC acquisition and conversion to finish.
With center-aligned PWM, it is easy to place the ADC trigger in a relatively quiet region away from switching edges. The valid sample location still depends on current-sensor placement and the active switching vector. With low-side shunts and a single DC-link shunt, a phase current is not necessarily observable merely because the sample is at the center of the PWM period. As duty cycle approaches 0% or 100%, the valid conduction window also becomes short.
The Unobservable Window Depends on Shunt Count
A 3-low-side-shunt structure places one shunt at the bottom of each inverter leg. In a window where measurable current flows through the corresponding low-side switch, two or more phases are read and the remaining phase is reconstructed from $i_a+i_b+i_c=0$. Observability is good, but the number of amplifiers, ADC channels, and calibration targets increases.
A 2-low-side-shunt structure directly reads two inverter-leg currents and reconstructs the third phase current. For some duty combinations, one measurement window becomes narrow, so the PWM pattern and sample timing must be designed together.
A single DC-link shunt is the most difficult. One DC-link current is used to reconstruct phase currents from the current switching vector. Two independent active vectors must remain valid for at least the minimum time that includes amplifier rise and settling, ADC sample-and-hold time, and dead time. At low modulation, near sector boundaries, or with very short pulses, unobservable regions appear and require pulse shifting or estimation from previous samples.[6]
A 3-inline-sensor structure measures the current directly in each motor phase. Its observability constraints from switching state are relatively small, but the sensors and amplifiers must tolerate high common-mode voltage, fast PWM transients, and isolation requirements.
| Current measurement | Advantage | Hidden failure mode |
|---|---|---|
| 3 low-side shunts | Wide observation window and easy diagnostics | Channel offset, gain, and delay mismatch |
| 2 low-side shunts | Trade-off between cost and observability | One phase’s window disappears at some duty cycles |
| 1 DC-link shunt | Minimum sensor and ADC cost | Unobservable intervals depend on switching vector |
| 3 inline sensors | Direct measurement of each phase current | High common-mode voltage and PWM-transient requirements |
Running sampling asynchronously from PWM introduces a subtler problem. If sampling frequency is $f_s$ and the actual ripple frequency is $f_r$, the observed alias is approximately the value produced by the integer $k$ that minimizes
\[f_{\mathrm{alias}}=\left|f_r-kf_s\right|\]When PWM ripple is close to an integer multiple of the observation or control sampling frequency, a phenomenon that is actually tens of kilohertz can appear as a slow torque fluctuation of a few hertz or tens of hertz. ADC sampling synchronized with PWM therefore does more than reduce aliasing: it also measures at a similar ripple phase, increasing observation repeatability.
A Fast Current Loop Does Not Mean the Same Torque Bandwidth
Saying that the FOC current-loop bandwidth is high means that measured current follows its reference quickly. It does not automatically guarantee that:
- measured current is the same as actual current
- electrical angle is aligned with the actual flux axis
- flux linkage and $K_t$ are constant
- the structure and reducer transmit the torque unchanged
Position-synchronized components of torque ripple move to higher temporal frequency as motor speed increases. When the robot joint moves slowly, they move down into the force-control bandwidth. While a foot presses against the ground or a hand pushes an object, a small periodic torque can appear directly as contact-force ripple.
A reducer is not a filter that eliminates ripple. If actual torque transmission is represented by a transfer function rather than a constant efficiency,
\[\tau_{\mathrm{out}}(s)=N H_g(s)\tau_m(s)\]$H_g(s)$ includes reducer stiffness, damping, friction, and load dynamics. At low frequency, it may be approximated as $H_g\approx\eta_g$, but near a mechanical resonance, ripple may not be sufficiently attenuated and can even be amplified.
The temporal frequency of a particular torque variation is the same at the input and output of the reducer. Compared at a fixed joint speed, however, the motor rotates $N$ times faster than the joint, so a motor-position-synchronized ripple has $N$ times the temporal frequency of the direct-drive case. If joint angle is used as the independent variable, the same component repeats $N$ times more per joint revolution and appears spatially denser.
What Should Be Measured to Separate the Causes?
Rather than looking at one torque-sensor waveform, it is better to combine the following experiments in order:
- Use zero-current, low-speed backdrive to measure the position dependence of cogging and transmission friction.
- In a low-speed constant-current rotation test, rotate the motor very slowly at constant $i_q$ and record torque against mechanical and electrical angle.
- Use a locked-rotor commutation-angle sweep: hold the rotor at a particular mechanical angle, vary the electrical angle of the applied current vector, and measure the torque–current-angle relationship and electrical zero. Because a large current applied for too long heats the motor quickly, use short pulses and current limits.
- Record raw current ADC values, reconstructed phase current,
id/iq, raw encoder angle, PWM sector, and duty cycle on the same clock. - Use synchronous averaging with electrical angle instead of mechanical angle to separate repeating components.
- Compare the encoder with an independent high-precision angular reference, build a harmonic map, and verify electrical zero for different loads and directions.
- Change only the PWM frequency or ADC-trigger location and see whether the ripple moves. If it moves, suspect the switching or measurement path before the motor’s electromagnetic geometry.
Repeating errors can also be compensated. Cogging maps, encoder-error maps, dead-time compensation, and iterative learning control are representative methods.[7] But assuming that one lookup table covers every operating point creates another problem: the error map itself can change with saturation, DC-bus voltage, temperature, and load.
What Physical AI Sees Is Not “Torque Noise”
If Gaussian noise is added to a torque command in a simulator, the error at each step is independent. Real torque ripple is not.
- Similar error repeats when the rotor passes the same position.
- The temporal frequency moves with speed.
- The sign of dead-time and friction error changes when direction reverses.
- The alias pattern changes when the relationship between PWM and the observation clock changes.
- The amplitude at the same position changes with temperature and bus voltage.
The model needed for sim-to-real is therefore closer to a periodic error with electrical angle as a state plus the sampling process than to a single torque standard deviation. It is not necessary to simulate every switch, but at minimum position-synchronized ripple, angle offset or drift, current-loop delay, and saturation should be represented as separate terms.
A minimal actuator model for simulation can be written as
\[\tau_{\mathrm{actual}}= \operatorname{sat}\!\left( K_t(T)i_q(t-T_d)+r(\theta_e,I,T,V_{\mathrm{dc}}) \right)\]$T_d$ is current-loop and computation delay, $K_t(T)$ is a torque constant that may change with temperature, and $r(\theta_e,I,T,V_{\mathrm{dc}})$ is a repeating error that depends on position, current, temperature, and bus voltage. $\operatorname{sat}$ represents current and voltage limits. This model expresses the state dependence and repeatability of a real actuator more directly than simply adding one Gaussian-noise term.
FOC is an excellent control structure. But the existence of FOC is not the same as having an ideal torque source. A torque command becomes a physical quantity only when the direction we call the q-axis, the current we believe we measured, and the sampling instant that combines them are all correct.
Next post: [Robot Hardware 06] - Actuators (5): Backlash
References
[1] Z. Q. Zhu and D. Howe, “Influence of Design Parameters on Cogging Torque in Permanent Magnet Machines,” IEEE Transactions on Energy Conversion, vol. 15, no. 4, pp. 407–412, 2000. doi:10.1109/60.900501
[2] R. Raja, T. Sebastian, M. Wang, A. Gebregergis, and M. S. Islam, “Effect of Position Sensor Error on the Performance of Permanent Magnet Machine Drives,” IEEE Transactions on Industry Applications, vol. 53, no. 6, pp. 5518–5526, 2017. doi:10.1109/TIA.2017.2704898
[3] M. Pramod, “Position Sensing Errors in Synchronous Motor Drives,” arXiv:2310.00977, 2023. arXiv
[4] Texas Instruments, “48-V Three-Phase Inverter With Shunt-Based In-Line Motor Phase Current Sensing,” TIDUCE8A. PDF
[5] Texas Instruments, “Current Sensing With <1-µs Settling for 1-, 2-, and 3-Shunt FOC Inverter,” TIDUCY7. PDF
[6] Texas Instruments, “Sensorless-FOC for PMSM With Single DC-Link Shunt,” SPRACT7. PDF
[7] W. Qian, S. K. Panda, and J.-X. Xu, “Torque Ripple Minimization in PM Synchronous Motors Using Iterative Learning Control,” IEEE Transactions on Power Electronics, vol. 19, no. 2, pp. 272–279, 2004. doi:10.1109/TPEL.2003.820537
[8] Texas Instruments, “Sensored Field Oriented Control of 3-Phase Permanent Magnet Synchronous Motors Using TMS320F2837x,” SPRABZ0. PDF