Tools
MuJoCo 物理の設定階層
MuJoCo の物理シミュレーションを構成する 5 階層 (option / compiler / solver / joint-geom / actuator) と各要素の主要パラメータ・単位・実用値
要点
MuJoCo の物理設定は 5 階層。上から順に (1) <option> 積分器/ソルバ、(2) <compiler> 前処理、(3) 接触 impedance (solref/solimp)、(4) joint/geom プロパティ、(5) actuator。
各階層と主要パラメータ
1. <option> — 全体積分器・ソルバ
<option timestep="0.001" integrator="implicitfast" cone="elliptic"
iterations="100" noslip_iterations="15">
<flag sleep="enable"/>
</option>| 属性 | 意味 | 実用値 |
|---|---|---|
timestep [s] | 積分ステップ | 0.001-0.005 |
integrator | 積分方式 | implicitfast (推奨) / RK4 / Euler / implicit |
cone | 摩擦錐 | pyramidal (高速) / elliptic (正確、車輪向き) |
iterations | ソルバ反復数 | 100 (default) |
noslip_iterations | 追加 no-slip 反復 | 車輪では 10-20 |
impratio | 摩擦/法線 impedance 比 | 1 (default) |
<flag sleep="enable"/> | 静止 body の休止 | 大量 body のパフォーマンス改善 |
2. <compiler> — 前処理
<compiler angle="radian" autolimits="true" discardvisual="true"/>angle="radian"|"degree": joint 角度単位autolimits="true":rangeで自動でlimited=trueにdiscardvisual="true": contype=0 の geom を physics から除外 (メモリ節約)inertiafromgeom="true|false|auto": body の inertial を geom から自動計算
3. 接触 impedance (per-contact)
接触の剛性・減衰は 2 属性で決まる。
solref="timeconst dampratio": 接触制約の time constant [s] と damping ratio- default
"0.02 1"— 20ms で settle, critical damping - 硬く:
"0.005 1"(5ms) - 柔らかく:
"0.05 1.5"(50ms + overdamped)
- default
solimp="dmin dmax width mid power": 貫入距離依存の impedance プロファイル- default
"0.9 0.95 0.001 0.5 2" dmin: 深い貫入時の impedancedmax: 表面接触時の impedancewidth: 遷移幅 [m]
- default
4. Joint / Geom プロパティ
| 属性 | 単位 | 意味 |
|---|---|---|
<joint damping="x"> | N·m·s/rad (hinge) / N·s/m (slide) | 粘性 |
<joint armature="x"> | kg·m² | 反射慣性 (ギア減速機のロータ慣性) |
<joint frictionloss="x"> | N·m or N | Coulomb 摩擦 (静止摩擦) |
<joint stiffness="x"> | N·m/rad | ばね |
<geom friction="slide roll spin"> | 無次元 3 成分 | 摩擦係数 (デフォルト "1 0.005 0.0001") |
<geom mass="x"> / <geom density="x"> | kg / kg/m³ | 質量指定 |
| `<geom condim="1 | 3 | 4 |
<geom margin="x"> | m | 接触検出マージン |
5. Actuator (実機との対応)
| 種類 | 用途 | 主要属性 |
|---|---|---|
<motor> | 生トルク/力 | gear, ctrlrange, forcerange |
<velocity kv="x"> | 速度サーボ hack | force = kv * (ctrl*gear - joint_vel) |
<position kp="" kv=""> | 位置サーボ (PD) | force = kp*err - kv*vel |
<dcmotor> | DC モータの電気モデル | resistance, motorconst (Kt Ke), inductance, saturation (電流上限 [A]), controller (内部 PID), input (voltage/velocity/position) |
<general> | プログラマブル | dyntype, gaintype, biastype |
<dcmotor> の例 (RoboMaster M2006 P36 相当):
<dcmotor name="wheel0" joint="wheel0_joint"
resistance="0.038" motorconst="0.056 0.056"
inductance="1.6e-5 0" saturation="2.25 0 0"
input="velocity" controller="0.136 0.036 0 0 0 24"/>controller="kp ki kd int_min int_max u_max"の 6 要素。内部の PID + 電圧飽和input="velocity": ctrl は速度目標 (rad/s) として解釈
チューニング手順
- 骨格作成: URDF → MJCF (Menagerie の変換スクリプト or 手書き)
<option>: timestep / integrator / cone を用途に合わせる (車輪あるなら elliptic + noslip_iterations)<default>class: 繰り返し要素をまとめて記述- actuator: 実機モータ種別に合わせる。BLDC なら
<dcmotor>+ preset class (fibril_sim_models が公開) - damping / friction / solref: 実機と挙動が合わない箇所を上下. 車輪の跳ね上がりは damping 増 or solref 柔らかく
デバッグの視点
- 貫入が深い / すり抜け: solimp の dmax を上げる or timestep を下げる
- 接触が硬すぎて跳ねる: solref の time constant を大きく (0.02 → 0.05)
- 車輪が滑る: friction 上げる or noslip_iterations 増
- PID が振動: kd 増 or kp 減
- 重すぎて動かない: forcerange の上限 or gear ratio 確認
参考
- MuJoCo XML reference: https://mujoco.readthedocs.io/en/stable/XMLreference.html
- Modeling guide: https://mujoco.readthedocs.io/en/stable/modeling.html
- Physics computation overview: https://mujoco.readthedocs.io/en/stable/computation/index.html
- MuJoCo Menagerie (実例集): https://github.com/google-deepmind/mujoco_menagerie
最終更新: