M4.ripple
Rotor ripple map
- Family
- grey box
- Rung
- M4: the drivetrain: rotor ripple, backlash, compliance
- Category
- Actuator
- Since
- robotparts/2.3 (robotparts/2.3 kind
ripple_map) - Fits
- 0
- Definition
- model.json · sha256
426b7ff1b64c6c9c3f21c8fafd4ba209e1b23c8423f6d35782e20189d31e1b6e(a fit binds it by this sha256) - Kept versions
- none: no fit binds an earlier model.json
What it is
Coulomb + viscous + rotor-keyed ripple. Cogging and commutation ripple as rotor-periodic torque harmonics at the output (the torque_ripple records in one map), optionally with Coulomb and viscous friction.
Equation
tau_r = sum_k amplitude_k*sin(rotor_harmonic_k*theta_rotor + phase_k), theta_rotor = gear_ratio*theta_output in rad from the rotor zero the simulator uses (tau_r adds coulomb_friction*sign(v) + viscous_friction*v when stated)
Terms
Every term a fit of M4.ripple may state: 1 required, 3 optional. Click a term for its definition and how it is measured.
| Term | Required | Unit (SI) | Units a fit may use | Bounds | Measured by | Definition |
|---|---|---|---|---|---|---|
harmonics | yes | N·m | N·m, mN·m | — | a rotor-angle sweep (the plateaus, if they cover more than one rotor turn) | The ripple harmonics: a list of {rotor_harmonic, amplitude, phase}, rotor_harmonic in cycles per rotor turn (an integer >= 1, each once), amplitude in the term's unit (>= 0, the torque at the output), phase in rad. |
coulomb_friction | no | N·m | N·m, mN·m | — | velocity plateaus, both directions, 6-8 speeds, each at least one rotor turn | Coulomb friction torque at the output: the constant torque that opposes motion (MuJoCo frictionloss; robot.json frictionloss_nm, from a scope-part value only). |
viscous_friction | no | N·m·s/rad | N·m·s/rad, mN·m·s/rad | — | velocity plateaus, both directions, 6-8 speeds, each at least one rotor turn | Viscous friction coefficient at the output (MuJoCo damping). |
output_inertia | no | kg·m² | kg·m², kg·cm², kg·mm², g·cm², g·mm² | — | chirps (or the datasheet) | The part's own moment of inertia about its joint axis, referred to the OUTPUT: for a geared part its reflected inertia, MuJoCo's armature. A datasheet value or a scope-part measurement only. A joint's inertia together with whatever it drives belongs to the assembly, not the part, and robotparts does not publish it. |
Inputs, state and output
What a backend feeds the model each step, what it carries between steps, and what it returns.
| Signal | Unit | What it is |
|---|---|---|
input v | rad/s | The output's angular speed. |
input theta_rotor | rad | The rotor's angle, gear_ratio times the output angle from the rotor zero the simulator uses. |
output tau_r | N·m | The resisting torque at the output: what the motor must add to move the output as the inputs say. The joint feels -tau_r (a resisting torque opposes motion; ripple pushes and pulls with angle). |
Backends
| Backend | How | Engine | Implementation | Note |
|---|---|---|---|---|
python | reference | — | model.py · sha256 e30eb5e3ed7c4ae09b06fc448e31e52c81e5a4cad9bd3e9d0e61b504c6d0395c | The contract's own ruler: stdlib Python, torque(terms, inputs, state, dt) -> (tau_r, state), terms in SI. |
js | reference | — | model.js · sha256 31f08577ba8ccdf3c12dd8bbe672a67ac870e94b1ccb6fc348fc64cb0640ddba | The same equation as model.py as an ES module (torque(terms, inputs, state, dt) -> {tau, state}); tests/acceptance_v2/test_amendment_2_5.py holds the two to 1e-12. |
mujoco | plugin | mujoco | — | Friction natively; the plugin applies the ripple from the rotor angle each step. Maps: armature = output_inertia, frictionloss = coulomb_friction, damping = viscous_friction. Settings a fit may give: friction_solref (number-list of 2): The joint's solreffriction (timeconst, dampratio): how hard frictionloss sticks; MuJoCo's soft default creeps below about 0.4 rad/s on a light hinge; friction_solimp (number-list of 5, > 0): The joint's solimpfriction (dmin, dmax, width, midpoint, power), every entry > 0. |
reference: a file in this folder, torque(terms, inputs, state, dt) with terms in SI (the contract's own ruler; model.py and model.js agree to 1e-12), linked by its content at /v2/models/by-sha256/, the bytes a fit pins. native: the engine alone. plugin: robotparts' MuJoCo plugin runs the python reference each step. external: code outside robotparts, which a fit pins.
Validity
| Dim | Unit | What a fit states its range over |
|---|---|---|
output_speed | rad/s | |v|, the output speed the terms were fitted or checked across. |
Assumptions
- The ripple is periodic in the rotor angle and the same in both directions (cogging); direction-dependent ripple is not modelled.
- The harmonics hold wherever the joint goes, because the magnets turn with the rotor.
Fits of this model
No part hosts a fit of it yet.
Source
robotparts has no GitHub repository to link: the source of M4.ripple is these published files, the folder models/actuator/ripple/ of robotparts release 2026.12.01.1, served byte for byte under /v2/models/actuator/ripple/ (no listing there: each file below is its link). Each sha256 is the file's own; a fit's reference backend pins the same one.
| File | Bytes | sha256 |
|---|---|---|
| README.md | 4,089 | de559c03e6c7dbe2ca3eeb2ec07e5ed0ce1b68b5bd246cadc2ee46ff374bb3af |
| model.js | 811 | 31f08577ba8ccdf3c12dd8bbe672a67ac870e94b1ccb6fc348fc64cb0640ddba |
| model.json | 4,541 | 426b7ff1b64c6c9c3f21c8fafd4ba209e1b23c8423f6d35782e20189d31e1b6e |
| model.py | 1,372 | e30eb5e3ed7c4ae09b06fc448e31e52c81e5a4cad9bd3e9d0e61b504c6d0395c |
README
M4.ripple — Rotor ripple map
Coulomb + viscous + rotor-keyed ripple. Family: grey box. Rung: 4, the drivetrain (ripple, backlash, compliance). Category: actuator.
Cogging and commutation ripple: a torque that repeats with the rotor's angle, written as harmonics, plus optional Coulomb and viscous friction. Because the magnets and windings turn with the rotor, a map in rotor angle holds wherever the joint goes.
When to use it. Use it when position holds and slow moves show a periodic error; one rotor-angle sweep fits it.
Equation
tau_r = sum_k amplitude_k*sin(rotor_harmonic_k*theta_rotor + phase_k), theta_rotor = gear_ratio*theta_output in rad from the rotor zero the simulator uses (tau_r adds coulomb_friction*sign(v) + viscous_friction*v when stated)
Output tau_r (N·m): The resisting torque at the output: what the motor must add to move the output as the inputs say. The joint feels -tau_r (a resisting torque opposes motion; ripple pushes and pulls with angle).
Terms
| term | required | unit (SI) | units a fit may use | measured by |
|---|---|---|---|---|
harmonics | yes | N·m | N·m, mN·m | a rotor-angle sweep (the plateaus, if they cover more than one rotor turn) |
coulomb_friction | no | N·m | N·m, mN·m | velocity plateaus, both directions, 6-8 speeds, each at least one rotor turn |
viscous_friction | no | N·m·s/rad | N·m·s/rad, mN·m·s/rad | velocity plateaus, both directions, 6-8 speeds, each at least one rotor turn |
output_inertia | no | kg·m² | kg·m², kg·cm², kg·mm², g·cm², g·mm² | chirps (or the datasheet) |
Declared terms (the rest are registry keys, defined in SCHEMA2.md §7.3):
harmonics: The ripple harmonics: a list of {rotor_harmonic, amplitude, phase}, rotor_harmonic in cycles per rotor turn (an integer >= 1, each once), amplitude in the term's unit (>= 0, the torque at the output), phase in rad.
Inputs and state
- input
v(rad/s): The output's angular speed. - input
theta_rotor(rad): The rotor's angle, gear_ratio times the output angle from the rotor zero the simulator uses.
Backends
| backend | how | engine | what runs |
|---|---|---|---|
| python | reference | — | model.py (sha256 e30eb5e3ed7c…). The contract's own ruler: stdlib Python, torque(terms, inputs, state, dt) -> (tau_r, state), terms in SI. |
| js | reference | — | model.js (sha256 31f08577ba8c…). The same equation as model.py as an ES module (torque(terms, inputs, state, dt) -> {tau, state}); tests/acceptance_v2/test_amendment_2_5.py holds the two to 1e-12. |
| mujoco | plugin | mujoco, release named by the fit | robotparts.mujoco. Friction natively; the plugin applies the ripple from the rotor angle each step. Maps: armature = output_inertia, frictionloss = coulomb_friction, damping = viscous_friction. |
mujoco settings a fit may state:
friction_solref: 2 numbers. The joint's solreffriction (timeconst, dampratio): how hard frictionloss sticks; MuJoCo's soft default creeps below about 0.4 rad/s on a light hinge.friction_solimp: 5 numbers, in (0, inf). The joint's solimpfriction (dmin, dmax, width, midpoint, power), every entry > 0.
Validity
- A fit states the range of
output_speed(rad/s) it holds across: |v|, the output speed the terms were fitted or checked across. - The ripple is periodic in the rotor angle and the same in both directions (cogging); direction-dependent ripple is not modelled.
- The harmonics hold wherever the joint goes, because the magnets turn with the rotor.
Use it
import importlib.util
spec = importlib.util.spec_from_file_location("ripple", "model.py")
model = importlib.util.module_from_spec(spec); spec.loader.exec_module(model)
terms = {...} # a fit's terms in SI (robotparts.models.si_terms(fit, definition) converts them)
tau_r, state = model.torque(terms, {"v": 0.0, "theta_rotor": 0.0}, None, 0.001)
Defined since robotparts/2.3. It is robotparts/2.3's ripple_map kind. The contract is SCHEMA2.md §4.3.2; the fit format is schemas/model.schema.json.